Package org.neo4j.cypherdsl.core
Class RelationshipChain
- java.lang.Object
-
- org.neo4j.cypherdsl.core.RelationshipChain
-
- All Implemented Interfaces:
Visitable,ExposesPatternLengthAccessors<RelationshipChain>,ExposesRelationships<RelationshipChain>,PatternElement,RelationshipPattern
@API(status=EXPERIMENTAL, 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)@NotNull ConditionasCondition()Transform this pattern into a condition.@NotNull RelationshipChainlength(Integer minimum, Integer maximum)Changes the length of the last element of this chain@NotNull RelationshipChainmax(Integer maximum)Changes the length of the last element of this chain to a new maximum length@NotNull RelationshipChainmin(Integer minimum)Changes the length of the last element of this chain to a new minimum length@NotNull RelationshipChainnamed(String newSymbolicName)Replaces the last element of this chains with a copy of the relationship with the new symbolic name.@NotNull RelationshipChainnamed(SymbolicName newSymbolicName)Replaces the last element of this chains with a copy of the relationship with the new symbolic name.@NotNull RelationshipChainproperties(Object... keysAndValues)Adds properties to the last element of this chain.@NotNull RelationshipChainproperties(MapExpression newProperties)Adds properties to the last element of this chain.@NotNull RelationshipChainrelationshipBetween(Node other, String... types)Starts building an undirected relationship between thisnodeand theother.@NotNull RelationshipChainrelationshipFrom(Node other, String... types)Starts building an incoming relationship starting at theothernode.@NotNull RelationshipChainrelationshipTo(Node other, String... types)Starts building an outgoing relationship to theothernode.@NotNull RelationshipChainunbounded()Changes the length of the last element of this chain to an unbounded pattern.
-
-
-
Method Detail
-
relationshipTo
@NotNull public @NotNull RelationshipChain relationshipTo(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an outgoing relationship to theothernode.- Specified by:
relationshipToin 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
@NotNull public @NotNull RelationshipChain relationshipFrom(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an incoming relationship starting at theothernode.- Specified by:
relationshipFromin 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
@NotNull public @NotNull RelationshipChain relationshipBetween(Node other, String... types)
Description copied from interface:ExposesRelationshipsStarts building an undirected relationship between thisnodeand theother.- Specified by:
relationshipBetweenin 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
@NotNull public @NotNull RelationshipChain named(String newSymbolicName)
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.- Specified by:
namedin interfaceRelationshipPattern- Parameters:
newSymbolicName- The new symbolic name to use- Returns:
- A new chain
-
named
@NotNull public @NotNull RelationshipChain named(SymbolicName newSymbolicName)
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.- Specified by:
namedin interfaceRelationshipPattern- Parameters:
newSymbolicName- The new symbolic name to use- Returns:
- A new chain
- Since:
- 2021.1.1
-
unbounded
@NotNull @Contract(pure=true) public @NotNull RelationshipChain unbounded()
Changes the length of the last element of this chain to an unbounded pattern.- Specified by:
unboundedin interfaceExposesPatternLengthAccessors<RelationshipChain>- Returns:
- A new chain
- Since:
- 1.1.1
-
min
@NotNull @Contract(pure=true) public @NotNull RelationshipChain min(Integer minimum)
Changes the length of the last element of this chain to a new minimum length- Specified by:
minin interfaceExposesPatternLengthAccessors<RelationshipChain>- Parameters:
minimum- the new minimum- Returns:
- A new chain
-
max
@NotNull @Contract(pure=true) public @NotNull RelationshipChain max(Integer maximum)
Changes the length of the last element of this chain to a new maximum length- Specified by:
maxin 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:
lengthin 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
@NotNull @Contract(pure=true) public @NotNull RelationshipChain properties(Object... keysAndValues)
Adds properties to the last element of this chain.- Parameters:
keysAndValues- A list of key and values. Must be an even number, with alternatingStringandExpression.- Returns:
- A new chain
-
asCondition
@NotNull public @NotNull Condition asCondition()
Description copied from interface:RelationshipPatternTransform 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:
asConditionin interfaceRelationshipPattern- Returns:
- A condition based on this pattern.
-
-