Class ExecOpSequentialBindJoinSPARQLwithVarRenaming
java.lang.Object
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.UnaryExecutableOpBase
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoin<SPARQLGraphPattern,SPARQLEndpoint>
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoinSPARQL
se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.ExecOpSequentialBindJoinSPARQLwithVarRenaming
- All Implemented Interfaces:
StatsProvider,ExecutableOperator,UnaryExecutableOp
public class ExecOpSequentialBindJoinSPARQLwithVarRenaming
extends BaseForExecOpSequentialBindJoinSPARQL
Implementation of the sequential, batch-based bind-join algorithm that
uses UNION clauses with variable renaming (as proposed in the FedX
paper by Schwarte et al. 2011, where it is called "bound join"). The
variable that is renamed can be any non-join variable.
For more details about the actual implementation of the algorithm, and its
extra capabilities, refer to
BaseForExecOpSequentialBindJoin.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classNested classes/interfaces inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoin
BaseForExecOpSequentialBindJoin.MyIntermediateResultElementSink, BaseForExecOpSequentialBindJoin.MyIntermediateResultElementSinkOuterJoin -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.jena.sparql.syntax.Elementprotected final org.apache.jena.sparql.core.Varprotected final Stringprotected final List<org.apache.jena.sparql.engine.binding.Binding> Fields inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoin
allJoinVarsAreCertain, currentBatch, currentSolMapsForRequest, DEFAULT_BATCH_SIZE, fm, fullResult, minimumRequestBlockSize, numberOfRequestOpsUsed, numOfSolMapsRetrievedPerReqOp, query, requestBlockSize, requestBlockSizeWasReduced, statsOfFirstReqOp, statsOfLastReqOp, useOuterJoinSemantics, varsInQueryFields inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
collectExceptions, qpInfo -
Constructor Summary
ConstructorsConstructorDescriptionExecOpSequentialBindJoinSPARQLwithVarRenaming(SPARQLGraphPattern query, SPARQLEndpoint fm, ExpectedVariables inputVars, boolean useOuterJoinSemantics, int batchSize, boolean collectExceptions, QueryPlanningInfo qpInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected NullaryExecutableOpcreateExecutableReqOp(Set<org.apache.jena.sparql.engine.binding.Binding> solMaps) Implementations of this function should create an executable operator that can perform a bind join request in which the query of this bind join operator is combined with the given solution mappings.protected BaseForExecOpSequentialBindJoin<SPARQLGraphPattern,SPARQLEndpoint>.MyIntermediateResultElementSink protected org.apache.jena.sparql.syntax.ElementcreateUnion(Iterable<org.apache.jena.sparql.engine.binding.Binding> solMaps) org.apache.jena.sparql.core.VargetVarForRenaming(SPARQLGraphPattern query, ExpectedVariables inputVars) Finds a variable in the given query that is not present in the expected input variables and can be used as a variable for renaming.static org.apache.jena.sparql.engine.binding.BindingrenameVar(org.apache.jena.sparql.engine.binding.Binding binding, org.apache.jena.sparql.core.Var oldVar, org.apache.jena.sparql.core.Var newVar) Renames a variable within a single Jena binding.static org.apache.jena.sparql.syntax.ElementrenameVar(SPARQLGraphPattern pattern, org.apache.jena.sparql.core.Var oldVar, org.apache.jena.sparql.core.Var newVar) Renames all occurences of variable within a SPARQL graph pattern element.org.apache.jena.sparql.engine.binding.BindingresolveRenamedVarAndMerge(org.apache.jena.sparql.engine.binding.Binding sm) Finds the renamed variable in the given solution mapping, parses its numerical suffix as an index, renames that variable, and merges the result with the corresponding entry in solMapsList.Methods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoinSPARQL
createExecutableReqOpForAllMethods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOpSequentialBindJoin
_concludeExecution, _process, _processJoinableInput, alreadyCovered, areAllJoinVarsAreCertain, consumeMySink, createStats, joinInFullRetrievalMode, joinInFullRetrievalMode, performRequestAndHandleResponse, reduceRequestBlockSize, resetStats, switchToFullRetrievalModeMethods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.UnaryExecutableOpBase
_process, concludeExecution, getStats, process, processMethods inherited from class se.liu.ida.hefquin.engine.queryplan.executable.impl.ops.BaseForExecOps
getExceptionsCaughtDuringExecution, getQueryPlanningInfo, recordExceptionCaughtDuringExecutionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface se.liu.ida.hefquin.engine.queryplan.executable.ExecutableOperator
getExceptionsCaughtDuringExecution, getQueryPlanningInfo
-
Field Details
-
pattern
protected final org.apache.jena.sparql.syntax.Element pattern -
solMapsList
-
renamedVar
protected final org.apache.jena.sparql.core.Var renamedVar -
renamedVarPrefix
-
-
Constructor Details
-
ExecOpSequentialBindJoinSPARQLwithVarRenaming
public ExecOpSequentialBindJoinSPARQLwithVarRenaming(SPARQLGraphPattern query, SPARQLEndpoint fm, ExpectedVariables inputVars, boolean useOuterJoinSemantics, int batchSize, boolean collectExceptions, QueryPlanningInfo qpInfo) - Parameters:
query- - the graph pattern to be evaluated (in a bind-join manner) at the federation member given as 'fm'fm- - the federation member targeted by this operatorinputVars- - the variables to be expected in the solution mappings that will be pushed as input to this operatoruseOuterJoinSemantics- -trueif the 'query' is to be evaluated under outer-join semantics;falsefor inner-join semanticsbatchSize- - the number of solution mappings to be included in each bind-join request; this value must not be smaller thanBaseForExecOpSequentialBindJoin.minimumRequestBlockSizecollectExceptions- -trueif this operator has to collect exceptions (which is handled entirely by one of the super classes);falseif the operator should immediately throw everyExecOpExecutionExceptionqpInfo- - theQueryPlanningInfoobject that was populated for a physical plan whose root operator was the physical operator for which this executable operator was created
-
-
Method Details
-
getVarForRenaming
public org.apache.jena.sparql.core.Var getVarForRenaming(SPARQLGraphPattern query, ExpectedVariables inputVars) Finds a variable in the given query that is not present in the expected input variables and can be used as a variable for renaming. The method iterates through the certain variables of the given SPARQL graph pattern and returns the first variable that is neither listed as a certain variable nor a possible variable among the input variables.- Parameters:
query- the SPARQL graph pattern containing the query variablesinputVars- the input variables- Returns:
- a
Varthat can be used as a variable for renaming, ornullif no such variable is found
-
createExecutableReqOp
protected NullaryExecutableOp createExecutableReqOp(Set<org.apache.jena.sparql.engine.binding.Binding> solMaps) Description copied from class:BaseForExecOpSequentialBindJoinImplementations of this function should create an executable operator that can perform a bind join request in which the query of this bind join operator is combined with the given solution mappings. Implementations can assume that the given solution mappings are already restricted to contain bindings only for the join variables, that none of the given solution mappings contains blank nodes, that none of the given solution mappings is the empty solution mapping, and that the given set of solution mappings is duplicate free and nonempty. The operator created by this function should throw exceptions instead of collecting them.- Specified by:
createExecutableReqOpin classBaseForExecOpSequentialBindJoin<SPARQLGraphPattern,SPARQLEndpoint>
-
createUnion
protected org.apache.jena.sparql.syntax.Element createUnion(Iterable<org.apache.jena.sparql.engine.binding.Binding> solMaps) -
createMySink
protected BaseForExecOpSequentialBindJoin<SPARQLGraphPattern,SPARQLEndpoint>.MyIntermediateResultElementSink createMySink()- Overrides:
createMySinkin classBaseForExecOpSequentialBindJoin<SPARQLGraphPattern,SPARQLEndpoint>
-
renameVar
public static org.apache.jena.sparql.syntax.Element renameVar(SPARQLGraphPattern pattern, org.apache.jena.sparql.core.Var oldVar, org.apache.jena.sparql.core.Var newVar) Renames all occurences of variable within a SPARQL graph pattern element.- Parameters:
pattern- the SPARQL graph pattern in which to rename the variableoldVar- the variable to be replacednewVar- the variable to replaceoldVar- Returns:
- the modified element
-
renameVar
public static org.apache.jena.sparql.engine.binding.Binding renameVar(org.apache.jena.sparql.engine.binding.Binding binding, org.apache.jena.sparql.core.Var oldVar, org.apache.jena.sparql.core.Var newVar) Renames a variable within a single Jena binding. Iterates over all (variable, value) pairs in the original binding and builds a new binding the occurrence ofoldVaris replaced bynewVar.- Parameters:
binding- the original bindingoldVar- the variable to replacenewVar- the new variable name- Returns:
- a new binding
-
resolveRenamedVarAndMerge
public org.apache.jena.sparql.engine.binding.Binding resolveRenamedVarAndMerge(org.apache.jena.sparql.engine.binding.Binding sm) Finds the renamed variable in the given solution mapping, parses its numerical suffix as an index, renames that variable, and merges the result with the corresponding entry in solMapsList.- Parameters:
sm- the incoming solution mapping- Returns:
- a new solution mapping that has been renamed and merged
- Throws:
IllegalArgumentException- if no renamed variable is found
-