T - The ViewDefinition type. Must inherit from IViewDefI - Type for result items - i.e. when the recursion reaches its end, it gives the list of found view candidates to a function that can transform it into an object of type IC - Context type used during recursion when looking for view candidates for quad patterns. Intended to track custom information for unsatisfiability determination.public abstract class CandidateViewSelectorBase<T extends IViewDef,C> extends Object implements CandidateViewSelector<T>
| Constructor and Description |
|---|
CandidateViewSelectorBase() |
| Modifier and Type | Method and Description |
|---|---|
com.hp.hpl.jena.sparql.algebra.Op |
_getApplicableViews(com.hp.hpl.jena.sparql.algebra.Op op)
Given a sparql query in quad form, this method replaces
(sub sets of) quad patterns with view instances (view patterns)
The method also passes the filter conditions that an op must
satisfy.
|
com.hp.hpl.jena.sparql.algebra.Op |
_getApplicableViews(com.hp.hpl.jena.sparql.algebra.Op op,
RestrictionManagerImpl restrictions) |
void |
addView(T viewDef) |
C |
createContext(C baseContext,
ViewInstance<T> viewInstance)
Optionally override this method to track custom information during the recursion of candidate selection of quad patterns
|
abstract com.hp.hpl.jena.sparql.algebra.Op |
createOp(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern opQuadPattern,
List<RecursionResult<T,C>> viewInstances) |
static <T extends IViewDef> |
createViewInstance(RestrictionManagerImpl subRestrictions,
com.hp.hpl.jena.sparql.core.Quad queryQuad,
ViewQuad<T> viewQuad)
Checks whether the view quad is consistent with the current constraints
|
static StartsWithConstraint |
deriveConstraint(com.hp.hpl.jena.sparql.expr.E_StrConcat expr) |
static StartsWithConstraint |
deriveConstraint(E_StrConcatPermissive expr) |
static Constraint |
deriveConstraint(com.hp.hpl.jena.sparql.expr.Expr expr) |
static VariableConstraint |
deriveIsPrefixOfConstraint(com.hp.hpl.jena.sparql.expr.Expr a,
com.hp.hpl.jena.sparql.expr.Expr b)
If a variable equals a (uri or string) constant, it means that the view must provide
a prefix for that value.
|
static VariableConstraint |
deriveViewLookupConstraint(com.hp.hpl.jena.sparql.expr.Expr expr)
Returns IsPrefixOf Constraints for equality expressions between variables and constants.
|
static RestrictionManagerImpl |
filterRestrictionsBound(RestrictionManagerImpl restrictions)
Create a new retrictions manager, where "bound" retrictions are removed
|
Set<ViewQuad<T>> |
findCandidates(com.hp.hpl.jena.sparql.core.Quad quad,
RestrictionManagerImpl restrictions)
TODO: This method is far from optimal performance right now:
We need to consider prefix-set-restrictions of the variables during the lookup in order to rule
out returning to many view-quad candidates.
|
org.aksw.commons.util.Pair<NavigableMap<Integer,Set<com.hp.hpl.jena.sparql.core.Quad>>,Map<com.hp.hpl.jena.sparql.core.Quad,Set<ViewQuad<T>>>> |
findQuadWithFewestViewCandidates(com.hp.hpl.jena.sparql.core.QuadPattern queryQuads,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpAssign op,
RestrictionManagerImpl _restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpConditional op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpDisjunction op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpDistinct op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpExtend op,
RestrictionManagerImpl _restrictions)
Extend defines now variables and is therefore similar to a VarDefinition.
|
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpFilter op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpGroup op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpJoin op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpOrder op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpProject op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpSequence op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpSlice op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpTopN op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpUnion op,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
getApplicableViews(com.hp.hpl.jena.query.Query query) |
List<RecursionResult<T,C>> |
getApplicableViewsBase(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern op,
RestrictionManagerImpl restrictions)
Order the quads of the quadPattern by selectivity.
|
void |
getApplicableViewsRec2(int index,
List<com.hp.hpl.jena.sparql.core.Quad> quadOrder,
Set<ViewQuad<T>> viewQuads,
Map<com.hp.hpl.jena.sparql.core.Quad,Set<ViewQuad<T>>> candidates,
RestrictionManagerImpl restrictions,
NestedStack<ViewInstance<T>> instances,
List<RecursionResult<T,C>> result,
C baseContext) |
static <T extends IViewDef> |
getCandidateNames(NestedStack<ViewInstance<T>> instances) |
static List<RestrictionManagerImpl> |
getRestrictions(com.hp.hpl.jena.sparql.algebra.Op op) |
static void |
getRestrictions(com.hp.hpl.jena.sparql.algebra.Op op,
Collection<RestrictionManagerImpl> result)
Returns a disjunction (list) of restrictions that apply for a given node
|
static RestrictionManagerImpl |
getRestrictions2(com.hp.hpl.jena.sparql.algebra.Op op) |
static RdfTermType |
getType(com.hp.hpl.jena.graph.Node node,
RestrictionManagerImpl restrictions) |
Collection<T> |
getViews() |
Map<String,Constraint> |
inferColumnConstraints(com.hp.hpl.jena.sparql.core.Quad quad,
RestrictionImpl[] termRestriction,
Clause clause) |
static <T extends IViewDef> |
isSatisfiable(List<ViewInstance<T>> list)
TODO FIX THIS
|
T |
normalizeView(T view)
Override this function to transform the view before actually indexing it
|
com.hp.hpl.jena.sparql.algebra.Op |
processLeftJoin(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin |
processLeftJoinDirect(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
processLeftJoinSplitLhs(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions) |
com.hp.hpl.jena.sparql.algebra.Op |
processOpExtend(com.hp.hpl.jena.sparql.algebra.Op subOp,
com.hp.hpl.jena.sparql.core.VarExprList varExprs,
RestrictionManagerImpl _restrictions) |
public CandidateViewSelectorBase()
opMappingRewriter - May be null. If given, we can do rewrites during the SQL generation to prune empty result mappings early.public abstract com.hp.hpl.jena.sparql.algebra.Op createOp(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern opQuadPattern,
List<RecursionResult<T,C>> viewInstances)
public C createContext(C baseContext, ViewInstance<T> viewInstance) throws UnsatisfiabilityException
baseContext - viewInstance - UnsatisfiabilityExceptionpublic void addView(T viewDef)
addView in interface CandidateViewSelector<T extends IViewDef>public static Constraint deriveConstraint(com.hp.hpl.jena.sparql.expr.Expr expr)
public static StartsWithConstraint deriveConstraint(com.hp.hpl.jena.sparql.expr.E_StrConcat expr)
public static StartsWithConstraint deriveConstraint(E_StrConcatPermissive expr)
public static RdfTermType getType(com.hp.hpl.jena.graph.Node node, RestrictionManagerImpl restrictions)
public T normalizeView(T view)
view - public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.query.Query query)
getApplicableViews in interface CandidateViewSelector<T extends IViewDef>public static VariableConstraint deriveIsPrefixOfConstraint(com.hp.hpl.jena.sparql.expr.Expr a, com.hp.hpl.jena.sparql.expr.Expr b)
a - b - public static VariableConstraint deriveViewLookupConstraint(com.hp.hpl.jena.sparql.expr.Expr expr)
expr - public List<RecursionResult<T,C>> getApplicableViewsBase(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern op, RestrictionManagerImpl restrictions)
public Map<String,Constraint> inferColumnConstraints(com.hp.hpl.jena.sparql.core.Quad quad, RestrictionImpl[] termRestriction, Clause clause)
public Set<ViewQuad<T>> findCandidates(com.hp.hpl.jena.sparql.core.Quad quad, RestrictionManagerImpl restrictions)
quad - restrictions - public org.aksw.commons.util.Pair<NavigableMap<Integer,Set<com.hp.hpl.jena.sparql.core.Quad>>,Map<com.hp.hpl.jena.sparql.core.Quad,Set<ViewQuad<T>>>> findQuadWithFewestViewCandidates(com.hp.hpl.jena.sparql.core.QuadPattern queryQuads, RestrictionManagerImpl restrictions)
public static <T extends IViewDef> List<String> getCandidateNames(NestedStack<ViewInstance<T>> instances)
public static <T extends IViewDef> ViewInstance<T> createViewInstance(RestrictionManagerImpl subRestrictions, com.hp.hpl.jena.sparql.core.Quad queryQuad, ViewQuad<T> viewQuad)
restrictions - queryQuad - viewQuad - public void getApplicableViewsRec2(int index,
List<com.hp.hpl.jena.sparql.core.Quad> quadOrder,
Set<ViewQuad<T>> viewQuads,
Map<com.hp.hpl.jena.sparql.core.Quad,Set<ViewQuad<T>>> candidates,
RestrictionManagerImpl restrictions,
NestedStack<ViewInstance<T>> instances,
List<RecursionResult<T,C>> result,
C baseContext)
index - quadOrder - viewQuads - The viewQuads provided by the parent invocation - with any restrictions encountered during the rewrite taken into accountcandidates - The viewQuads here are the ones from only analyzing the query filter
In some cases (small candidate sets) it might be faster filtering this set of view candidates, rather than doing a new lookup.restrictions - result - public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern op,
RestrictionManagerImpl restrictions)
public static <T extends IViewDef> boolean isSatisfiable(List<ViewInstance<T>> list)
list - public com.hp.hpl.jena.sparql.algebra.Op _getApplicableViews(com.hp.hpl.jena.sparql.algebra.Op op)
op - public com.hp.hpl.jena.sparql.algebra.Op _getApplicableViews(com.hp.hpl.jena.sparql.algebra.Op op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpSequence op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpTopN op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpDisjunction op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpProject op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpOrder op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpGroup op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpExtend op,
RestrictionManagerImpl _restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpAssign op,
RestrictionManagerImpl _restrictions)
public com.hp.hpl.jena.sparql.algebra.Op processOpExtend(com.hp.hpl.jena.sparql.algebra.Op subOp,
com.hp.hpl.jena.sparql.core.VarExprList varExprs,
RestrictionManagerImpl _restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpFilter op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpUnion op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpJoin op,
RestrictionManagerImpl restrictions)
public static RestrictionManagerImpl filterRestrictionsBound(RestrictionManagerImpl restrictions)
restrictions - public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpConditional op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op processLeftJoin(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op processLeftJoinSplitLhs(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin processLeftJoinDirect(com.hp.hpl.jena.sparql.algebra.Op left,
com.hp.hpl.jena.sparql.algebra.Op right,
Iterable<com.hp.hpl.jena.sparql.expr.Expr> exprs,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpSlice op,
RestrictionManagerImpl restrictions)
public com.hp.hpl.jena.sparql.algebra.Op getApplicableViews(com.hp.hpl.jena.sparql.algebra.op.OpDistinct op,
RestrictionManagerImpl restrictions)
public static RestrictionManagerImpl getRestrictions2(com.hp.hpl.jena.sparql.algebra.Op op)
public static List<RestrictionManagerImpl> getRestrictions(com.hp.hpl.jena.sparql.algebra.Op op)
public static void getRestrictions(com.hp.hpl.jena.sparql.algebra.Op op,
Collection<RestrictionManagerImpl> result)
public Collection<T> getViews()
getViews in interface CandidateViewSelector<T extends IViewDef>Copyright © 2013. All Rights Reserved.