Class IrPathTriple


public class IrPathTriple extends IrTripleLike
Textual IR node for a property path triple: subject, path expression, object. Path expression is stored as pre-rendered text to allow local string-level rewrites (alternation/sequence grouping, quantifiers) without needing a full AST here. Transforms are responsible for ensuring parentheses are added only when required for correctness; printing strips redundant outermost parentheses for stable output.
  • Constructor Details

    • IrPathTriple

      public IrPathTriple(Var subject, String pathText, Var object, boolean newScope, Set<Var> pathVars)
    • IrPathTriple

      public IrPathTriple(Var subject, IrNode subjectOverride, String pathText, Var object, IrNode objectOverride, Set<Var> pathVars, boolean newScope)
  • Method Details

    • getPathText

      public String getPathText()
    • getPredicateOrPathText

      public String getPredicateOrPathText(TupleExprIRRenderer r)
      Description copied from class: IrTripleLike
      Render the predicate or path as compact textual IR suitable for inclusion in a property path. For simple statement patterns this typically returns a compact IRI (possibly prefixed); for path triples it returns the already-rendered path text. Implementations should return null when no safe textual representation exists (e.g., non-constant predicate in a statement pattern).
      Specified by:
      getPredicateOrPathText in class IrTripleLike
    • getPathVars

      public Set<Var> getPathVars()
      Returns the set of variables that contributed to this path during fusing (e.g., anon _anon_path_* bridges).
    • setPathVars

      public void setPathVars(Set<Var> vars)
      Assign the set of variables that contributed to this path during fusing.
    • mergePathVars

      public static Set<Var> mergePathVars(IrPathTriple... pts)
      Merge pathVars from 2+ IrPathTriples into a new unmodifiable set.
    • fromStatementPatterns

      public static Set<Var> fromStatementPatterns(IrStatementPattern... sps)
      Create a set of pathVars from one or more IrStatementPattern by collecting any parser bridge variables (subject/object with names starting with _anon_path_ or _anon_path_inverse_) and anonymous predicate vars.
    • print

      public void print(IrPrinter p)
      Description copied from class: IrNode
      Default no-op printing; concrete nodes override.
      Specified by:
      print in class IrNode
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getVars

      public Set<Var> getVars()
      Description copied from class: IrNode
      Collect variables referenced by this node and all of its children (if any). Default implementation returns an empty set; container and triple-like nodes override to include their own Vars and recurse into child nodes.
      Overrides:
      getVars in class IrTripleLike