Record Class FixpointNode

java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.FixpointNode
Record Components:
name - the bound recursive relation name; must not be blank
base - the non-recursive seed relation; must not be null
step - the recursive body (references name via RecursiveRefNode); must not be null
location - the source location of this node; never null
All Implemented Interfaces:
RelNode

public record FixpointNode(String name, RelNode base, RelNode step, SourceLocation location) extends Record implements RelNode
General monotone recursion — the least-fixpoint binder FIX.

FIX name (base, step) binds the recursive relation name over the recursive body step. The base() is the non-recursive seed; the step() is the recursive case, evaluated repeatedly with name bound to the relation accumulated so far. Occurrences of name inside step are represented by RecursiveRefNode leaves (the binder is lexically scoped — name is visible only within step, never within base or outside the FIX). The fixpoint is the union of base with every step iterate, computed under set semantics (each round dedups and a tuple already derived is never re-added), so the iteration terminates — even over cyclic input data.

This is the WITH RECURSIVE / single-rule Datalog equivalent; binary transitive closure (ClosureNode) is its two-column special case. The operator materialises a set and never pushes down to a source.

Surface syntax: FIX R (base, step) (keyword-only, no glyph).

  • Constructor Details

    • FixpointNode

      public FixpointNode(String name, RelNode base, RelNode step, SourceLocation location)
      Creates an instance of a FixpointNode record class.
      Parameters:
      name - the value for the name record component
      base - the value for the base record component
      step - the value for the step record component
      location - the value for the location record component
    • FixpointNode

      public FixpointNode(String name, RelNode base, RelNode step)
      Convenience constructor for tests: SourceLocation.UNKNOWN.
  • Method Details

    • accept

      public <R> R accept(RelNodeVisitor<R> visitor)
      Specified by:
      accept in interface RelNode
    • 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.
    • name

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

      public RelNode base()
      Returns the value of the base record component.
      Returns:
      the value of the base record component
    • step

      public RelNode step()
      Returns the value of the step record component.
      Returns:
      the value of the step record component
    • location

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