Class ReorderFiltersInOptionalBodiesTransform

java.lang.Object
org.eclipse.rdf4j.queryrender.sparql.ir.util.transform.BaseTransform
org.eclipse.rdf4j.queryrender.sparql.ir.util.transform.ReorderFiltersInOptionalBodiesTransform

public final class ReorderFiltersInOptionalBodiesTransform extends BaseTransform
Within OPTIONAL bodies, move simple FILTER conditions earlier when all their variables are already available from preceding lines in the same OPTIONAL body. This improves readability and can unlock later fusions. Safety: - Only reorders plain text FILTER conditions; structured bodies (EXISTS/NOT EXISTS) are left in place. - A FILTER is moved only if every variable it references appears in lines preceding the first nested OPTIONAL. - Preserves container structure and recurses conservatively.