Package org.neo4j.cypherdsl.core
Class Relationship
- java.lang.Object
-
- org.neo4j.cypherdsl.core.Relationship
-
- All Implemented Interfaces:
ExposesProperties<Relationship>,ExposesRelationships<RelationshipChain>,Named,PatternElement,PropertyContainer,RelationshipPattern,Visitable
@API(status=EXPERIMENTAL, since="1.0") public final class Relationship extends java.lang.Object implements RelationshipPattern, PropertyContainer, ExposesProperties<Relationship>See RelationshipPattern.- Since:
- 1.0
- Author:
- Michael J. Simons, Philipp Tölle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRelationship.DetailsSee RelationshipDetail.static classRelationship.DirectionWhile the direction in the schema package is centered around the node, the direction here is the direction between two nodes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Relationship.DetailsgetDetails()SymbolicNamegetRequiredSymbolicName()java.util.Optional<SymbolicName>getSymbolicName()Relationshiplength(java.lang.Integer minimum, java.lang.Integer maximum)Creates a new relationship with a new lengthRelationshipmax(java.lang.Integer maximum)Creates a new relationship with a new maximum lengthRelationshipmin(java.lang.Integer minimum)Creates a new relationship with a new minimum lengthRelationshipnamed(java.lang.String newSymbolicName)Creates a copy of this relationship with a new symbolic name.Relationshipnamed(SymbolicName newSymbolicName)Creates a copy of this relationship with a new symbolic name.MapProjectionproject(java.lang.Object... entries)Creates a map projection based on this relationship.Propertyproperty(java.lang.String name)Creates a newPropertyassociated with this property container.RelationshipChainrelationshipBetween(Node other, java.lang.String... types)Starts building an undirected relationship between thisnodeand theother.RelationshipChainrelationshipFrom(Node other, java.lang.String... types)Starts building an incoming relationship starting at theothernode.RelationshipChainrelationshipTo(Node other, java.lang.String... types)Starts building an outgoing relationship to theothernode.Relationshipunbounded()Creates a new relationship with an unbound length minimum lengthRelationshipwithProperties(java.lang.Object... keysAndValues)Creates a a copy of this property container with additional properties.RelationshipwithProperties(MapExpression newProperties)Creates a a copy of this property container with additional properties.
-
-
-
Method Detail
-
getDetails
public Relationship.Details getDetails()
-
named
public Relationship named(java.lang.String newSymbolicName)
Creates a copy of this relationship with a new symbolic name.- Specified by:
namedin interfaceRelationshipPattern- Parameters:
newSymbolicName- the new symbolic name.- Returns:
- The new relationship.
-
named
public Relationship named(SymbolicName newSymbolicName)
Creates a copy of this relationship with a new symbolic name.- Parameters:
newSymbolicName- the new symbolic name.- Returns:
- The new relationship.
-
unbounded
public Relationship unbounded()
Creates a new relationship with an unbound length minimum length- Returns:
- the new relationship
- Since:
- 1.1.1
-
min
public Relationship min(java.lang.Integer minimum)
Creates a new relationship with a new minimum length- Parameters:
minimum- the new minimum- Returns:
- the new relationship
-
max
public Relationship max(java.lang.Integer maximum)
Creates a new relationship with a new maximum length- Parameters:
maximum- the new maximum- Returns:
- the new relationship
-
length
public Relationship length(java.lang.Integer minimum, java.lang.Integer maximum)
Creates a new relationship with a new length- Parameters:
minimum- the new minimummaximum- the new maximum- Returns:
- the new relationship
-
withProperties
public Relationship withProperties(MapExpression newProperties)
Description copied from interface:ExposesPropertiesCreates a 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<Relationship>- Parameters:
newProperties- the new properties (can be null to remove exiting properties).- Returns:
- The new property container.
-
withProperties
public Relationship withProperties(java.lang.Object... keysAndValues)
Description copied from interface:ExposesPropertiesCreates a 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<Relationship>- Parameters:
keysAndValues- A list of key and values. Must be an even number, with alternatingStringandExpression.- Returns:
- The new property container.
-
property
public Property property(java.lang.String name)
Description copied from interface:PropertyContainerCreates a newPropertyassociated with this property container. This property can be used as a lookup in other expressions. It does not add a value to the property.Note: The property container 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 interfacePropertyContainer- Parameters:
name- property name, must not be null or empty.- Returns:
- a new
Propertyassociated with thisRelationship.
-
getSymbolicName
public java.util.Optional<SymbolicName> getSymbolicName()
- Specified by:
getSymbolicNamein interfaceNamed
-
getRequiredSymbolicName
public SymbolicName getRequiredSymbolicName()
- Specified by:
getRequiredSymbolicNamein interfaceNamed
-
relationshipTo
public RelationshipChain relationshipTo(Node other, java.lang.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
public RelationshipChain relationshipFrom(Node other, java.lang.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
public RelationshipChain relationshipBetween(Node other, java.lang.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
-
project
public MapProjection project(java.lang.Object... entries)
Creates a map projection based on this relationship. The relationship needs a symbolic name for this to work.Entries of type
Stringinentriesfollowed by anExpressionwill be treated as map keys pointing to the expression in the projection,Stringentries alone will be treated as property lookups on the node.- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
-
-