@@ -24,19 +24,20 @@ func processOpenGraphData(g *engine.IndexedGraph, ogd opengraph.Model) error {
2424 seenMatchAttrs := make (map [engine.Attribute ]struct {})
2525 for _ , edge := range ogd .Graph .Edges {
2626 startAttr := engine .NewAttribute (edge .Start .MatchBy )
27- if _ , seen := seenMatchAttrs [startAttr ]; ! seen {
27+ endAttr := engine .NewAttribute (edge .End .MatchBy )
28+
29+ startNode , startFound := g .FindOrAdd (startAttr , engine .NV (edge .Start .MatchBy ))
30+ endNode , endFound := g .FindOrAdd (endAttr , engine .NV (edge .End .MatchBy ))
31+
32+ if _ , seen := seenMatchAttrs [startAttr ]; ! seen && ! startFound {
2833 startAttr .Flag (engine .Merge )
2934 seenMatchAttrs [startAttr ] = struct {}{}
3035 }
31- endAttr := engine .NewAttribute (edge .End .MatchBy ).Flag (engine .Merge )
32- if _ , seen := seenMatchAttrs [endAttr ]; ! seen {
36+ if _ , seen := seenMatchAttrs [endAttr ]; ! seen && ! endFound {
3337 endAttr .Flag (engine .Merge )
3438 seenMatchAttrs [endAttr ] = struct {}{}
3539 }
3640
37- startNode , _ := g .FindOrAdd (startAttr , engine .NV (edge .Start .MatchBy ))
38- endNode , _ := g .FindOrAdd (endAttr , engine .NV (edge .End .MatchBy ))
39-
4041 edge := engine .NewEdge (edge .Kind )
4142 g .EdgeTo (startNode , endNode , edge )
4243 }
0 commit comments