use of org.neo4j.driver.internal.InternalEntity in project neo4j-apoc-procedures by neo4j-contrib.
the class Bolt method toRelationship.
private Object toRelationship(Object value, boolean virtual, Map<Long, Object> nodesCache) {
Value internalValue = ((InternalEntity) value).asValue();
Relationship relationship = internalValue.asRelationship();
if (virtual) {
VirtualNode start = (VirtualNode) nodesCache.getOrDefault(relationship.startNodeId(), new VirtualNode(relationship.startNodeId(), db));
VirtualNode end = (VirtualNode) nodesCache.getOrDefault(relationship.endNodeId(), new VirtualNode(relationship.endNodeId(), db));
VirtualRelationship virtualRelationship = new VirtualRelationship(relationship.id(), start, end, RelationshipType.withName(relationship.type()), relationship.asMap());
return virtualRelationship;
} else
return Util.map("entityType", internalValue.type().name(), "type", relationship.type(), "id", relationship.id(), "start", relationship.startNodeId(), "end", relationship.endNodeId(), "properties", relationship.asMap());
}
use of org.neo4j.driver.internal.InternalEntity in project neo4j-apoc-procedures by neo4j-contrib.
the class Bolt method toNode.
private Object toNode(Object value, boolean virtual, Map<Long, Object> nodesCache) {
Value internalValue = ((InternalEntity) value).asValue();
Node node = internalValue.asNode();
if (virtual) {
List<Label> labels = new ArrayList<>();
node.labels().forEach(l -> labels.add(Label.label(l)));
VirtualNode virtualNode = new VirtualNode(node.id(), labels.toArray(new Label[0]), node.asMap(), db);
nodesCache.put(node.id(), virtualNode);
return virtualNode;
} else
return Util.map("entityType", internalValue.type().name(), "labels", node.labels(), "id", node.id(), "properties", node.asMap());
}
Aggregations