Record Class Relationship
- Record Components:
name- the relationship name; never blankinverseName- the optional name of the reverse traversalsymmetric- whether this self-referential relationship is symmetricsource- the source endpointtarget- the target endpoint; its column list has the same length as the source's (validated at assembly with a positioned diagnostic, not here)origin- how this edge entered the graph
SchemaGraph.
Edges are named because names are what make ambiguity speakable: with two
foreign keys from issues into users, "assignee or reporter?"
is a question a user can answer where "path A or path B?" is not. An
asymmetric edge may also name its reverse traversal (inverseName —
"Reports To" for a "Manages" edge); presence of an inverse name is how the
representation records that the two directions are distinct roles.
symmetric applies to self-referential edges only (product
cross-sells, friend graphs) and records that the relationship has no
direction at the data level — a fact the engine cannot derive and would
otherwise guess wrong when traversing. It is mutually exclusive with an
inverse name (a symmetric edge has no distinct roles to name).
Neither name nor symmetry affects walkability: every edge is traversable in both directions for path-search purposes, because a join is symmetric regardless of which side owns the foreign key.
-
Constructor Summary
ConstructorsConstructorDescriptionRelationship(String name, Optional<String> inverseName, boolean symmetric, Endpoint source, Endpoint target, EdgeOrigin origin) Creates an instance of aRelationshiprecord class. -
Method Summary
Modifier and TypeMethodDescriptionThis edge's identity as a join, ignoring what it is called and which way round it was written: the two endpoints, each a relation and its lower-cased columns, in a fixed order.final 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.name()Returns the value of thenamerecord component.origin()Returns the value of theoriginrecord component.booleanReturnstrueif this edge connects a relation to itself.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
-
Relationship
public Relationship(String name, Optional<String> inverseName, boolean symmetric, Endpoint source, Endpoint target, EdgeOrigin origin) Creates an instance of aRelationshiprecord 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 componentorigin- the value for theoriginrecord component
-
-
Method Details
-
edgeIdentity
This edge's identity as a join, ignoring what it is called and which way round it was written: the two endpoints, each a relation and its lower-cased columns, in a fixed order.Two relationships with the same identity join the same rows. That is the sameness a caller holding several edges needs: an edge learned from a query and a declared one over the same columns are the same edge under two names, and
A.x = B.yis the same edge asB.y = A.x.- Returns:
- the identity; never null
- Since:
- 1.0
-
selfReferential
public boolean selfReferential()Returnstrueif this edge connects a relation to itself. -
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
-
origin
Returns the value of theoriginrecord component.- Returns:
- the value of the
originrecord component
-