Package org.neo4j.cypherdsl.core
Class Node
- java.lang.Object
-
- org.neo4j.cypherdsl.core.Node
-
- All Implemented Interfaces:
ExposesProperties<Node>,ExposesRelationships<Relationship>,Named,PatternElement,PropertyContainer,Visitable
@API(status=EXPERIMENTAL, since="1.0") public final class Node extends java.lang.Object implements PatternElement, PropertyContainer, ExposesRelationships<Relationship>, ExposesProperties<Node>See NodePattern.- Since:
- 1.0
- Author:
- Michael J. Simons
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)AliasedExpressionas(java.lang.String alias)SortItemascending()SortItemdescending()SymbolicNamegetRequiredSymbolicName()java.util.Optional<SymbolicName>getSymbolicName()ConditionhasLabels(java.lang.String... labelsToQuery)A condition that checks for the presence of labels on a node.FunctionInvocationinternalId()ConditionisEqualTo(Node otherNode)ConditionisNotEqualTo(Node otherNode)ConditionisNotNull()ConditionisNull()FunctionInvocationlabels()Nodenamed(java.lang.String newSymbolicName)Creates a copy of this node with a new symbolic name.Nodenamed(SymbolicName newSymbolicName)Creates a copy of this node with a new symbolic name.MapProjectionproject(java.lang.Object... entries)Creates a map projection based on this node.MapProjectionproject(java.util.List<java.lang.Object> entries)A list will never be a valid entry for a map projection, so this convenient method prevents trying to create one from a list of objects.Propertyproperty(java.lang.String name)Creates a newPropertyassociated with this property container.RelationshiprelationshipBetween(Node other, java.lang.String... types)Starts building an undirected relationship between thisnodeand theother.RelationshiprelationshipFrom(Node other, java.lang.String... types)Starts building an incoming relationship starting at theothernode.RelationshiprelationshipTo(Node other, java.lang.String... types)Starts building an outgoing relationship to theothernode.java.lang.StringtoString()NodewithProperties(java.lang.Object... keysAndValues)Creates a a copy of this property container with additional properties.NodewithProperties(MapExpression newProperties)Creates a a copy of this property container with additional properties.
-
-
-
Method Detail
-
named
public Node named(java.lang.String newSymbolicName)
Creates a copy of this node with a new symbolic name.- Parameters:
newSymbolicName- the new symbolic name.- Returns:
- The new node.
-
named
public Node named(SymbolicName newSymbolicName)
Creates a copy of this node with a new symbolic name.- Parameters:
newSymbolicName- the new symbolic name.- Returns:
- The new node.
-
withProperties
public Node 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<Node>- Parameters:
newProperties- the new properties (can be null to remove exiting properties).- Returns:
- The new property container.
-
withProperties
public Node 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<Node>- 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.
-
project
public MapProjection project(java.util.List<java.lang.Object> entries)
A list will never be a valid entry for a map projection, so this convenient method prevents trying to create one from a list of objects. It will delegate toproject(Object...)with the content of the list.- Parameters:
entries- A list of entries for the projection- Returns:
- A map projection.
-
project
public MapProjection project(java.lang.Object... entries)
Creates a map projection based on this node. The node 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.
-
getSymbolicName
public java.util.Optional<SymbolicName> getSymbolicName()
- Specified by:
getSymbolicNamein interfaceNamed- Returns:
- The optional symbolic name of this node.
-
getRequiredSymbolicName
public SymbolicName getRequiredSymbolicName()
- Specified by:
getRequiredSymbolicNamein interfaceNamed
-
internalId
public FunctionInvocation internalId()
-
labels
public FunctionInvocation labels()
-
relationshipTo
public Relationship relationshipTo(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationshipsStarts building an outgoing relationship to theothernode.- Specified by:
relationshipToin interfaceExposesRelationships<Relationship>- 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 Relationship relationshipFrom(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationshipsStarts building an incoming relationship starting at theothernode.- Specified by:
relationshipFromin interfaceExposesRelationships<Relationship>- 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 Relationship relationshipBetween(Node other, java.lang.String... types)
Description copied from interface:ExposesRelationshipsStarts building an undirected relationship between thisnodeand theother.- Specified by:
relationshipBetweenin interfaceExposesRelationships<Relationship>- 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
-
hasLabels
public Condition hasLabels(java.lang.String... labelsToQuery)
A condition that checks for the presence of labels on a node.- Parameters:
labelsToQuery- A list of labels to query- Returns:
- A condition that checks whether this node has all of the labels to query
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isNull
public Condition isNull()
-
isNotNull
public Condition isNotNull()
-
descending
public SortItem descending()
-
ascending
public SortItem ascending()
-
as
public AliasedExpression as(java.lang.String alias)
-
-