Class StatementPatternQueryEvaluationStep
java.lang.Object
org.eclipse.rdf4j.query.algebra.evaluation.impl.evaluationsteps.StatementPatternQueryEvaluationStep
- All Implemented Interfaces:
QueryEvaluationStep
Evaluate the StatementPattern - taking care of graph/datasets - avoiding redoing work every call of evaluate if
possible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Converts statements into the required bindingsets.private static final class
Nested classes/interfaces inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.QueryEvaluationStep
QueryEvaluationStep.DelayedEvaluationIteration
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Resource[]
private final QueryEvaluationContext
private final BiConsumer
<MutableBindingSet, Statement> static final Resource[]
private final boolean
private final Function
<BindingSet, Value> private final Function
<BindingSet, Value> private final Function
<BindingSet, Value> private final Function
<BindingSet, Value> private final StatementPattern
private final TripleSource
private final Predicate
<BindingSet> Fields inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.QueryEvaluationStep
EMPTY, EMPTY_ITERATION
-
Constructor Summary
ConstructorsConstructorDescriptionStatementPatternQueryEvaluationStep
(StatementPattern statementPattern, QueryEvaluationContext context, TripleSource tripleSource) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Resource[]
contextsGivenContextVal
(Value contextValue) evaluate
(BindingSet bindings) extractContextsFromDatasets
(Var contextVar, boolean emptyGraph, Set<IRI> graphs) private static Resource[]
fillContextsFromDatasSetGraphs
(Set<IRI> graphs) filterContextOrEqualVariables
(StatementPattern statementPattern, Value subjValue, Value predValue, Value objValue, Resource[] contexts) Generate a predicate that tests for Named contexts are matched by retrieving all statements from the store and filtering out the statements that do not have a context.filterSameVariable
(StatementPattern statementPattern, Value subjValue, Value predValue, Value objValue, Predicate<Statement> filter) Build one predicate that filters the statements for ?s ?p ?s cases.getIteration
(BindingSet bindings) private static Predicate
<BindingSet> getUnboundTest
(QueryEvaluationContext context, Var s, Var p, Var o, Var c) private CloseableIteration
<? extends Statement, QueryEvaluationException> handleFilter
(Resource[] contexts, Resource subject, IRI predicate, Value object, CloseableIteration<? extends Statement, QueryEvaluationException> iteration) private static BiConsumer
<MutableBindingSet, Statement> makeConverter
(QueryEvaluationContext context, Var s, Var p, Var o, Var c) We need to test every binding with hasBinding etc.private static Function
<BindingSet, Value> makeGetVarValue
(Var var, QueryEvaluationContext context) predicateVariableHasEquals
(boolean predEqObjVar, boolean predEqConVar) subjectVariableHasEquals
(boolean subEqPredVar, boolean subEqObjVar, boolean subEqConVar)
-
Field Details
-
DEFAULT_CONTEXT
-
ALL_CONTEXT
-
RETURN_NULL_VALUE_RESOURCE_ARRAY
-
statementPattern
-
tripleSource
-
emptyGraph
private final boolean emptyGraph -
contextSup
-
converter
-
context
-
unboundTest
-
getContextVar
-
getSubjectVar
-
getPredicateVar
-
getObjectVar
-
-
Constructor Details
-
StatementPatternQueryEvaluationStep
public StatementPatternQueryEvaluationStep(StatementPattern statementPattern, QueryEvaluationContext context, TripleSource tripleSource)
-
-
Method Details
-
getUnboundTest
private static Predicate<BindingSet> getUnboundTest(QueryEvaluationContext context, Var s, Var p, Var o, Var c) -
makeGetVarValue
-
evaluate
- Specified by:
evaluate
in interfaceQueryEvaluationStep
-
getIteration
private StatementPatternQueryEvaluationStep.JoinStatementWithBindingSetIterator getIteration(BindingSet bindings) -
getIteration
-
handleFilter
private CloseableIteration<? extends Statement,QueryEvaluationException> handleFilter(Resource[] contexts, Resource subject, IRI predicate, Value object, CloseableIteration<? extends Statement, QueryEvaluationException> iteration) -
filterContextOrEqualVariables
protected static Predicate<Statement> filterContextOrEqualVariables(StatementPattern statementPattern, Value subjValue, Value predValue, Value objValue, Resource[] contexts) Generate a predicate that tests for Named contexts are matched by retrieving all statements from the store and filtering out the statements that do not have a context. Or the same variable might have been used multiple times in this StatementPattern, verify value equality in those cases. -
filterSameVariable
private static Predicate<Statement> filterSameVariable(StatementPattern statementPattern, Value subjValue, Value predValue, Value objValue, Predicate<Statement> filter) Build one predicate that filters the statements for ?s ?p ?s cases. But only generates code that is actually needed else returns null. -
predicateVariableHasEquals
-
subjectVariableHasEquals
-
extractContextsFromDatasets
protected static Function<Value,Resource[]> extractContextsFromDatasets(Var contextVar, boolean emptyGraph, Set<IRI> graphs) - Returns:
- the contexts that are valid for this statement pattern or null
-
contextsGivenContextVal
-
fillContextsFromDatasSetGraphs
-
makeConverter
private static BiConsumer<MutableBindingSet,Statement> makeConverter(QueryEvaluationContext context, Var s, Var p, Var o, Var c) We need to test every binding with hasBinding etc. as these are not guaranteed to be equivalent between calls of evaluate(bs). Each conversion kind is special cased in with a specific method.- Returns:
- a converter from statement into MutableBindingSet
-
andThen
-