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 Details

    • newNode

      NodeBuilder newNode(Long id)
      Returns NodeBuilder that represents a new node to be created in the database.
      Returns:
      A NodeBuilder representing a new node
    • newRelationship

      RelationshipBuilder newRelationship(String type, boolean bidirectional)
      Returns a RelationshipBuilder that represents a new relationship to be created in the database
      Parameters:
      type - the relationship type
      bidirectional - true if the relationship must be created in both incoming and outgoing directions, false otherwise
      Returns:
      A RelationshipBuilder representing a new relationship
    • newRelationship

      RelationshipBuilder newRelationship(String type)
      Returns a RelationshipBuilder that represents a new relationship to be created in the database
      Parameters:
      type - the relationship type
      Returns:
      A RelationshipBuilder representing a new relationship
    • existingNode

      NodeBuilder existingNode(Long existingNodeId)
      Returns a NodeBuilder 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 a RelationshipBuilder 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 be null
      direction - The direction of the existing relationship
      wasDirty - A flag if the relationship was in a dirty state
      Returns:
      A new RelationshipBuilder bound to the identified relationship entity
    • unrelate

      RelationshipBuilder unrelate(Long startNode, String relationshipType, Long endNode, Long relId)
      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 node
      relationshipType - The type of relationship between the nodes to delete
      endNode - The reference of the relationship end node
      relId - The id of the relationship to unrelate
    • unmap

      void unmap(NodeBuilder nodeBuilder)
      Remove a NodeBuilder
      Parameters:
      nodeBuilder - The NodeBuilder
    • createNodesStatements

      List<org.neo4j.ogm.request.Statement> createNodesStatements()
      Retrieves the Cypher statements that create nodes built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • createRelationshipsStatements

      List<org.neo4j.ogm.request.Statement> createRelationshipsStatements()
      Retrieves the Cypher statements that create relationships built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • updateNodesStatements

      List<org.neo4j.ogm.request.Statement> updateNodesStatements()
      Retrieves the Cypher statements that update nodes built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • updateRelationshipStatements

      List<org.neo4j.ogm.request.Statement> updateRelationshipStatements()
      Retrieves the Cypher statements that update relationships built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • deleteRelationshipStatements

      List<org.neo4j.ogm.request.Statement> deleteRelationshipStatements()
      Retrieves the Cypher statements that delete relationships built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • deleteRelationshipEntityStatements

      List<org.neo4j.ogm.request.Statement> deleteRelationshipEntityStatements()
      Retrieves the Cypher statements that delete relationship entities built up through this Compiler.
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • getAllStatements

      List<org.neo4j.ogm.request.Statement> getAllStatements()
      Retrieves the Cypher statements that have been built up through this Compiler.

      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, never null
    • 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)
      Specify the StatementFactory that this Compiler will useto produce Statements
      Parameters:
      statementFactory - The StatementFactory