Record Class RelateStatement

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.RelateStatement
Record Components:
name - the relationship name; must not be blank
inverseName - the optional name of the reverse traversal
symmetric - whether this self-referential relationship is symmetric
source - the source endpoint
target - the target endpoint
location - the source location of the relate keyword
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 Details

    • RelateStatement

      public RelateStatement(String name, Optional<String> inverseName, boolean symmetric, EndpointSpec source, EndpointSpec target, SourceLocation location)
      Creates an instance of a RelateStatement record class.
      Parameters:
      name - the value for the name record component
      inverseName - the value for the inverseName record component
      symmetric - the value for the symmetric record component
      source - the value for the source record component
      target - the value for the target record component
      location - the value for the location record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • inverseName

      public Optional<String> inverseName()
      Returns the value of the inverseName record component.
      Returns:
      the value of the inverseName record component
    • symmetric

      public boolean symmetric()
      Returns the value of the symmetric record component.
      Returns:
      the value of the symmetric record component
    • source

      public EndpointSpec source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • target

      public EndpointSpec target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Specified by:
      location in interface Statement
      Returns:
      the value of the location record component