Class PathIteration
- java.lang.Object
-
- org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
-
- org.eclipse.rdf4j.common.iteration.LookAheadIteration<BindingSet,QueryEvaluationException>
-
- org.eclipse.rdf4j.query.algebra.evaluation.iterator.PathIteration
-
- All Implemented Interfaces:
java.lang.AutoCloseable,CloseableIteration<BindingSet,QueryEvaluationException>,Iteration<BindingSet,QueryEvaluationException>
public class PathIteration extends LookAheadIteration<BindingSet,QueryEvaluationException>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPathIteration.ValuePair(package private) classPathIteration.VarReplacer
-
Field Summary
Fields Modifier and Type Field Description private BindingSetbindingsprivate VarcontextVarprivate CloseableIteration<BindingSet,QueryEvaluationException>currentIterprivate longcurrentLengthprivate PathIteration.ValuePaircurrentVpprivate VarendVarprivate booleanendVarFixedprivate static java.lang.StringJOINVAR_PREFIXprivate java.util.Set<java.lang.String>namedIntermediateJoinsprivate TupleExprpathExpressionprivate java.util.Set<PathIteration.ValuePair>reportedValuesprivate StatementPattern.Scopescopeprivate VarstartVarprivate booleanstartVarFixedprivate EvaluationStrategystrategyprivate java.util.Set<PathIteration.ValuePair>unreportedValuesprivate java.util.Queue<PathIteration.ValuePair>valueQueue
-
Constructor Summary
Constructors Constructor Description PathIteration(EvaluationStrategy strategy, StatementPattern.Scope scope, Var startVar, TupleExpr pathExpression, Var endVar, Var contextVar, long minLength, BindingSet bindings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanadd(java.util.Set<PathIteration.ValuePair> valueSet, PathIteration.ValuePair vp)private voidaddBinding(MutableBindingSet bs, java.lang.String name, Value value)protected booleanaddToQueue(java.util.Queue<PathIteration.ValuePair> valueQueue2, PathIteration.ValuePair vp)VarcreateAnonVar(java.lang.String varName)private VarcreateAnonVar(java.lang.String varName, Value v, boolean anonymous)private voidcreateIteration()protected BindingSetgetNextElement()Gets the next element.private ValuegetVarValue(Var var, boolean fixedValue, BindingSet bindingSet)protected voidhandleClose()Called byAbstractCloseableIteration.close()when it is called for the first time.private booleanisCyclicPath(PathIteration.ValuePair vp)protected booleanisUnbound(Var var, BindingSet bindings)private BindingSetremoveIntermediateJoinVars(QueryBindingSet nextElement)private PathIteration.ValuePairvaluePairFromStartAndEnd(MutableBindingSet nextElement)-
Methods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration
hasNext, next, remove
-
Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration
close, isClosed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
-
-
-
Field Detail
-
strategy
private final EvaluationStrategy strategy
-
currentLength
private long currentLength
-
currentIter
private CloseableIteration<BindingSet,QueryEvaluationException> currentIter
-
bindings
private final BindingSet bindings
-
scope
private final StatementPattern.Scope scope
-
startVar
private final Var startVar
-
endVar
private final Var endVar
-
startVarFixed
private final boolean startVarFixed
-
endVarFixed
private final boolean endVarFixed
-
valueQueue
private final java.util.Queue<PathIteration.ValuePair> valueQueue
-
reportedValues
private final java.util.Set<PathIteration.ValuePair> reportedValues
-
unreportedValues
private final java.util.Set<PathIteration.ValuePair> unreportedValues
-
pathExpression
private final TupleExpr pathExpression
-
contextVar
private final Var contextVar
-
currentVp
private PathIteration.ValuePair currentVp
-
JOINVAR_PREFIX
private static final java.lang.String JOINVAR_PREFIX
- See Also:
- Constant Field Values
-
namedIntermediateJoins
private final java.util.Set<java.lang.String> namedIntermediateJoins
-
-
Constructor Detail
-
PathIteration
public PathIteration(EvaluationStrategy strategy, StatementPattern.Scope scope, Var startVar, TupleExpr pathExpression, Var endVar, Var contextVar, long minLength, BindingSet bindings) throws QueryEvaluationException
- Throws:
QueryEvaluationException
-
-
Method Detail
-
getNextElement
protected BindingSet getNextElement() throws QueryEvaluationException
Description copied from class:LookAheadIterationGets the next element. Subclasses should implement this method so that it returns the next element.- Specified by:
getNextElementin classLookAheadIteration<BindingSet,QueryEvaluationException>- Returns:
- The next element, or null if no more elements are available.
- Throws:
QueryEvaluationException
-
removeIntermediateJoinVars
private BindingSet removeIntermediateJoinVars(QueryBindingSet nextElement)
-
valuePairFromStartAndEnd
private PathIteration.ValuePair valuePairFromStartAndEnd(MutableBindingSet nextElement)
-
addBinding
private void addBinding(MutableBindingSet bs, java.lang.String name, Value value)
-
handleClose
protected void handleClose() throws QueryEvaluationExceptionDescription copied from class:AbstractCloseableIterationCalled byAbstractCloseableIteration.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.- Overrides:
handleClosein classLookAheadIteration<BindingSet,QueryEvaluationException>- Throws:
QueryEvaluationException
-
addToQueue
protected boolean addToQueue(java.util.Queue<PathIteration.ValuePair> valueQueue2, PathIteration.ValuePair vp) throws QueryEvaluationException
- Parameters:
valueQueue2-vp-- Throws:
QueryEvaluationException
-
add
protected boolean add(java.util.Set<PathIteration.ValuePair> valueSet, PathIteration.ValuePair vp) throws QueryEvaluationException
- Parameters:
valueSet-vp-- Throws:
QueryEvaluationException
-
getVarValue
private Value getVarValue(Var var, boolean fixedValue, BindingSet bindingSet)
-
isCyclicPath
private boolean isCyclicPath(PathIteration.ValuePair vp)
-
createIteration
private void createIteration() throws QueryEvaluationException- Throws:
QueryEvaluationException
-
isUnbound
protected boolean isUnbound(Var var, BindingSet bindings)
-
createAnonVar
public Var createAnonVar(java.lang.String varName)
-
-