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 TypeMethodDescriptionvoidTransform this pattern into a condition.Changes the length of the last element of this chain.Changes the length of the last element of this chain to a new maximum length.Changes the length of the last element of this chain to a new minimum length.Replaces the last element of this chains with a copy of the relationship with the new symbolic name.named(SymbolicName newSymbolicName) Replaces the last element of this chains with a copy of the relationship with the new symbolic name.properties(Object... keysAndValues) Adds properties to the last element of this chain.properties(MapExpression newProperties) Adds properties to the last element of this chain.quantify(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the pattern.quantifyRelationship(QuantifiedPathPattern.Quantifier quantifier) Quantifies the relationship.relationshipBetween(Node other, String... types) Starts building an undirected relationship between thisnodeand theother.relationshipFrom(Node other, String... types) Starts building an incoming relationship starting at theothernode.relationshipTo(Node other, String... types) Starts building an outgoing relationship to theothernode.toString()Mostvisitableswill render themselves into a Cypher fragment preceded with the actual classname.Changes the length of the last element of this chain to an unbounded pattern.where(Expression predicate) Creates a newPatternElementwhich including an additional filter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.neo4j.cypherdsl.core.ExposesRelationships
relationshipWith
-
Method Details
-
relationshipTo
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
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
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
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
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
-
where
Description copied from interface:PatternElementCreates a newPatternElementwhich including an additional filter. Returnsthispattern. whenpredicateis literalnull.The pattern might be a
node patternor arelationship pattern.A
WHEREon a pattern is only supported from Neo4j 5.0 onwards.- Specified by:
wherein 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
Description copied from interface:RelationshipPatternQuantifies the relationship.- Specified by:
quantifyRelationshipin interfaceRelationshipPattern- Parameters:
quantifier- the quantifier to use- Returns:
- a quantified relationship
-
quantify
Description copied from interface:RelationshipPatternQuantifies the pattern.- Specified by:
quantifyin 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:
unboundedin 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:
minin 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:
maxin interfaceExposesPatternLengthAccessors<RelationshipChain>- Parameters:
maximum- the new maximum- Returns:
- a new chain
-
length
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
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 alternatingStringandExpression.- Returns:
- a new chain
-
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.
-
accept
Description copied from interface:Visitable -
toString
Description copied from interface:VisitableMostvisitableswill 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. UsingtoStringis 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.
-