Class ExclusiveGroup
- java.lang.Object
-
- org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
-
- org.eclipse.rdf4j.federated.algebra.ExclusiveGroup
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ExclusiveTupleExpr
,FedXTupleExpr
,FilterTuple
,QueryRef
,StatementTupleExpr
,VariableExpr
,GraphPatternGroupable
,QueryModelNode
,TupleExpr
,VariableScopeChange
public class ExclusiveGroup extends AbstractQueryModelNode implements StatementTupleExpr, FilterTuple, ExclusiveTupleExpr
Represents a group ofExclusiveTupleExpr
that can only produce results at a single endpoint, theStatementSource
.- Author:
- Andreas Schwarte
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected QueryBindingSet
boundFilters
protected FilterValueExpr
filterExpr
protected Set<String>
freeVars
protected String
id
protected List<ExclusiveTupleExpr>
owned
protected Endpoint
ownedEndpoint
protected StatementSource
owner
protected QueryInfo
queryInfo
-
Constructor Summary
Constructors Constructor Description ExclusiveGroup(Collection<? extends ExclusiveTupleExpr> ownedNodes, StatementSource owner, QueryInfo queryInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBoundFilter(String varName, Value value)
register a filter that can be directly expressed as a binding, e.g.void
addFilterExpr(FilterExpr expr)
register a new filter expression.ExclusiveGroup
clone()
Returns a (deep) clone of this query model node.CloseableIteration<BindingSet,QueryEvaluationException>
evaluate(BindingSet bindings)
Evaluate this expression using the provided bindingsSet<String>
getAssuredBindingNames()
Gets the names of the bindings that are guaranteed to be present in the results produced by this tuple expression.Set<String>
getBindingNames()
Gets the names of the bindings that are, or can be, returned by this tuple expression when it is evaluated.BindingSet
getBoundFilters()
Returns bound filter bindings, that need to be added as additional bindings to the final resultList<ExclusiveTupleExpr>
getExclusiveExpressions()
FilterValueExpr
getFilterExpr()
int
getFreeVarCount()
List<String>
getFreeVars()
String
getId()
Endpoint
getOwnedEndpoint()
StatementSource
getOwner()
QueryInfo
getQueryInfo()
Retrieve the attached query information of the tuple expressionList<StatementSource>
getStatementSources()
boolean
hasFilter()
boolean
hasFreeVarsFor(BindingSet bindings)
returns true iff this statement has free variables in the presence of the specified binding setprotected void
init()
Initialize free variables<X extends Exception>
voidvisit(QueryModelVisitor<X> visitor)
Visits this node.<X extends Exception>
voidvisitChildren(QueryModelVisitor<X> visitor)
Dummy implementation ofQueryModelNode.visitChildren(org.eclipse.rdf4j.query.algebra.QueryModelVisitor<X>)
that does nothing.-
Methods inherited from class org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
getCardinality, getCostEstimate, getParentNode, getResultSizeActual, getResultSizeEstimate, getSignature, getTotalTimeNanosActual, isCardinalitySet, isGraphPatternGroup, isVariableScopeChange, nullEquals, replaceChildNode, replaceNodeInList, replaceWith, resetCardinality, setCardinality, setCostEstimate, setGraphPatternGroup, setParentNode, setResultSizeActual, setResultSizeEstimate, setTotalTimeNanosActual, setVariableScopeChange, shouldCacheCardinality, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.query.algebra.QueryModelNode
equals, getCostEstimate, getParentNode, getResultSizeActual, getResultSizeEstimate, getSignature, getTotalTimeNanosActual, replaceChildNode, replaceWith, setCostEstimate, setParentNode, setResultSizeActual, setResultSizeEstimate, setTotalTimeNanosActual, toString
-
-
-
-
Field Detail
-
owned
protected final List<ExclusiveTupleExpr> owned
-
owner
protected final StatementSource owner
-
id
protected final String id
-
queryInfo
protected final transient QueryInfo queryInfo
-
filterExpr
protected FilterValueExpr filterExpr
-
boundFilters
protected QueryBindingSet boundFilters
-
ownedEndpoint
protected transient Endpoint ownedEndpoint
-
-
Constructor Detail
-
ExclusiveGroup
public ExclusiveGroup(Collection<? extends ExclusiveTupleExpr> ownedNodes, StatementSource owner, QueryInfo queryInfo)
-
-
Method Detail
-
init
protected void init()
Initialize free variables
-
visitChildren
public <X extends Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from class:AbstractQueryModelNode
Dummy implementation ofQueryModelNode.visitChildren(org.eclipse.rdf4j.query.algebra.QueryModelVisitor<X>)
that does nothing. Subclasses should override this method when they have child nodes.- Specified by:
visitChildren
in interfaceQueryModelNode
- Overrides:
visitChildren
in classAbstractQueryModelNode
- Throws:
X extends Exception
-
visit
public <X extends Exception> void visit(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from interface:QueryModelNode
Visits this node. The node reports itself to the visitor with the proper runtime type.- Specified by:
visit
in interfaceQueryModelNode
- Throws:
X extends Exception
-
getAssuredBindingNames
public Set<String> getAssuredBindingNames()
Description copied from interface:TupleExpr
Gets the names of the bindings that are guaranteed to be present in the results produced by this tuple expression.- Specified by:
getAssuredBindingNames
in interfaceTupleExpr
- Returns:
- A set of binding names.
-
getBindingNames
public Set<String> getBindingNames()
Description copied from interface:TupleExpr
Gets the names of the bindings that are, or can be, returned by this tuple expression when it is evaluated.- Specified by:
getBindingNames
in interfaceTupleExpr
- Returns:
- A set of binding names.
-
clone
public ExclusiveGroup clone()
Description copied from interface:QueryModelNode
Returns a (deep) clone of this query model node. This method recursively clones the entire node tree, starting from this nodes.- Specified by:
clone
in interfaceQueryModelNode
- Specified by:
clone
in interfaceTupleExpr
- Overrides:
clone
in classAbstractQueryModelNode
- Returns:
- A deep clone of this query model node.
-
getOwner
public StatementSource getOwner()
- Specified by:
getOwner
in interfaceExclusiveTupleExpr
- Returns:
- the owner for this expression
-
getOwnedEndpoint
public Endpoint getOwnedEndpoint()
-
getExclusiveExpressions
public List<ExclusiveTupleExpr> getExclusiveExpressions()
-
getFreeVarCount
public int getFreeVarCount()
- Specified by:
getFreeVarCount
in interfaceFedXTupleExpr
- Returns:
- the number of free (i.e. unbound) variables in this expression
-
getFreeVars
public List<String> getFreeVars()
- Specified by:
getFreeVars
in interfaceFilterTuple
- Specified by:
getFreeVars
in interfaceVariableExpr
- Returns:
- a list of free (i.e. unbound) variables in this expression
-
getId
public String getId()
- Specified by:
getId
in interfaceStatementTupleExpr
- Returns:
- the id of this expr
-
getStatementSources
public List<StatementSource> getStatementSources()
- Specified by:
getStatementSources
in interfaceStatementTupleExpr
- Returns:
- a list of sources that are relevant for evaluation of this expression
-
hasFreeVarsFor
public boolean hasFreeVarsFor(BindingSet bindings)
Description copied from interface:StatementTupleExpr
returns true iff this statement has free variables in the presence of the specified binding set- Specified by:
hasFreeVarsFor
in interfaceStatementTupleExpr
- Returns:
- whether the statement has free vars
-
evaluate
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(BindingSet bindings) throws QueryEvaluationException
Description copied from interface:StatementTupleExpr
Evaluate this expression using the provided bindings- Specified by:
evaluate
in interfaceStatementTupleExpr
- Returns:
- the result iteration
- Throws:
QueryEvaluationException
-
addFilterExpr
public void addFilterExpr(FilterExpr expr)
Description copied from interface:FilterTuple
register a new filter expression. If the expr has already a filter registered, the new expression is added to aConjunctiveFilterExpr
.- Specified by:
addFilterExpr
in interfaceFilterTuple
-
getFilterExpr
public FilterValueExpr getFilterExpr()
- Specified by:
getFilterExpr
in interfaceFilterTuple
- Returns:
- the currently registered filter expressions, usually of type
FilterExpr
orConjunctiveFilterExpr
-
getBoundFilters
public BindingSet getBoundFilters()
Description copied from interface:FilterTuple
Returns bound filter bindings, that need to be added as additional bindings to the final result- Specified by:
getBoundFilters
in interfaceFilterTuple
- Returns:
- the bound filters, or
null
-
hasFilter
public boolean hasFilter()
- Specified by:
hasFilter
in interfaceFilterTuple
- Returns:
- true if this expression has a filter to apply
-
addBoundFilter
public void addBoundFilter(String varName, Value value)
Description copied from interface:FilterTuple
register a filter that can be directly expressed as a binding, e.g. SELECT * WHERE { ?s p o . FILTER (?s = X) } is equivalent to SELECT * WHERE { X p o . }- Specified by:
addBoundFilter
in interfaceFilterTuple
-
getQueryInfo
public QueryInfo getQueryInfo()
Description copied from interface:QueryRef
Retrieve the attached query information of the tuple expression- Specified by:
getQueryInfo
in interfaceQueryRef
- Returns:
- the
QueryInfo
-
-