Interface GraphPattern
-
- All Superinterfaces:
QueryElement
- All Known Subinterfaces:
TriplePattern
- All Known Implementing Classes:
Bind,GraphPatternNotTriples,SubSelect
public interface GraphPattern extends QueryElement
Denotes a SPARQL Graph Pattern- See Also:
- SPARQL Graph Patterns
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default GraphPatternand(GraphPattern... patterns)Convert this graph pattern into a group graph pattern, combining this graph pattern with the given patterns:default GraphPatternfilter(Expression<?> constraint)Convert this graph pattern into a group graph pattern and add a filter:default GraphPatternfilterExists(boolean exists, GraphPattern... patterns)Create anEXISTSorNOT EXISTSfilter expression with the given patterns based on theexistsparamater and add it to this graph pattern (converting this to a group graph pattern in the process)default GraphPatternfilterExists(GraphPattern... patterns)Create anEXISTS{}filter expression with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):default GraphPatternfilterNotExists(GraphPattern... patterns)Create aNOT EXISTS{}filter expression with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):default GraphPatternfrom(GraphName name)Convert this graph pattern into a named group graph pattern:default booleanisEmpty()default GraphPatternminus(GraphPattern... patterns)Create aMINUSgraph pattern with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):default GraphPatternoptional()Convert this graph pattern into an optional group graph pattern:default GraphPatternoptional(boolean isOptional)Specify if this graph pattern should be optional.default GraphPatternunion(GraphPattern... patterns)Convert this graph pattern into an alternative graph pattern, combining this graph pattern with the given patterns:-
Methods inherited from interface org.eclipse.rdf4j.sparqlbuilder.core.QueryElement
getQueryString
-
-
-
-
Method Detail
-
and
default GraphPattern and(GraphPattern... patterns)
Convert this graph pattern into a group graph pattern, combining this graph pattern with the given patterns:
{ thisPattern . pattern1 . pattern2 . ... patternN }- Parameters:
patterns- the patterns to add- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL Group Graph Pattern
-
union
default GraphPattern union(GraphPattern... patterns)
Convert this graph pattern into an alternative graph pattern, combining this graph pattern with the given patterns:
{ { thisPattern } UNION { pattern1 } UNION { pattern2 } UNION ... { patternN } }- Parameters:
patterns- the patterns to add- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL Alternative Graph Pattern
-
optional
default GraphPattern optional()
Convert this graph pattern into an optional group graph pattern:
OPTIONAL {thisPattern}- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL Optional Graph Patterns
-
optional
default GraphPattern optional(boolean isOptional)
Specify if this graph pattern should be optional.NOTE: This converts this graph pattern into a group graph pattern.
- Parameters:
isOptional- if this graph pattern should be optional or not- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL Optional Graph Patterns
-
filter
default GraphPattern filter(Expression<?> constraint)
Convert this graph pattern into a group graph pattern and add a filter:
{ thisPattern FILTER { constraint } }- Parameters:
constraint- the filter constraint- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL Filter
-
filterExists
default GraphPattern filterExists(GraphPattern... patterns)
Create anEXISTS{}filter expression with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):
{ thisPattern FILTER EXISTS { patterns } }- Parameters:
patterns- the patterns to pass as arguments to theEXISTSexpression- Returns:
- the new
GraphPatterninstance - See Also:
- Filtering using Graph Pattern
-
filterNotExists
default GraphPattern filterNotExists(GraphPattern... patterns)
Create aNOT EXISTS{}filter expression with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):
{ thisPattern FILTER NOT EXISTS { patterns } }- Parameters:
patterns- the patterns to pass as arguments to theNOT EXISTSexpression- Returns:
- the new
GraphPatterninstance - See Also:
- Filtering using Graph Pattern
-
filterExists
default GraphPattern filterExists(boolean exists, GraphPattern... patterns)
Create anEXISTSorNOT EXISTSfilter expression with the given patterns based on theexistsparamater and add it to this graph pattern (converting this to a group graph pattern in the process)- Parameters:
exists- if the filter should ensure the patterns exist or notpatterns- the patterns to pass to the filter- Returns:
- the new
GraphPatterninstance
-
minus
default GraphPattern minus(GraphPattern... patterns)
Create aMINUSgraph pattern with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):
{ thisPattern MINUS { patterns } }- Parameters:
patterns- the patterns to construct theMINUSgraph pattern with- Returns:
- the new
GraphPatterninstance - See Also:
- SPARQL MINUS Graph Pattern
-
from
default GraphPattern from(GraphName name)
Convert this graph pattern into a named group graph pattern:
GRAPH graphName { thisPattern }- Parameters:
name- the name to specify- Returns:
- the new
GraphPatterninstance - See Also:
- Specifying Datasets in SPARQL Queries
-
isEmpty
default boolean isEmpty()
- Returns:
- if this pattern is a collection of GraphPatterns (ie., Group or Alternative patterns), returns if the collection contains any patterns
-
-