mirror of
https://github.com/OpenSPG/openspg.git
synced 2025-06-27 03:20:10 +00:00
fix(reasoner): remove duplicate vertex (#325)
This commit is contained in:
parent
884b598c03
commit
2f18a19769
@ -1490,31 +1490,32 @@ public class LocalRDG extends RDG<LocalRDG> {
|
||||
debugStartNodeINfos);
|
||||
}
|
||||
LocalReasonerResult localReasonerResult = getResult();
|
||||
|
||||
java.util.Set<IVertex<IVertexId, IProperty>> vertexSet = new HashSet<>();
|
||||
java.util.Set<IEdge<IVertexId, IProperty>> edgeSet = new HashSet<>();
|
||||
this.kgGraphList.forEach(
|
||||
graph -> {
|
||||
for (String alias : graph.getVertexAlias()) {
|
||||
localReasonerResult.getVertexList().addAll(graph.getVertex(alias));
|
||||
vertexSet.addAll(graph.getVertex(alias));
|
||||
}
|
||||
for (String alias : graph.getEdgeAlias()) {
|
||||
java.util.List<IEdge<IVertexId, IProperty>> edges = graph.getEdge(alias);
|
||||
for (IEdge<IVertexId, IProperty> edge : edges) {
|
||||
if (edge instanceof PathEdge) {
|
||||
if (((PathEdge<?, ?, ?>) edge).getVertexList() != null) {
|
||||
localReasonerResult
|
||||
.getVertexList()
|
||||
.addAll(((PathEdge<IVertexId, IProperty, IProperty>) edge).getVertexList());
|
||||
vertexSet.addAll(
|
||||
((PathEdge<IVertexId, IProperty, IProperty>) edge).getVertexList());
|
||||
}
|
||||
if (((PathEdge<?, ?, ?>) edge).getEdgeList() != null) {
|
||||
localReasonerResult
|
||||
.getEdgeList()
|
||||
.addAll(((PathEdge<IVertexId, IProperty, IProperty>) edge).getEdgeList());
|
||||
edgeSet.addAll(((PathEdge<IVertexId, IProperty, IProperty>) edge).getEdgeList());
|
||||
}
|
||||
}
|
||||
localReasonerResult.getEdgeList().add(edge);
|
||||
edgeSet.add(edge);
|
||||
}
|
||||
localReasonerResult.getEdgeList().addAll(graph.getEdge(alias));
|
||||
}
|
||||
});
|
||||
localReasonerResult.getVertexList().addAll(vertexSet);
|
||||
localReasonerResult.getEdgeList().addAll(edgeSet);
|
||||
return localReasonerResult;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user