Class DistinctExtendFilter2
java.lang.Object
org.aksw.jena_sparql_api.algebra.analysis.DistinctExtendFilter2
This class captures the following generic SPARQL query set:
Select (project / extend) { // postDistinctVarDefs
select distinct (project / extend) { // preDestinctVarDefs
[subOp]
filter(...)
}
}
- if there is no distinct, there are no post-distinct definitions (indicated by null); only pre-distinct ones
- the filters are always expressed to reference pre-distinct variables
this means, that any filter must be expanded first using the post-distinct definitions
and subsequently the pre-distsinct definitions
-
initially:
as long as there is no distinct encountered:
- have all projections / expressions affect the pre-distinct definitions
When encountering distinct:
- Any new distinct makes a prior one obsolete.
- The postDistinct expressions become simply identity mappings of the pre-distinct definitions
Note: It is possible to have nested distinct's that cannot be flattened, such as:
Extend(?foo = , Distinct(?s ... )
- Author:
- raven
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExprHolderprotected booleanprotected Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.Expr> protected Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.Expr> -
Constructor Summary
ConstructorsConstructorDescriptionDistinctExtendFilter2(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varToDef, boolean distinct, ExprHolder filter) -
Method Summary
Modifier and TypeMethodDescriptionConceptually overrides a prior distinct, and marks all so far visible variables as distinct - If there was no prior distinct: Initialize the post distinct map to an identity mapping of the visible variables after pre-distinct - Otherwise Merge the current post-distinct definitions with the pre-distinct ones: Create a post-distinct identity mapping with all visible variables of pre-distinctapplyExtend(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> extend) applyExtend(org.apache.jena.sparql.core.VarExprList extend) applyFilter(org.apache.jena.sparql.expr.Expr contribExpr) Expand any filter according to any prior extendapplyFilter(org.apache.jena.sparql.expr.ExprList contribExprs) applyProject(Collection<org.apache.jena.sparql.core.Var> projectVars) Update the projectionstatic DistinctExtendFilter2create()static DistinctExtendFilter2create(Collection<org.apache.jena.sparql.core.Var> initialVars) static org.apache.jena.sparql.expr.ExprTransformcreateExprTransform(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varDefs) static Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.Expr> createIdentityMap(Collection<org.apache.jena.sparql.core.Var> vars) static Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.Expr> expandDefs(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> src, Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varDefs) org.apache.jena.sparql.expr.ExprexpandExpr(org.apache.jena.sparql.expr.Expr expr) static org.apache.jena.sparql.expr.ExprexpandExpr(org.apache.jena.sparql.expr.Expr expr, Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varDefs) static voidorg.apache.jena.sparql.algebra.OptoOp(org.apache.jena.sparql.algebra.Op result) toString()static Stringstatic String
-
Field Details
-
postDistinctVarDefs
-
isDistinct
protected boolean isDistinct -
preDistinctVarDefs
-
filter
-
-
Constructor Details
-
DistinctExtendFilter2
public DistinctExtendFilter2(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varToDef, boolean distinct, ExprHolder filter)
-
-
Method Details
-
toOp
public org.apache.jena.sparql.algebra.Op toOp(org.apache.jena.sparql.algebra.Op result) -
create
-
createIdentityMap
public static Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.Expr> createIdentityMap(Collection<org.apache.jena.sparql.core.Var> vars) -
create
-
applyProject
Update the projection- Parameters:
projectVars-- Returns:
-
applyDistinct
Conceptually overrides a prior distinct, and marks all so far visible variables as distinct - If there was no prior distinct: Initialize the post distinct map to an identity mapping of the visible variables after pre-distinct - Otherwise Merge the current post-distinct definitions with the pre-distinct ones: Create a post-distinct identity mapping with all visible variables of pre-distinct- Returns:
-
applyExtend
-
applyExtend
public DistinctExtendFilter2 applyExtend(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> extend) -
applyFilter
-
applyFilter
Expand any filter according to any prior extend- Parameters:
exprHolder-- Returns:
-
toString
-
toString
-
toString
-
expandExpr
public org.apache.jena.sparql.expr.Expr expandExpr(org.apache.jena.sparql.expr.Expr expr) -
expandDefs
-
createExprTransform
public static org.apache.jena.sparql.expr.ExprTransform createExprTransform(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varDefs) -
expandExpr
public static org.apache.jena.sparql.expr.Expr expandExpr(org.apache.jena.sparql.expr.Expr expr, Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.Expr> varDefs) -
main
-