Class RelationshipBase<S extends NodeBase<?>,​E extends NodeBase<?>,​SELF extends RelationshipBase<S,​E,​SELF>>

    • Constructor Detail

      • RelationshipBase

        protected RelationshipBase​(S start,
                                   String type,
                                   E end,
                                   String... additionalTypes)
        Always creates a relationship from start to end (left to right).
        Parameters:
        start - start node
        end - end node
        type - type of the relationship
        additionalTypes - additional types to add to the relationship
      • RelationshipBase

        protected RelationshipBase​(SymbolicName symbolicName,
                                   Node start,
                                   String type,
                                   Properties properties,
                                   Node end,
                                   String... additionalTypes)
        Always creates a relationship from start to end (left to right).
        Parameters:
        symbolicName - an optional symbolic name
        start - start node
        properties - The properties for the relationship
        end - end node
        type - type of the relationship
        additionalTypes - Additional types to be added to the relationship, only meaningfull when the object is used for querying, when used in a CREATE or MERGE clause the runtime will throw an exception.
    • Method Detail

      • named

        @NotNull
        public final SELF named​(String newSymbolicName)
        Description copied from interface: Relationship
        Creates a copy of this relationship with a new symbolic name.
        Specified by:
        named in interface Relationship
        Specified by:
        named in interface RelationshipPattern
        Parameters:
        newSymbolicName - the new symbolic name.
        Returns:
        The new relationship.
      • named

        @NotNull
        public abstract SELF named​(SymbolicName newSymbolicName)
        This method needs to be implemented to provide new, type safe instances of this relationship.
        Specified by:
        named in interface Relationship
        Specified by:
        named in interface RelationshipPattern
        Parameters:
        newSymbolicName - the new symbolic name.
        Returns:
        A new relationship
      • withProperties

        @NotNull
        public final SELF withProperties​(Object... keysAndValues)
        Description copied from interface: ExposesProperties
        Creates a a copy of this property container with additional properties. Creates a property container without properties when no properties are passed to this method.
        Specified by:
        withProperties in interface ExposesProperties<S extends NodeBase<?>>
        Parameters:
        keysAndValues - A list of key and values. Must be an even number, with alternating String and Expression.
        Returns:
        The new property container.
      • withProperties

        @NotNull
        public final SELF withProperties​(Map<String,​Object> newProperties)
        Description copied from interface: ExposesProperties
        Creates a a copy of this property container with additional properties.
        Specified by:
        withProperties in interface ExposesProperties<S extends NodeBase<?>>
        Parameters:
        newProperties - A map with the new properties
        Returns:
        The new property container.
      • withProperties

        @NotNull
        public abstract SELF withProperties​(MapExpression newProperties)
        This method needs to be implemented to provide new, type safe instances of this relationship.
        Specified by:
        withProperties in interface ExposesProperties<S extends NodeBase<?>>
        Parameters:
        newProperties - the new properties (can be null to remove exiting properties).
        Returns:
        A new relationship
      • getDetails

        @NotNull
        public final @NotNull Relationship.Details getDetails()
        Description copied from interface: Relationship
        The details contains the types, properties and cardinality.
        Specified by:
        getDetails in interface Relationship
        Returns:
        A wrapper around the details of this relationship.
      • inverse

        @NotNull
        public final @NotNull Relationship inverse()
        Description copied from interface: Relationship
        Creates a new relationship, inverting the direction but keeping the semantics intact ((a) --> (b) becomes (b) <-- (a)). A symbolic name will be removed from this relationship if any, as the it wouldn't be the same pattern to match against.
        Specified by:
        inverse in interface Relationship
        Returns:
        the new relationship
      • relationshipTo

        @NotNull
        public final @NotNull RelationshipChain relationshipTo​(Node other,
                                                               String... types)
        Description copied from interface: ExposesRelationships
        Starts building an outgoing relationship to the other node.
        Specified by:
        relationshipTo in interface ExposesRelationships<S extends NodeBase<?>>
        Parameters:
        other - The other end of the outgoing relationship
        types - The types to match
        Returns:
        An ongoing relationship definition, that can be used to specify the type
      • relationshipFrom

        @NotNull
        public final @NotNull RelationshipChain relationshipFrom​(Node other,
                                                                 String... types)
        Description copied from interface: ExposesRelationships
        Starts building an incoming relationship starting at the other node.
        Specified by:
        relationshipFrom in interface ExposesRelationships<S extends NodeBase<?>>
        Parameters:
        other - The source of the incoming relationship
        types - The types to match
        Returns:
        An ongoing relationship definition, that can be used to specify the type
      • relationshipBetween

        @NotNull
        public final @NotNull RelationshipChain relationshipBetween​(Node other,
                                                                    String... types)
        Description copied from interface: ExposesRelationships
        Starts building an undirected relationship between this node and the other.
        Specified by:
        relationshipBetween in interface ExposesRelationships<S extends NodeBase<?>>
        Parameters:
        other - The other end of the relationship
        types - The types to match
        Returns:
        An ongoing relationship definition, that can be used to specify the type
      • asCondition

        @NotNull
        public final @NotNull Condition asCondition()
        Description copied from interface: RelationshipPattern
        Transform this pattern into a condition. All names of the patterns must be known upfront in the final statement, as PatternExpressions are not allowed to introduce new variables.
        Specified by:
        asCondition in interface RelationshipPattern
        Returns:
        A condition based on this pattern.
      • accept

        public final void accept​(Visitor visitor)
        Description copied from interface: Visitable
        Accept a Visitor visiting this Visitable and its nested Visitables if applicable.
        Specified by:
        accept in interface Visitable
        Parameters:
        visitor - the visitor to notify, must not be null.
      • property

        @NotNull
        public final @NotNull Property property​(@NotNull
                                                @NotNull String name)
        Description copied from interface: PropertyContainer
        Creates a new Property associated with this property container. This property can be used as a lookup in other expressions. It does not add a value to the property.

        Note: The property container does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.

        Specified by:
        property in interface PropertyContainer
        Parameters:
        name - property name, must not be null or empty.
        Returns:
        a new Property associated with this named container
      • property

        @NotNull
        public final @NotNull Property property​(Expression lookup)
        Description copied from interface: PropertyContainer
        Creates a new Property associated with this property container. This property can be used as a lookup in other expressions. It does not add a value to the property.

        The new Property object is a dynamic lookup, based on the expression passed to this method. The expression can be example another property, a function result or a Cypher parameter. A property defined in such a way will render as p[expression].

        Note: The property container does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.

        Specified by:
        property in interface PropertyContainer
        Parameters:
        lookup - the expression that is evaluated to lookup this property.
        Returns:
        a new Property associated with this named container
      • mutate

        @NotNull
        public final @NotNull Operation mutate​(Parameter<?> parameter)
        Description copied from interface: PropertyContainer
        Creates an Operation mutating the properties of this container to a new value. The container does not track the operations created with this method.
        Specified by:
        mutate in interface PropertyContainer
        Parameters:
        parameter - the new properties
        Returns:
        A new operation.
      • mutate

        @NotNull
        public final @NotNull Operation mutate​(MapExpression properties)
        Description copied from interface: PropertyContainer
        Creates an Operation mutating the properties of this container to a new value. The container does not track the operations created with this method.
        Specified by:
        mutate in interface PropertyContainer
        Parameters:
        properties - the new properties
        Returns:
        A new operation.
      • set

        @NotNull
        public final @NotNull Operation set​(Parameter<?> parameter)
        Description copied from interface: PropertyContainer
        Creates an SET operation setting the properties of this container to a new value. The container does not track the operations created with this method.
        Specified by:
        set in interface PropertyContainer
        Parameters:
        parameter - the new properties
        Returns:
        A new operation.
      • set

        @NotNull
        public final @NotNull Operation set​(MapExpression properties)
        Description copied from interface: PropertyContainer
        Creates an SET operation setting the properties of this container to a new value. The container does not track the operations created with this method.
        Specified by:
        set in interface PropertyContainer
        Parameters:
        properties - the new properties
        Returns:
        A new operation.