Class GraphPattern
java.lang.Object
org.eclipse.rdf4j.query.parser.sparql.GraphPattern
A graph pattern consisting of (required and optional) tuple expressions, binding assignments and boolean constraints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe boolean constraints in this graph pattern.private Var
The context of this graph pattern.The optional tuple expressions in this graph pattern, as a list of Key-Value pairs with the tuple expression as the key and a list of constraints applicable to the tuple expression as the value.The required tuple expressions in this graph pattern.private StatementPattern.Scope
The StatementPattern-scope of this graph pattern. -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionvoid
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
(package private) TupleExpr
Build a single tuple expression representing _only_ the basic graph pattern, by joining the required TEsbuildOptionalTE
(TupleExpr result) Build optionals to the supplied TEBuilds a combined tuple expression from the tuple expressions and constraints in this graph pattern.void
clear()
Removes all tuple expressions and constraints.(package private) void
Remove all values for required tuple expressions in thisGraphPattern
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.void
setContextVar
(Var contextVar) void
-
Field Details
-
contextVar
The context of this graph pattern. -
spScope
The StatementPattern-scope of this graph pattern. -
requiredTEs
The required tuple expressions in this graph pattern. -
optionalTEs
The optional tuple expressions in this graph pattern, as a list of Key-Value pairs with the tuple expression as the key and a list of constraints applicable to the tuple expression as the value. -
constraints
The boolean constraints in this graph pattern.
-
-
Constructor Details
-
GraphPattern
public GraphPattern()Creates a new graph pattern. -
GraphPattern
Creates a new graph pattern that inherits the context and scope from a parent graph pattern.
-
-
Method Details
-
setContextVar
-
getContextVar
-
setStatementPatternScope
-
getStatementPatternScope
-
addRequiredTE
-
clearRequiredTEs
void clearRequiredTEs()Remove all values for required tuple expressions in thisGraphPattern
-
addRequiredSP
-
getRequiredTEs
-
addOptionalTE
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
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
-
addConstraints
-
getConstraints
-
removeAllConstraints
-
clear
public void clear()Removes all tuple expressions and constraints. -
buildTupleExpr
Builds a combined tuple expression from the tuple expressions and constraints in this graph pattern.- Returns:
- A tuple expression for this graph pattern.
-
buildOptionalTE
Build optionals to the supplied TE -
buildJoinFromRequiredTEs
TupleExpr buildJoinFromRequiredTEs()Build a single tuple expression representing _only_ the basic graph pattern, by joining the required TEs
-