java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.graph.internal.JoinPath
Record Components:
edges - the relationship edges on this path, in a deterministic order; empty for a single-relation (no-join) path
relations - every relation this path touches, deduplicated by graph key in first-appearance order; never empty

public record JoinPath(List<Relationship> edges, List<RelationSymbol> relations) extends Record
One connected join path through the SchemaGraph: an ordered set of Relationship edges spanning a set of terminal relations, plus the relations those edges touch.

A path is the output of SchemaGraphSearch: the minimal connected subgraph (Steiner tree) that ties the query's terminals together. Its edges() carry everything mechanical join assembly needs — the join columns (positional, composite keys intact) and the multiplicity bounds — and its relationshipNames() are the vocabulary relix-ask uses to phrase a "did you mean?" when the search returns more than one path.

The degenerate path is a single terminal with no edges (a query that names columns from one relation): edges() empty, relations() the lone relation.

  • Constructor Details

    • JoinPath

      public JoinPath(List<Relationship> edges, List<RelationSymbol> relations)
      Creates an instance of a JoinPath record class.
      Parameters:
      edges - the value for the edges record component
      relations - the value for the relations record component
  • Method Details

    • tableCount

      public int tableCount()
      The number of relations (tables) this path joins — the resultant relation's breadth.
    • trivial

      public boolean trivial()
      True if this path joins nothing — a single relation, no edges.
    • relationshipNames

      public List<String> relationshipNames()
      The names of the relationships traversed, in edge order — the speakable vocabulary for a "did you mean?" when the search is ambiguous (answerable only because edges are named).
    • relationKeys

      public Set<String> relationKeys()
      The graph keys of every relation on this path, in first-appearance order.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • edges

      public List<Relationship> edges()
      Returns the value of the edges record component.
      Returns:
      the value of the edges record component
    • relations

      public List<RelationSymbol> relations()
      Returns the value of the relations record component.
      Returns:
      the value of the relations record component