001package gudusoft.gsqlparser.dlineage.dynamicsql; 002 003/** 004 * One column-level lineage edge produced by analyzing a resolved dynamic-SQL 005 * string, carried together with its dynamic provenance. 006 * 007 * <p>{@code origin} is always {@link #ORIGIN_DYNAMIC_RESOLVED}: it is GSP's 008 * evaluation fact ("this edge exists because we evaluated the proc with the 009 * given bindings and materialized the dynamic SQL"). The downstream consumer 010 * maps it to its own persisted origin / confidence model. 011 */ 012public final class DynamicLineageEdge { 013 014 public static final String ORIGIN_DYNAMIC_RESOLVED = "DYNAMIC_RESOLVED"; 015 016 private final String sourceColumn; // e.g. JOURNALENGINE.dbo.RECON_AEG_01_QSP_....grootboeknummer 017 private final String targetColumn; // e.g. JOURNALENGINE.dbo.RECON_JE_02_QSP_....grootboeknummer 018 private final String effectType; // dlineage effectType (select / function / ...) 019 private final String relationType; // dlineage relation type (fdd projected data / fdr influence) 020 private final String origin; 021 private final String sourceProc; 022 private final String dynamicSite; 023 private final String bindingHash; 024 025 DynamicLineageEdge(String sourceColumn, String targetColumn, String effectType, String relationType, 026 String sourceProc, String dynamicSite, String bindingHash) { 027 this.sourceColumn = sourceColumn; 028 this.targetColumn = targetColumn; 029 this.effectType = effectType; 030 this.relationType = relationType; 031 this.origin = ORIGIN_DYNAMIC_RESOLVED; 032 this.sourceProc = sourceProc; 033 this.dynamicSite = dynamicSite; 034 this.bindingHash = bindingHash; 035 } 036 037 public String getSourceColumn() { 038 return sourceColumn; 039 } 040 041 public String getTargetColumn() { 042 return targetColumn; 043 } 044 045 public String getEffectType() { 046 return effectType; 047 } 048 049 public String getRelationType() { 050 return relationType; 051 } 052 053 /** True for projected data lineage (dlineage type {@code fdd}); false for join/filter influence ({@code fdr}). */ 054 public boolean isProjectedData() { 055 return "fdd".equals(relationType); 056 } 057 058 public String getOrigin() { 059 return origin; 060 } 061 062 public String getSourceProc() { 063 return sourceProc; 064 } 065 066 public String getDynamicSite() { 067 return dynamicSite; 068 } 069 070 public String getBindingHash() { 071 return bindingHash; 072 } 073 074 @Override 075 public String toString() { 076 return relationType + "/" + effectType + ": " + sourceColumn + " -> " + targetColumn 077 + " [" + origin + " @ " + dynamicSite + "]"; 078 } 079}