Skip to content

Commit

Permalink
Graph traversing fix value null
Browse files Browse the repository at this point in the history
  • Loading branch information
DaJaime committed May 7, 2024
1 parent a3b4083 commit 5079845
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public JSONObject traversingGraph(@RequestBody GraphTraversingQuery graphTravers
// (lib:a)-[versions]->(release:a1)-[:dependency]->(lib:b)-[versions]->(release:b1)
for(String releaseGav : new HashSet<>(releasesToTreat)) {
InternGraph releaseGraph = GraphDatabaseSingleton.getInstance().getReleaseWithLibAndDependencies(releaseGav);
releaseGraph.clearValueNodes();
resultGraph.mergeGraph(releaseGraph);
visitedReleases.add(releaseGav);
releasesToTreat.addAll(releaseGraph.getGraphNodes().stream().filter(ReleaseNode.class::isInstance).map(NodeObject::getId).collect(Collectors.toSet()));
Expand Down Expand Up @@ -80,9 +81,6 @@ public JSONObject traversingGraph(@RequestBody GraphTraversingQuery graphTravers
}
releasesToTreat.removeAll(visitedReleases);
}



Weaver.weaveGraph(resultGraph, graphTraversingQuery.getAddedValues());
return resultGraph.getJsonGraph();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class InternGraph {
private final Set<NodeObject> graphNodes = new HashSet<>();
private final Set<EdgeObject> graphEdges = new HashSet<>();
private final Set<ValueObject> graphValues = new HashSet<>();
private Set<ValueObject> graphValues = new HashSet<>();

public InternGraph() {
}
Expand Down Expand Up @@ -54,6 +54,10 @@ public void mergeGraph(InternGraph graph){
this.graphValues.addAll(graph.getGraphValues());
}

public void clearValueNodes(){
this.graphValues = new HashSet<>();
}

private void addObjectsToJSONArray(Set<? extends GraphObject> objects, String key, JSONObject graphJSON) {
if (!objects.isEmpty()) {
JSONArray array = new JSONArray();
Expand Down

0 comments on commit 5079845

Please sign in to comment.