Package org.neo4j.cypherdsl.core
Class RelationshipChain
- java.lang.Object
-
- org.neo4j.cypherdsl.core.RelationshipChain
-
- All Implemented Interfaces:
ExposesRelationships<RelationshipChain>
,PatternElement
,RelationshipPattern
,Visitable
@API(status=EXPERIMENTAL, since="1.0") public final class RelationshipChain extends java.lang.Object implements RelationshipPattern
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
-
-
Constructor Summary
Constructors Constructor Description RelationshipChain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
Condition
asCondition()
Transform this pattern into a condition.RelationshipChain
length(java.lang.Integer minimum, java.lang.Integer maximum)
Changes the length of the last element of this chainRelationshipChain
max(java.lang.Integer maximum)
Changes the length of the last element of this chain to a new maximum lengthRelationshipChain
min(java.lang.Integer minimum)
Changes the length of the last element of this chain to a new minimum lengthRelationshipChain
named(java.lang.String newSymbolicName)
Replaces the last element of this chains with a copy of the relationship with the new symbolic name.RelationshipChain
properties(java.lang.Object... keysAndValues)
Adds properties to the last element of this chain.RelationshipChain
properties(MapExpression newProperties)
Adds properties to the last element of this chain.RelationshipChain
relationshipBetween(Node other, java.lang.String... types)
Starts building an undirected relationship between thisnode
and theother
.RelationshipChain
relationshipFrom(Node other, java.lang.String... types)
Starts building an incoming relationship starting at theother
node
.RelationshipChain
relationshipTo(Node other, java.lang.String... types)
Starts building an outgoing relationship to theother
node
.RelationshipChain
unbounded()
Changes the length of the last element of this chain to an unbounded pattern.
-
-
-
Method Detail
-
relationshipTo
public RelationshipChain relationshipTo(Node other, java.lang.String... types)
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
public RelationshipChain relationshipFrom(Node other, java.lang.String... types)
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
public RelationshipChain relationshipBetween(Node other, java.lang.String... types)
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
public RelationshipChain named(java.lang.String newSymbolicName)
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:
- This chain
-
unbounded
public RelationshipChain unbounded()
Changes the length of the last element of this chain to an unbounded pattern.- Returns:
- This chain
- Since:
- 1.1.1
-
min
public RelationshipChain min(java.lang.Integer minimum)
Changes the length of the last element of this chain to a new minimum length- Parameters:
minimum
- the new minimum- Returns:
- This chain
-
max
public RelationshipChain max(java.lang.Integer maximum)
Changes the length of the last element of this chain to a new maximum length- Parameters:
maximum
- the new maximum- Returns:
- This chain
-
length
public RelationshipChain length(java.lang.Integer minimum, java.lang.Integer maximum)
Changes the length of the last element of this chain- Parameters:
minimum
- the new minimummaximum
- the new maximum- Returns:
- This chain
-
properties
public 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:
- This chain
-
properties
public RelationshipChain properties(java.lang.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 alternatingString
andExpression
.- Returns:
- This chain
-
asCondition
public 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 interfaceRelationshipPattern
- Returns:
- A condition based on this pattern.
-
-