OrientDB no return for reading outgoing vertex edges

I am trying to read the edges that I previously added to the database:

Iterable<Vertex> startNodes = getVertexList(relationshipStorage.getStartNode(), graph); Iterable<Vertex> endNodes = getVertexList(relationshipStorage.getEndNode(), graph); List<Edge> list = StreamSupport.stream(startNodes.spliterator(), false) .flatMap(vertex1 -> StreamSupport.stream(vertex1.getEdges(Direction.OUT, relationshipId).spliterator(), false)) .filter(edge -> StreamSupport.stream(endNodes.spliterator(), false).anyMatch(vertex -> edge.getVertex(Direction.IN).equals(vertex))) .collect(Collectors.toList()); 

I create the following method:

 Iterable<Vertex> startNodes = this.getVertexList(storage.getStartNode(), graph); Iterable<Vertex> endNodes = this.getVertexList(storage.getEndNode(), graph); for (Vertex startNode : startNodes) { for (Vertex endNode : endNodes) { String edgeClass = "class:" + storage.getId(); Edge edge = startNode.addEdge(edgeClass, endNode); for (Map.Entry<String, Object> entry : storage.getProperties().entrySet()) { edge.setProperty(entry.getKey(), entry.getValue()); } edge.setProperty(Constants.TAG_HASH, HashCreator.sha1FromRelationship(storage)); edge.setProperty(Constants.TAG_SNAPSHOT_ID, snapshotId); } } graph.commit(); 

But it looks like the return is always empty because the return of the first vertex1.getEdges(Direction.OUT, relationshipId) is null. It is strange that it is not null if I use Direction.IN , but it does not help me.

+6
source share

Source: https://habr.com/ru/post/1012913/


All Articles