Class IrNode

java.lang.Object
org.eclipse.rdf4j.queryrender.sparql.ir.IrNode
Direct Known Subclasses:
IrBGP, IrBind, IrCollection, IrExists, IrFilter, IrGraph, IrInlineTriple, IrMinus, IrNot, IrOptional, IrSelect, IrService, IrSubSelect, IrText, IrTripleLike, IrUnion, IrValues

public abstract class IrNode extends Object
Base class for textual SPARQL Intermediate Representation (IR) nodes. Design goals: - Keep IR nodes small and predictable; they are close to the final SPARQL surface form and intentionally avoid carrying evaluation semantics. - Favour immutability from the perspective of transforms: implementors should not mutate existing instances inside transforms but instead build new nodes as needed. - Provide a single print(IrPrinter) entry point so pretty-printing concerns are centralized in the IrPrinter implementation.
  • Field Details

    • _className

      public final String _className
  • Constructor Details

    • IrNode

      public IrNode(boolean newScope)
  • Method Details

    • print

      public abstract void print(IrPrinter p)
      Default no-op printing; concrete nodes override.
    • transformChildren

      public IrNode transformChildren(UnaryOperator<IrNode> op)
      Function-style child transformation hook used by the transform pipeline to descend into nested structures. Contract: - Leaf nodes return this unchanged. - Container nodes return a new instance with their immediate children transformed using the provided operator. - Implementations must not mutate this or its existing children.
    • isNewScope

      public boolean isNewScope()
    • setNewScope

      public void setNewScope(boolean newScope)
    • getVars

      public Set<Var> getVars()
      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.