Package org.eclipse.rdf4j.queryrender.sparql.ir.util.transform
@Experimental
package org.eclipse.rdf4j.queryrender.sparql.ir.util.transform
-
ClassesClassDescriptionRecognize RDF collection encodings (rdf:first/rdf:rest/... rdf:nil) headed by an anonymous collection variable and rewrite them to SPARQL collection syntax in text, e.g.,
?s ex:list (1 2 3).Form negated property sets (NPS) from simple shapes involving a predicate variable constrained by NOT IN or a chain of!=filters, optionally followed by a constant-predicate tail step that is fused.Within GRAPH bodies, normalize local triple/path shapes by fusing adjacent PT/SP/PT patterns and performing conservative tail joins.Apply path-related transforms repeatedly until the WHERE block reaches a textual fixed point.Fuse simple chains of constant-predicate statement patterns connected by parser-inserted bridge variables into property path triples, and handle a few local path+filter shapes (e.g., basic NPS formation) where safe.Shared helpers and small utilities for IR transform passes.Preserve or lightly canonicalize the orientation of bare negated property set triples.Normalize grouping of a final tail step like "/foaf:name" so that it appears outside the top-level grouped PT/PT fusion instead of inside the right-hand side group.Canonicalize orientation of bare negated property set path triples ("!Preserve UNION branch order while optionally normalizing inside each branch.Merge consecutive GRAPH blocks that reference the same graph term into a single GRAPH with a concatenated body.Remove UNION nodes that have a single branch, effectively inlining their content.Fuse a path triple with adjacent constant-predicate triples that share its subject (head prefix) or object (tail suffix).Fuse a path triple followed by a UNION of two single-step tail triples into a single path with an alternation tail.Fuse pattern: [PathTriple pre] followed by a UNION with two branches that each represent a tail path from pre.object to a common end variable.Late transform: inside a SERVICE body, fuse a UNION of two single-branch bare-NPS path triples into a single negated property set path triple combining members.Fuse a UNION whose branches are each a single bare-NPS path triple (optionally inside the same GRAPH) into a single NPS triple that combines members, preserving forward orientation and inverting members from inverse-oriented branches (using '^') when needed.Within a UNION, merge a subset of branches that are single IrPathTriple (or GRAPH with single IrPathTriple), share identical endpoints and graph ref, and do not themselves contain alternation or quantifiers.Fuse a UNION whose branches are each a single simple triple (optionally inside the same GRAPH) into a single path alternation: ?When a FILTER EXISTS is immediately preceded by a single triple, and the EXISTS body itself contains an explicit grouped block (i.e., its where has a single IrBGP line), wrap the preceding triple and the FILTER together in a group.Rewrite a UNION whose multiple branches are each a single GRAPH block with the same graph reference into a single GRAPH whose body contains a UNION of the inner branch bodies.Stabilize rendering for UNION branches that combine a top-level VALUES clause with a negated property set path triple by preserving an extra grouping block around the branch content.Inside GRAPH bodies, lift the scope marker from a path-generated UNION (branches all non-scoped) to the containing BGP.Merge adjacent VALUES blocks under provably-safe conditions: - Identical variable lists (same names, same order): conjunction is equivalent to the multiset intersection of rows.If a GRAPH block is immediately followed by a FILTER with an EXISTS body that itself wraps its content in a GRAPH of the same graph reference, move the FILTER EXISTS inside the preceding GRAPH and unwrap the inner GRAPH wrapper.Merge a simple OPTIONAL body that explicitly targets the same GRAPH as the preceding GRAPH block into that block, i.e., GRAPH ?Normalize FILTER conditions by reconstructing simple NOT IN expressions from top-level conjunctions of inequalities against the same variable, e.g., ( ?Normalize members inside negated property sets within path texts for stability.Recognize a parsed subselect encoding of a simple zero-or-one property path between two variables and rewrite it to a compact IrPathTriple with a trailing '?'Depth-aware helpers for property path text handling.Within OPTIONAL bodies, move simple FILTER conditions earlier when all their variables are already available from preceding lines in the same OPTIONAL body.Helper to fuse a UNION of two bare NPS path triples in a SERVICE body into a single negated property set triple.Simplify redundant parentheses in textual path expressions for readability and idempotence.Remove redundant single-child IrBGP layers inside UNION branches that do not carry new scope.