Class AbstractNeo4JRepository<S,​ID>

    • Constructor Detail

    • Method Detail

      • buildWhere

        protected String buildWhere​(List<Pair<String,​Object>> tuples)
        Helper function that builds the WHERE statement for findByCondition
        Parameters:
        tuples - to be transformed into "n.key = n.value AND ..."
        Returns:
        String for build
      • buildParameters

        protected org.neo4j.driver.Value buildParameters​(List<Pair<String,​Object>> tuples)
        Helper function that turns the key value pairs into a Values object for the parameterized queryTyped
        Parameters:
        tuples - to be transformed into a Value for the DB
        Returns:
        Value to be used in cypher queryTyped
      • findBy

        public abstract S findBy​(String condition,
                                 org.neo4j.driver.Value parameters)
        Returns the first node that satisfies the given condition. The condition may access the node with "n" Example: findByCondition("n.name = $name", Values.parameters("name", "Dijkstra"))
        Parameters:
        condition - any condition that would be after the "WHERE" in a cypher queryTyped
        parameters - all parameters defined in the condition (parameters optional)
        Returns:
        first node that satisifes condition with parameters
      • findAllBy

        public abstract Iterable<S> findAllBy​(String condition,
                                              org.neo4j.driver.Value parameters)
        Returns ALL science.neo4j.nodes that satisfies the given condition. The condition may access the node with "n" Example: findByCondition("n.name in $names", Values.parameters("names", Values.parameters("Dijkstra", "Knuth", "Turing")))
        Parameters:
        condition - any condition that would be after the "WHERE" in a cypher queryTyped
        parameters - all parameters defined in the condition (parameters optional)
        Returns:
        first node that satisifes condition with parameters
      • findBy

        public S findBy​(String field,
                        String value)
        Find node by a field with a given value
        Parameters:
        field - name of field that should match
        value - value that should be matched to
        Returns:
        first node that has the given value in the field
      • findAllBy

        public Iterable<S> findAllBy​(String field,
                                     String value)
        Find all science.neo4j.nodes by a field with a given value (eg. n.amount = 3)
        Parameters:
        field - name of field that should match
        value - value that should be matched to
        Returns:
        all science.neo4j.nodes that have the given value in the field
      • findBy

        public S findBy​(List<Pair<String,​Object>> values)
        Find node by a list of fields that should match a given value
        Parameters:
        values - Key Value pairs where the key is the fieldname and the value is the value the field should match
        Returns:
        first node that matches on all fields
      • findAllBy

        public Iterable<S> findAllBy​(List<Pair<String,​Object>> values)
        Find science.neo4j.nodes by a list of fields that should match a given value
        Parameters:
        values - Key Value pairs where the key is the fieldname and the value is the value the field should match
        Returns:
        all science.neo4j.nodes that match fields