protected Neo4jGraphVariables(final Neo4jGraph graph) { this.graph = graph; baseGraph = graph.getBaseGraph(); }
@Override public void doOpen() { threadLocalTx.set(getBaseGraph().tx()); }
final Predicate<Neo4jNode> nodePredicate = this.trait.getNodePredicate(); if (0 == vertexIds.length) { return IteratorUtils.stream(this.getBaseGraph().allNodes()) .filter(nodePredicate) .map(node -> (Vertex) new Neo4jVertex(node, this)).iterator();
final Predicate<Neo4jRelationship> relationshipPredicate = this.trait.getRelationshipPredicate(); if (0 == edgeIds.length) { return IteratorUtils.stream(this.getBaseGraph().allRelationships()) .filter(relationshipPredicate) .map(relationship -> (Edge) new Neo4jEdge(relationship, this)).iterator();
if (graph.getBaseGraph().hasSchemaIndex(label.get(), hasContainer.getKey())) { return Stream.concat( IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get(), hasContainer.getKey(), hasContainer.getValue())) .filter(getNodePredicate()) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)), IteratorUtils.stream(graph.getBaseGraph().findNodes(VERTEX_PROPERTY_LABEL, hasContainer.getKey(), hasContainer.getValue())) // look up indexed vertex property nodes .map(node -> node.relationships(Neo4jDirection.INCOMING).iterator().next().start()) .map(node -> (Vertex) new Neo4jVertex(node, graph)) return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get())) .filter(getNodePredicate()) .map(node -> (Vertex) new Neo4jVertex(node, graph))
if (graph.getBaseGraph().hasSchemaIndex(label.get(), hasContainer.getKey())) { return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get(), hasContainer.getKey(), hasContainer.getValue())) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)).iterator(); return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get())) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)).iterator();
protected Neo4jGraphVariables(final Neo4jGraph graph) { this.graph = graph; baseGraph = graph.getBaseGraph(); }
@Override public void doOpen() { threadLocalTx.set(getBaseGraph().tx()); }
if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get(); final Neo4jNode node = vertex.getBaseVertex(); final Neo4jGraphAPI graph = ((Neo4jGraph) vertex.graph()).getBaseGraph(); final String prefixedKey = Graph.Hidden.hide(key); if (node.hasProperty(key)) {
private GraphDatabaseService getGraphDatabaseService() { // TODO: it would be nice if TinkerPop would expose the GraphDatabaseService return ((Neo4jGraphAPIImpl) getNeo4jGraph().getBaseGraph()).getGraphDatabase(); }
final Predicate<Neo4jNode> nodePredicate = this.trait.getNodePredicate(); if (0 == vertexIds.length) { return IteratorUtils.stream(this.getBaseGraph().allNodes()) .filter(nodePredicate) .map(node -> (Vertex) new Neo4jVertex(node, this)).iterator();
final Predicate<Neo4jRelationship> relationshipPredicate = this.trait.getRelationshipPredicate(); if (0 == edgeIds.length) { return IteratorUtils.stream(this.getBaseGraph().allRelationships()) .filter(relationshipPredicate) .map(relationship -> (Edge) new Neo4jEdge(relationship, this)).iterator();
if (graph.getBaseGraph().hasSchemaIndex(label.get(), hasContainer.getKey())) { return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get(), hasContainer.getKey(), hasContainer.getValue())) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)).iterator(); return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get())) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)).iterator();
if (graph.getBaseGraph().hasSchemaIndex(label.get(), hasContainer.getKey())) { return Stream.concat( IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get(), hasContainer.getKey(), hasContainer.getValue())) .filter(getNodePredicate()) .map(node -> (Vertex) new Neo4jVertex(node, graph)) .filter(vertex -> HasContainer.testAll(vertex, hasContainers)), IteratorUtils.stream(graph.getBaseGraph().findNodes(VERTEX_PROPERTY_LABEL, hasContainer.getKey(), hasContainer.getValue())) // look up indexed vertex property nodes .map(node -> node.relationships(Neo4jDirection.INCOMING).iterator().next().start()) .map(node -> (Vertex) new Neo4jVertex(node, graph)) return IteratorUtils.stream(graph.getBaseGraph().findNodes(label.get())) .filter(getNodePredicate()) .map(node -> (Vertex) new Neo4jVertex(node, graph))
if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get(); final Neo4jNode node = vertex.getBaseVertex(); final Neo4jGraphAPI graph = ((Neo4jGraph) vertex.graph()).getBaseGraph(); final String prefixedKey = Graph.Hidden.hide(key); if (node.hasProperty(key)) {