Class GraphPattern
- java.lang.Object
-
- org.eclipse.rdf4j.query.parser.sparql.GraphPattern
-
@InternalUseOnly public class GraphPattern extends Object
A graph pattern consisting of (required and optional) tuple expressions, binding assignments and boolean constraints.- Author:
- Arjohn Kampman
-
-
Constructor Summary
Constructors Constructor Description GraphPattern()
Creates a new graph pattern.GraphPattern(GraphPattern parent)
Creates a new graph pattern that inherits the context and scope from a parent graph pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConstraint(ValueExpr constraint)
void
addConstraints(Collection<ValueExpr> constraints)
void
addOptionalTE(TupleExpr te, List<ValueExpr> constraints)
add the supplied tuple expression as an optional expression, with a list of constraints that hold as conditions.void
addRequiredSP(Var subjVar, Var predVar, Var objVar)
void
addRequiredTE(TupleExpr te)
TupleExpr
buildTupleExpr()
Builds a combined tuple expression from the tuple expressions and constraints in this graph pattern.void
clear()
Removes all tuple expressions and constraints.List<ValueExpr>
getConstraints()
Var
getContextVar()
List<Map.Entry<TupleExpr,List<ValueExpr>>>
getOptionalTEs()
Retrieves the optional tuple expressions as a list of tuples with the tuple expression as the key and the list of value expressions as the value.List<TupleExpr>
getRequiredTEs()
StatementPattern.Scope
getStatementPatternScope()
List<ValueExpr>
removeAllConstraints()
void
setContextVar(Var contextVar)
void
setStatementPatternScope(StatementPattern.Scope spScope)
-
-
-
Constructor Detail
-
GraphPattern
public GraphPattern()
Creates a new graph pattern.
-
GraphPattern
public GraphPattern(GraphPattern parent)
Creates a new graph pattern that inherits the context and scope from a parent graph pattern.
-
-
Method Detail
-
setContextVar
public void setContextVar(Var contextVar)
-
getContextVar
public Var getContextVar()
-
setStatementPatternScope
public void setStatementPatternScope(StatementPattern.Scope spScope)
-
getStatementPatternScope
public StatementPattern.Scope getStatementPatternScope()
-
addRequiredTE
public void addRequiredTE(TupleExpr te)
-
addOptionalTE
public void addOptionalTE(TupleExpr te, List<ValueExpr> constraints)
add the supplied tuple expression as an optional expression, with a list of constraints that hold as conditions.- Parameters:
te
- a tuple expressionconstraints
- a list of constraints that form a condition for the LeftJoin to be formed from the optional TE.
-
getOptionalTEs
public List<Map.Entry<TupleExpr,List<ValueExpr>>> getOptionalTEs()
Retrieves the optional tuple expressions as a list of tuples with the tuple expression as the key and the list of value expressions as the value.- Returns:
- a list of Map entries.
-
addConstraint
public void addConstraint(ValueExpr constraint)
-
addConstraints
public void addConstraints(Collection<ValueExpr> constraints)
-
clear
public void clear()
Removes all tuple expressions and constraints.
-
buildTupleExpr
public TupleExpr buildTupleExpr()
Builds a combined tuple expression from the tuple expressions and constraints in this graph pattern.- Returns:
- A tuple expression for this graph pattern.
-
-