Package org.neo4j.ogm.cypher.compiler
Interface Compiler
- All Known Implementing Classes:
MultiStatementCypherCompiler
public interface Compiler
Defines a simple API for building up Cypher queries programmatically.
- Author:
- Vince Bickers, Luanne Misquitta
-
Method Summary
Modifier and TypeMethodDescriptioncontext()
Returns this compiler's contextList<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that create nodes built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that create relationships built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that delete relationship entities built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that delete relationships built up through thisCompiler
.existingNode
(Long existingNodeId) Returns aNodeBuilder
that represents a node that already exists in the database and matches the given ID.existingRelationship
(Long existingRelationshipId, Relationship.Direction direction, String type, boolean wasDirty) Returns aRelationshipBuilder
that represents and existing relationship entity to be modified in the databaseList<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that have been built up through thisCompiler
.boolean
Whether there new relationships to be created that depend on nodes being created firstReturnsNodeBuilder
that represents a new node to be created in the database.newRelationship
(String type) Returns aRelationshipBuilder
that represents a new relationship to be created in the databasenewRelationship
(String type, boolean bidirectional) Returns aRelationshipBuilder
that represents a new relationship to be created in the databasevoid
unmap
(NodeBuilder nodeBuilder) Remove aNodeBuilder
Defines a relationship deletion between the specified start node to end node with the given relationship type and direction.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that update nodes built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that update relationships built up through thisCompiler
.void
useStatementFactory
(org.neo4j.ogm.request.StatementFactory statementFactory)
-
Method Details
-
newNode
ReturnsNodeBuilder
that represents a new node to be created in the database.- Returns:
- A
NodeBuilder
representing a new node
-
newRelationship
Returns aRelationshipBuilder
that represents a new relationship to be created in the database- Parameters:
type
- the relationship typebidirectional
- true if the relationship must be created in both incoming and outgoing directions, false otherwise- Returns:
- A
RelationshipBuilder
representing a new relationship
-
newRelationship
Returns aRelationshipBuilder
that represents a new relationship to be created in the database- Parameters:
type
- the relationship type- Returns:
- A
RelationshipBuilder
representing a new relationship
-
existingNode
Returns aNodeBuilder
that represents a node that already exists in the database and matches the given ID.- Parameters:
existingNodeId
- The ID of the node in the database- Returns:
- A
NodeBuilder
representing the node in the database that corresponds to the given ID
-
existingRelationship
RelationshipBuilder existingRelationship(Long existingRelationshipId, Relationship.Direction direction, String type, boolean wasDirty) Returns aRelationshipBuilder
that represents and existing relationship entity to be modified in the database- Parameters:
existingRelationshipId
- The ID of the relationship in the database, which shouldn't benull
direction
- The direction of the existing relationshipwasDirty
- A flag if the relationship was in a dirty state- Returns:
- A new
RelationshipBuilder
bound to the identified relationship entity
-
unrelate
Defines a relationship deletion between the specified start node to end node with the given relationship type and direction.- Parameters:
startNode
- The reference of the relationship start noderelationshipType
- The type of relationship between the nodes to deleteendNode
- The reference of the relationship end noderelId
- The id of the relationship to unrelate
-
unmap
Remove aNodeBuilder
- Parameters:
nodeBuilder
- TheNodeBuilder
-
createNodesStatements
List<org.neo4j.ogm.request.Statement> createNodesStatements()Retrieves the Cypher statements that create nodes built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
createRelationshipsStatements
List<org.neo4j.ogm.request.Statement> createRelationshipsStatements()Retrieves the Cypher statements that create relationships built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
updateNodesStatements
List<org.neo4j.ogm.request.Statement> updateNodesStatements()Retrieves the Cypher statements that update nodes built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
updateRelationshipStatements
List<org.neo4j.ogm.request.Statement> updateRelationshipStatements()Retrieves the Cypher statements that update relationships built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
deleteRelationshipStatements
List<org.neo4j.ogm.request.Statement> deleteRelationshipStatements()Retrieves the Cypher statements that delete relationships built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
deleteRelationshipEntityStatements
List<org.neo4j.ogm.request.Statement> deleteRelationshipEntityStatements()Retrieves the Cypher statements that delete relationship entities built up through thisCompiler
.- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
getAllStatements
List<org.neo4j.ogm.request.Statement> getAllStatements()Retrieves the Cypher statements that have been built up through thisCompiler
.Please node that there is no requirement that implementations of
Compiler
provide an idempotent or even deterministic implementation of this method. Therefore, it's recommended to only call this method once after all query building has been completed and to be aware that some statements may depend upon results of previous statements- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
context
CompileContext context()Returns this compiler's context- Returns:
- the current compiler context
-
hasStatementsDependentOnNewNodes
boolean hasStatementsDependentOnNewNodes()Whether there new relationships to be created that depend on nodes being created first- Returns:
- true if there are any statements that depend on new nodes being created first
-
useStatementFactory
void useStatementFactory(org.neo4j.ogm.request.StatementFactory statementFactory) - Parameters:
statementFactory
- TheStatementFactory
-