java.lang.Object
org.neo4j.cypherdsl.core.RelationshipChain
- All Implemented Interfaces:
Visitable
,ExposesPatternLengthAccessors<RelationshipChain>
,ExposesRelationships<RelationshipChain>
,PatternElement
,RelationshipPattern
@API(status=STABLE,
since="1.0")
public final class RelationshipChain
extends Object
implements RelationshipPattern, ExposesPatternLengthAccessors<RelationshipChain>
Represents a chain of relationships. The chain is meant to be in order and the right node of an element is related to
the left node of the next element.
- Since:
- 1.0
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescriptionvoid
@NotNull Condition
Transform this pattern into a condition.@NotNull RelationshipChain
Changes the length of the last element of this chain@NotNull RelationshipChain
Changes the length of the last element of this chain to a new maximum length@NotNull RelationshipChain
Changes the length of the last element of this chain to a new minimum length@NotNull RelationshipChain
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.@NotNull RelationshipChain
named
(SymbolicName newSymbolicName) Replaces the last element of this chains with a copy of the relationship with the new symbolic name.@NotNull RelationshipChain
properties
(Object... keysAndValues) Adds properties to the last element of this chain.@NotNull RelationshipChain
properties
(MapExpression newProperties) Adds properties to the last element of this chain.@NotNull QuantifiedPathPattern
quantify
(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the pattern.@NotNull RelationshipPattern
quantifyRelationship
(QuantifiedPathPattern.Quantifier quantifier) Quantifies the relationship.@NotNull RelationshipChain
relationshipBetween
(Node other, String... types) Starts building an undirected relationship between thisnode
and theother
.@NotNull RelationshipChain
relationshipFrom
(Node other, String... types) Starts building an incoming relationship starting at theother
node
.@NotNull RelationshipChain
relationshipTo
(Node other, String... types) Starts building an outgoing relationship to theother
node
.toString()
Mostvisitables
will render themselves into a Cypher fragment preceded with the actual classname.@NotNull RelationshipChain
Changes the length of the last element of this chain to an unbounded pattern.@NotNull RelationshipChain
where
(@Nullable Expression predicate) Creates a newPatternElement
which including an additional filter.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
-
Method Details
-
relationshipTo
Description copied from interface:ExposesRelationships
Starts building an outgoing relationship to theother
node
.- Specified by:
relationshipTo
in interfaceExposesRelationships<RelationshipChain>
- 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<RelationshipChain>
- 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<RelationshipChain>
- 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
-
named
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.- Specified by:
named
in interfaceRelationshipPattern
- Parameters:
newSymbolicName
- The new symbolic name to use- Returns:
- A new chain
-
named
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.- Specified by:
named
in interfaceRelationshipPattern
- Parameters:
newSymbolicName
- The new symbolic name to use- Returns:
- A new chain
- Since:
- 2021.1.1
-
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 quantifier) Description copied from interface:RelationshipPattern
Quantifies the relationship.- Specified by:
quantifyRelationship
in interfaceRelationshipPattern
- Parameters:
quantifier
- 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
-
unbounded
Changes the length of the last element of this chain to an unbounded pattern.- Specified by:
unbounded
in interfaceExposesPatternLengthAccessors<RelationshipChain>
- Returns:
- A new chain
- Since:
- 1.1.1
-
min
Changes the length of the last element of this chain to a new minimum length- Specified by:
min
in interfaceExposesPatternLengthAccessors<RelationshipChain>
- Parameters:
minimum
- the new minimum- Returns:
- A new chain
-
max
Changes the length of the last element of this chain to a new maximum length- Specified by:
max
in interfaceExposesPatternLengthAccessors<RelationshipChain>
- Parameters:
maximum
- the new maximum- Returns:
- A new chain
-
length
@NotNull @Contract(pure=true) public @NotNull RelationshipChain length(Integer minimum, Integer maximum) Changes the length of the last element of this chain- Specified by:
length
in interfaceExposesPatternLengthAccessors<RelationshipChain>
- Parameters:
minimum
- the new minimummaximum
- the new maximum- Returns:
- A new chain
-
properties
@NotNull @Contract(pure=true) public @NotNull RelationshipChain properties(MapExpression newProperties) Adds properties to the last element of this chain.- Parameters:
newProperties
- the new properties (can be null to remove exiting properties).- Returns:
- A new chain
-
properties
Adds properties to the last element of this chain.- Parameters:
keysAndValues
- A list of key and values. Must be an even number, with alternatingString
andExpression
.- Returns:
- A new chain
-
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.
-