Class RelationshipBase<S extends NodeBase<?>,E extends NodeBase<?>,SELF extends RelationshipBase<S,E,SELF>>
- Type Parameters:
S
- The type at the start of the relationshipE
- The type at the pointy end of the relationshipSELF
- The type of the persistent relationship itself
- All Implemented Interfaces:
Visitable
,ExposesPatternLengthAccessors<Relationship>
,ExposesProperties<Relationship>
,ExposesRelationships<RelationshipChain>
,IdentifiableElement
,Named
,PatternElement
,PropertyContainer
,Relationship
,RelationshipPattern
- Since:
- 2021.1.0
- Author:
- Michael J. Simons
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.neo4j.cypherdsl.core.Relationship
Relationship.Details, Relationship.Direction
-
Constructor Summary
ModifierConstructorDescriptionprotected
RelationshipBase
(SymbolicName symbolicName, String type, Node start, Properties properties, Node end) Always creates a relationship from start to end (left to right).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).protected
RelationshipBase
(S start, String type, E end, String... additionalTypes) Always creates a relationship from start to end (left to right). -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final @NotNull Condition
Transform this pattern into a condition.final @NotNull Relationship.Details
The details containing the types, properties and cardinality.final @NotNull Node
getLeft()
Returns the quantifier of this relationship if any.final @NotNull SymbolicName
final @NotNull Node
getRight()
final @NotNull Optional
<SymbolicName> final @NotNull Relationship
inverse()
Creates a new relationship, inverting the direction but keeping the semantics intact ((a) --> (b)
becomes(b) <-- (a)
).final @NotNull Relationship
Creates a new relationship pattern with a new lengthfinal @NotNull Relationship
Creates a new relationship pattern with a new maximum lengthfinal @NotNull Relationship
Creates a new relationship pattern with a new minimum lengthfinal @NotNull Operation
mutate
(MapExpression properties) Creates anOperation
mutating the properties of this container to a new value.final @NotNull Operation
Creates anOperation
mutating the properties of this container to a new value.final SELF
Creates a copy of this relationship with a new symbolic name.abstract SELF
named
(SymbolicName newSymbolicName) This method needs to be implemented to provide new, type safe instances of this relationship.final @NotNull MapProjection
Creates a map projection based on this container.final @NotNull MapProjection
Unwraps the list of entries into an array before creating a projection out of it.final @NotNull Property
Creates a newProperty
associated with this property container.final @NotNull Property
final @NotNull Property
property
(Expression lookup) Creates a newProperty
associated with this property container.@NotNull QuantifiedPathPattern
quantify
(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the pattern.@NotNull RelationshipPattern
quantifyRelationship
(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the relationship.final @NotNull RelationshipChain
relationshipBetween
(Node other, String... types) Starts building an undirected relationship between thisnode
and theother
.final @NotNull RelationshipChain
relationshipFrom
(Node other, String... types) Starts building an incoming relationship starting at theother
node
.final @NotNull RelationshipChain
relationshipTo
(Node other, String... types) Starts building an outgoing relationship to theother
node
.final @NotNull Operation
set
(MapExpression properties) Creates anSET operation
setting the properties of this container to a new value.final @NotNull Operation
Creates anSET operation
setting the properties of this container to a new value.toString()
Mostvisitables
will render themselves into a Cypher fragment preceded with the actual classname.final @NotNull Relationship
Creates a new relationship pattern with an unbound length minimum length@NotNull Relationship
where
(@Nullable Expression predicate) Creates a newPatternElement
which including an additional filter.final SELF
withProperties
(Object... keysAndValues) Creates a copy of this property container with additional properties.final SELF
withProperties
(Map<String, Object> newProperties) Creates a copy of this property container with additional properties.abstract SELF
withProperties
(MapExpression newProperties) This method needs to be implemented to provide new, type safe instances of this relationship.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.neo4j.cypherdsl.core.ExposesRelationships
relationshipWith
Methods inherited from interface org.neo4j.cypherdsl.core.Named
asExpression
-
Constructor Details
-
RelationshipBase
Always creates a relationship from start to end (left to right).- Parameters:
start
- start nodetype
- type of the relationshipend
- end nodeadditionalTypes
- 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 namestart
- start nodetype
- type of the relationshipproperties
- The properties for the relationshipend
- end nodeadditionalTypes
- 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.
-
RelationshipBase
protected RelationshipBase(SymbolicName symbolicName, String type, Node start, Properties properties, Node end) Always creates a relationship from start to end (left to right).- Parameters:
symbolicName
- an optional symbolic nametype
- type of the relationshipstart
- start nodeproperties
- The properties for the relationshipend
- end node
-
-
Method Details
-
named
Description copied from interface:Relationship
Creates a copy of this relationship with a new symbolic name.- Specified by:
named
in interfaceRelationship
- Specified by:
named
in interfaceRelationshipPattern
- Parameters:
newSymbolicName
- the new symbolic name.- Returns:
- The new relationship.
-
named
This method needs to be implemented to provide new, type safe instances of this relationship.- Specified by:
named
in interfaceRelationship
- Specified by:
named
in interfaceRelationshipPattern
- Parameters:
newSymbolicName
- the new symbolic name.- Returns:
- A new relationship
-
withProperties
Description copied from interface:ExposesProperties
Creates 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 interfaceExposesProperties<S extends NodeBase<?>>
- Parameters:
keysAndValues
- A list of key and values. Must be an even number, with alternatingString
andExpression
.- Returns:
- The new property container.
-
withProperties
Description copied from interface:ExposesProperties
Creates a copy of this property container with additional properties.- Specified by:
withProperties
in interfaceExposesProperties<S extends NodeBase<?>>
- Parameters:
newProperties
- A map with the new properties- Returns:
- The new property container.
-
withProperties
This method needs to be implemented to provide new, type safe instances of this relationship.- Specified by:
withProperties
in interfaceExposesProperties<S extends NodeBase<?>>
- Parameters:
newProperties
- the new properties (can be null to remove exiting properties).- Returns:
- A new relationship
-
getLeft
- Specified by:
getLeft
in interfaceRelationship
- Returns:
- the left-hand side of this relationship
-
getRight
- Specified by:
getRight
in interfaceRelationship
- Returns:
- the right-hand side of this relationship
-
getQuantifier
Description copied from interface:Relationship
Returns the quantifier of this relationship if any.- Specified by:
getQuantifier
in interfaceRelationship
- Returns:
- the quantifier of this relationship if any
-
getDetails
Description copied from interface:Relationship
The details containing the types, properties and cardinality.- Specified by:
getDetails
in interfaceRelationship
- Returns:
- A wrapper around the details of this relationship.
-
unbounded
Description copied from interface:ExposesPatternLengthAccessors
Creates a new relationship pattern with an unbound length minimum length- Specified by:
unbounded
in interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>
- Returns:
- the new relationship
-
min
Description copied from interface:ExposesPatternLengthAccessors
Creates a new relationship pattern with a new minimum length- Specified by:
min
in interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>
- Parameters:
minimum
- the new minimum- Returns:
- the new relationship
-
max
Description copied from interface:ExposesPatternLengthAccessors
Creates a new relationship pattern with a new maximum length- Specified by:
max
in interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>
- Parameters:
maximum
- the new maximum- Returns:
- the new relationship
-
length
Description copied from interface:ExposesPatternLengthAccessors
Creates a new relationship pattern with a new length- Specified by:
length
in interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>
- Parameters:
minimum
- the new minimummaximum
- the new maximum- Returns:
- the new 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 interfaceRelationship
- Returns:
- the new relationship
-
getSymbolicName
- Specified by:
getSymbolicName
in interfaceNamed
- Returns:
- An optional symbolic name.
-
getRequiredSymbolicName
- Specified by:
getRequiredSymbolicName
in interfaceNamed
- Returns:
- A symbolic name
-
relationshipTo
Description copied from interface:ExposesRelationships
Starts building an outgoing relationship to theother
node
.- Specified by:
relationshipTo
in interfaceExposesRelationships<S extends NodeBase<?>>
- Parameters:
other
- The other end of the outgoing relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
relationshipFrom
Description copied from interface:ExposesRelationships
Starts building an incoming relationship starting at theother
node
.- Specified by:
relationshipFrom
in interfaceExposesRelationships<S extends NodeBase<?>>
- Parameters:
other
- The source of the incoming relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
relationshipBetween
Description copied from interface:ExposesRelationships
Starts building an undirected relationship between thisnode
and theother
.- Specified by:
relationshipBetween
in interfaceExposesRelationships<S extends NodeBase<?>>
- Parameters:
other
- The other end of the relationshiptypes
- The types to match- Returns:
- An ongoing relationship definition, that can be used to specify the type
-
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 interfaceRelationshipPattern
- Returns:
- A condition based on this pattern.
-
accept
Description copied from interface:Visitable
-
toString
Description copied from interface:Visitable
Mostvisitables
will render themselves into a Cypher fragment preceded with the actual classname. The representation however is not cached - in contrast to the ones for full statements. UsingtoString
is recommended for debugging purposes mainly, and not for production use.The concrete classname has been prepended to help debugging and actually to discourage using fragments to build queries without explicitly rendering them, either as statement or going through the renderer on purpose.
-
where
Description copied from interface:PatternElement
Creates a newPatternElement
which including an additional filter. Returnsthis
pattern. whenpredicate
is literalnull
.The pattern might be a
node pattern
or arelationship pattern
.A
WHERE
on a pattern is only supported from Neo4j 5.0 onwards.- Specified by:
where
in interfacePatternElement
- Parameters:
predicate
- the predicate to filter on- Returns:
- a new pattern element or this instance if the predicate to this method was literal
null
-
quantifyRelationship
@NotNull public @NotNull RelationshipPattern quantifyRelationship(@Nullable QuantifiedPathPattern.Quantifier newQuantifier) Description copied from interface:RelationshipPattern
Quantifies the relationship.- Specified by:
quantifyRelationship
in interfaceRelationshipPattern
- Parameters:
newQuantifier
- the quantifier to use- Returns:
- a quantified relationship
-
quantify
@NotNull public @NotNull QuantifiedPathPattern quantify(@Nullable QuantifiedPathPattern.Quantifier newQuantifier) Description copied from interface:RelationshipPattern
Quantifies the pattern.- Specified by:
quantify
in interfaceRelationshipPattern
- Parameters:
newQuantifier
- the quantifier to use- Returns:
- a quantified path pattern
-
property
Description copied from interface:PropertyContainer
Creates a newProperty
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 interfacePropertyContainer
- Parameters:
name
- property name, must not be null or empty.- Returns:
- a new
Property
associated with this named container
-
property
- Specified by:
property
in interfacePropertyContainer
- Parameters:
names
- a list of nested property names- Returns:
- a new
Property
associated with this named container - See Also:
-
property
Description copied from interface:PropertyContainer
Creates a newProperty
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 theexpression
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 asp[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 interfacePropertyContainer
- Parameters:
lookup
- the expression that is evaluated to lookup this property.- Returns:
- a new
Property
associated with this named container
-
mutate
Description copied from interface:PropertyContainer
Creates anOperation
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 interfacePropertyContainer
- Parameters:
parameter
- the new properties- Returns:
- A new operation.
-
mutate
Description copied from interface:PropertyContainer
Creates anOperation
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 interfacePropertyContainer
- Parameters:
properties
- the new properties- Returns:
- A new operation.
-
set
Description copied from interface:PropertyContainer
Creates anSET 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 interfacePropertyContainer
- Parameters:
parameter
- the new properties- Returns:
- A new operation.
-
set
Description copied from interface:PropertyContainer
Creates anSET 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 interfacePropertyContainer
- Parameters:
properties
- the new properties- Returns:
- A new operation.
-
project
Description copied from interface:PropertyContainer
Unwraps the list of entries into an array before creating a projection out of it.- Specified by:
project
in interfacePropertyContainer
- Parameters:
entries
- A list of entries for the projection- Returns:
- A map projection.
- See Also:
-
project
Description copied from interface:PropertyContainer
Creates a map projection based on this container. The container needs a symbolic name for this to work.- Specified by:
project
in interfacePropertyContainer
- Parameters:
entries
- A list of entries for the projection- Returns:
- A map projection.
- See Also:
-