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,PropertyAccessor,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
ConstructorsModifierConstructorDescriptionprotectedRelationshipBase(SymbolicName symbolicName, String type, Node start, Properties properties, Node end) Always creates a relationship from start to end (left to right).protectedRelationshipBase(SymbolicName symbolicName, Node start, String type, Properties properties, Node end, String... additionalTypes) Always creates a relationship from start to end (left to right).protectedRelationshipBase(S start, String type, E end, String... additionalTypes) Always creates a relationship from start to end (left to right). -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal @NotNull ConditionTransform this pattern into a condition.final @NotNull Relationship.DetailsThe details containing the types, properties and cardinality.final @NotNull NodegetLeft()Returns the quantifier of this relationship if any.final @NotNull SymbolicNamefinal @NotNull NodegetRight()final @NotNull Optional<SymbolicName>final @NotNull Relationshipinverse()Creates a new relationship, inverting the direction but keeping the semantics intact ((a) --> (b)becomes(b) <-- (a)).final @NotNull RelationshipCreates a new relationship pattern with a new lengthfinal @NotNull RelationshipCreates a new relationship pattern with a new maximum lengthfinal @NotNull RelationshipCreates a new relationship pattern with a new minimum lengthfinal @NotNull Operationmutate(MapExpression properties) Creates anOperationmutating the properties of this container to a new value.final @NotNull OperationCreates anOperationmutating the properties of this container to a new value.final SELFCreates a copy of this relationship with a new symbolic name.abstract SELFnamed(SymbolicName newSymbolicName) This method needs to be implemented to provide new, type safe instances of this relationship.final @NotNull MapProjectionCreates a map projection based on this container.final @NotNull MapProjectionUnwraps the list of entries into an array before creating a projection out of it.final @NotNull PropertyCreates a newPropertyassociated with this element.final @NotNull Propertyproperty(@NotNull Expression lookup) Creates a newPropertyassociated with this element.final @NotNull Property@NotNull QuantifiedPathPatternquantify(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the pattern.@NotNull RelationshipPatternquantifyRelationship(QuantifiedPathPattern.Quantifier newQuantifier) Quantifies the relationship.final @NotNull RelationshipChainrelationshipBetween(Node other, String... types) Starts building an undirected relationship between thisnodeand theother.final @NotNull RelationshipChainrelationshipFrom(Node other, String... types) Starts building an incoming relationship starting at theothernode.final @NotNull RelationshipChainrelationshipTo(Node other, String... types) Starts building an outgoing relationship to theothernode.final @NotNull Operationset(MapExpression properties) Creates anSET operationsetting the properties of this container to a new value.final @NotNull OperationCreates anSET operationsetting the properties of this container to a new value.toString()Mostvisitableswill render themselves into a Cypher fragment preceded with the actual classname.final @NotNull RelationshipCreates a new relationship pattern with an unbound length minimum length@NotNull Relationshipwhere(@Nullable Expression predicate) Creates a newPatternElementwhich including an additional filter.final SELFwithProperties(Object... keysAndValues) Creates a copy of this property container with additional properties.final SELFwithProperties(Map<String, Object> newProperties) Creates a copy of this property container with additional properties.abstract SELFwithProperties(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, waitMethods inherited from interface org.neo4j.cypherdsl.core.ExposesRelationships
relationshipWithMethods inherited from interface org.neo4j.cypherdsl.core.Named
asExpressionMethods inherited from interface org.neo4j.cypherdsl.core.PropertyAccessor
property, property, property
-
Constructor Details
-
RelationshipBase
Always creates a relationship from start to end (left to right).- Parameters:
start- start nodeend- end nodetype- type of the relationshipadditionalTypes- 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 nodeproperties- The properties for the relationshipend- end nodetype- type of the relationshipadditionalTypes- 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 namestart- start nodeproperties- The properties for the relationshipend- end nodetype- type of the relationship
-
-
Method Details
-
named
Description copied from interface:RelationshipCreates a copy of this relationship with a new symbolic name.- Specified by:
namedin interfaceRelationship- Specified by:
namedin 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:
namedin interfaceRelationship- Specified by:
namedin interfaceRelationshipPattern- Parameters:
newSymbolicName- the new symbolic name.- Returns:
- A new relationship
-
withProperties
Description copied from interface:ExposesPropertiesCreates 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:
withPropertiesin interfaceExposesProperties<S extends NodeBase<?>>- Parameters:
keysAndValues- A list of key and values. Must be an even number, with alternatingStringandExpression.- Returns:
- The new property container.
-
withProperties
Description copied from interface:ExposesPropertiesCreates a copy of this property container with additional properties.- Specified by:
withPropertiesin 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:
withPropertiesin interfaceExposesProperties<S extends NodeBase<?>>- Parameters:
newProperties- the new properties (can be null to remove exiting properties).- Returns:
- A new relationship
-
getLeft
- Specified by:
getLeftin interfaceRelationship- Returns:
- the left-hand side of this relationship
-
getRight
- Specified by:
getRightin interfaceRelationship- Returns:
- the right-hand side of this relationship
-
getQuantifier
Description copied from interface:RelationshipReturns the quantifier of this relationship if any.- Specified by:
getQuantifierin interfaceRelationship- Returns:
- the quantifier of this relationship if any
-
getDetails
Description copied from interface:RelationshipThe details containing the types, properties and cardinality.- Specified by:
getDetailsin interfaceRelationship- Returns:
- A wrapper around the details of this relationship.
-
unbounded
Description copied from interface:ExposesPatternLengthAccessorsCreates a new relationship pattern with an unbound length minimum length- Specified by:
unboundedin interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>- Returns:
- the new relationship
-
min
Description copied from interface:ExposesPatternLengthAccessorsCreates a new relationship pattern with a new minimum length- Specified by:
minin interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>- Parameters:
minimum- the new minimum- Returns:
- the new relationship
-
max
Description copied from interface:ExposesPatternLengthAccessorsCreates a new relationship pattern with a new maximum length- Specified by:
maxin interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>- Parameters:
maximum- the new maximum- Returns:
- the new relationship
-
length
Description copied from interface:ExposesPatternLengthAccessorsCreates a new relationship pattern with a new length- Specified by:
lengthin interfaceExposesPatternLengthAccessors<S extends NodeBase<?>>- Parameters:
minimum- the new minimummaximum- the new maximum- Returns:
- the new relationship
-
inverse
Description copied from interface:RelationshipCreates 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:
inversein interfaceRelationship- Returns:
- the new relationship
-
getSymbolicName
- Specified by:
getSymbolicNamein interfaceNamed- Returns:
- An optional symbolic name.
-
getRequiredSymbolicName
- Specified by:
getRequiredSymbolicNamein interfaceNamed- Returns:
- A symbolic name
-
relationshipTo
Description copied from interface:ExposesRelationshipsStarts building an outgoing relationship to theothernode.- Specified by:
relationshipToin 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:ExposesRelationshipsStarts building an incoming relationship starting at theothernode.- Specified by:
relationshipFromin 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:ExposesRelationshipsStarts building an undirected relationship between thisnodeand theother.- Specified by:
relationshipBetweenin 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: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.
-
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
@NotNull public @NotNull RelationshipPattern quantifyRelationship(@Nullable QuantifiedPathPattern.Quantifier newQuantifier) Description copied from interface:RelationshipPatternQuantifies the relationship.- Specified by:
quantifyRelationshipin 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:RelationshipPatternQuantifies the pattern.- Specified by:
quantifyin interfaceRelationshipPattern- Parameters:
newQuantifier- the quantifier to use- Returns:
- a quantified path pattern
-
property
Description copied from interface:PropertyAccessorCreates a newPropertyassociated with this element. This property can be used as a lookup in other expressions. It does not add a value to the property.Note: The element does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.
- Specified by:
propertyin interfacePropertyAccessor- Parameters:
name- property name, must not be null or empty.- Returns:
- a new
Propertyassociated with this element
-
property
- Specified by:
propertyin interfacePropertyAccessor- Parameters:
names- a list of nested property names- Returns:
- a new
Propertyassociated with this element - See Also:
-
property
Description copied from interface:PropertyAccessorCreates a newPropertyassociated with this element. This property can be used as a lookup in other expressions. It does not add a value to the property.The new
Propertyobject is a dynamic lookup, based on theexpressionpassed 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 element does not track property creation and there is no possibility to enumerate all properties that have been created for this property container.
- Specified by:
propertyin interfacePropertyAccessor- Parameters:
lookup- the expression that is evaluated to lookup this property.- Returns:
- a new
Propertyassociated with this element
-
mutate
Description copied from interface:PropertyContainerCreates anOperationmutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutatein interfacePropertyContainer- Parameters:
parameter- the new properties- Returns:
- A new operation.
-
mutate
Description copied from interface:PropertyContainerCreates anOperationmutating the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
mutatein interfacePropertyContainer- Parameters:
properties- the new properties- Returns:
- A new operation.
-
set
Description copied from interface:PropertyContainerCreates anSET operationsetting the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
setin interfacePropertyContainer- Parameters:
parameter- the new properties- Returns:
- A new operation.
-
set
Description copied from interface:PropertyContainerCreates anSET operationsetting the properties of this container to a new value. The container does not track the operations created with this method.- Specified by:
setin interfacePropertyContainer- Parameters:
properties- the new properties- Returns:
- A new operation.
-
project
Description copied from interface:PropertyContainerUnwraps the list of entries into an array before creating a projection out of it.- Specified by:
projectin interfacePropertyContainer- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
- See Also:
-
project
Description copied from interface:PropertyContainerCreates a map projection based on this container. The container needs a symbolic name for this to work.- Specified by:
projectin interfacePropertyContainer- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
- See Also:
-