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 class
PathIteration.ValuePair
(package private) class
PathIteration.VarReplacer
-
Field Summary
Fields Modifier and Type Field Description private BindingSet
bindings
private Var
contextVar
private CloseableIteration<BindingSet,QueryEvaluationException>
currentIter
private long
currentLength
private PathIteration.ValuePair
currentVp
private Var
endVar
private boolean
endVarFixed
private static java.lang.String
JOINVAR_PREFIX
private java.util.Set<java.lang.String>
namedIntermediateJoins
private TupleExpr
pathExpression
private java.util.Set<PathIteration.ValuePair>
reportedValues
private StatementPattern.Scope
scope
private Var
startVar
private boolean
startVarFixed
private EvaluationStrategy
strategy
private java.util.Set<PathIteration.ValuePair>
unreportedValues
private 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 boolean
add(java.util.Set<PathIteration.ValuePair> valueSet, PathIteration.ValuePair vp)
private void
addBinding(MutableBindingSet bs, java.lang.String name, Value value)
protected boolean
addToQueue(java.util.Queue<PathIteration.ValuePair> valueQueue2, PathIteration.ValuePair vp)
Var
createAnonVar(java.lang.String varName)
private Var
createAnonVar(java.lang.String varName, Value v, boolean anonymous)
private void
createIteration()
protected BindingSet
getNextElement()
Gets the next element.private Value
getVarValue(Var var, boolean fixedValue, BindingSet bindingSet)
protected void
handleClose()
Called byAbstractCloseableIteration.close()
when it is called for the first time.private boolean
isCyclicPath(PathIteration.ValuePair vp)
protected boolean
isUnbound(Var var, BindingSet bindings)
private BindingSet
removeIntermediateJoinVars(QueryBindingSet nextElement)
private PathIteration.ValuePair
valuePairFromStartAndEnd(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:LookAheadIteration
Gets the next element. Subclasses should implement this method so that it returns the next element.- Specified by:
getNextElement
in 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 QueryEvaluationException
Description copied from class:AbstractCloseableIteration
Called 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:
handleClose
in 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)
-
-