Record Class RelateStatement
java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.RelateStatement
- Record Components:
name- the relationship name; must not be blankinverseName- the optional name of the reverse traversalsymmetric- whether this self-referential relationship is symmetricsource- the source endpointtarget- the target endpointlocation- the source location of therelatekeyword
- All Implemented Interfaces:
Statement
public record RelateStatement(String name, Optional<String> inverseName, boolean symmetric, EndpointSpec source, EndpointSpec target, SourceLocation location)
extends Record
implements Statement
A standalone schema relationship declaration:
relate "Order Line Items" Orders.order_id -> OrderItems.order_id [1..50]; relate "Manages" / "Reports To" Employees.id -> Employees.manager_id; relate symmetric "Cross Sells" Products.id -> Products.related_id;
A relate statement declares a named edge of the schema graph
between two endpoints. The name is required; an optional
inverse name (after /) makes the reverse traversal speakable and marks
the two directions as distinct roles. The symmetric modifier is
meaningful only for self-referential edges and is mutually exclusive with an
inverse name — both constraints are validated semantically, not here.
Relationships are structural metadata, not symbols: they declare nothing
nameable and therefore carry no exported flag.
-
Constructor Summary
ConstructorsConstructorDescriptionRelateStatement(String name, Optional<String> inverseName, boolean symmetric, EndpointSpec source, EndpointSpec target, SourceLocation location) Creates an instance of aRelateStatementrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinverseNamerecord component.location()Returns the value of thelocationrecord component.name()Returns the value of thenamerecord component.source()Returns the value of thesourcerecord component.booleanReturns the value of thesymmetricrecord component.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RelateStatement
public RelateStatement(String name, Optional<String> inverseName, boolean symmetric, EndpointSpec source, EndpointSpec target, SourceLocation location) Creates an instance of aRelateStatementrecord class.- Parameters:
name- the value for thenamerecord componentinverseName- the value for theinverseNamerecord componentsymmetric- the value for thesymmetricrecord componentsource- the value for thesourcerecord componenttarget- the value for thetargetrecord componentlocation- the value for thelocationrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
inverseName
Returns the value of theinverseNamerecord component.- Returns:
- the value of the
inverseNamerecord component
-
symmetric
public boolean symmetric()Returns the value of thesymmetricrecord component.- Returns:
- the value of the
symmetricrecord component
-
source
Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
location
Returns the value of thelocationrecord component.
-