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:
  • Method Summary

    Modifier and Type
    Method
    Description
    default GraphPattern
    and(GraphPattern... patterns)
    Convert this graph pattern into a group graph pattern, combining this graph pattern with the given patterns:
    default GraphPattern
    filter(Expression<?> constraint)
    Convert this graph pattern into a group graph pattern and add a filter:
    default GraphPattern
    filterExists(boolean exists, GraphPattern... patterns)
    Create an EXISTS or NOT EXISTS filter expression with the given patterns based on the exists paramater and add it to this graph pattern (converting this to a group graph pattern in the process)
    default GraphPattern
    Create an 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 GraphPattern
    Create a NOT 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 GraphPattern
    Convert this graph pattern into a named group graph pattern:
    default boolean
     
    default GraphPattern
    minus(GraphPattern... patterns)
    Create a MINUS graph pattern with the given graph patterns and add it to this graph pattern (converting this to a group graph pattern in the process):
    default GraphPattern
    Convert this graph pattern into an optional group graph pattern:
    default GraphPattern
    optional(boolean isOptional)
    Specify if this graph pattern should be optional.
    default GraphPattern
    union(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 Details

    • 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 GraphPattern instance
      See Also:
    • 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 GraphPattern instance
      See Also:
    • optional

      default GraphPattern optional()
      Convert this graph pattern into an optional group graph pattern:
       OPTIONAL {thisPattern}
       
      Returns:
      the new GraphPattern instance
      See Also:
    • 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 GraphPattern instance
      See Also:
    • 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 GraphPattern instance
      See Also:
    • filterExists

      default GraphPattern filterExists(GraphPattern... patterns)
      Create an 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 EXISTS { patterns }
       }
       
      Parameters:
      patterns - the patterns to pass as arguments to the EXISTS expression
      Returns:
      the new GraphPattern instance
      See Also:
    • filterNotExists

      default GraphPattern filterNotExists(GraphPattern... patterns)
      Create a NOT 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 the NOT EXISTS expression
      Returns:
      the new GraphPattern instance
      See Also:
    • filterExists

      default GraphPattern filterExists(boolean exists, GraphPattern... patterns)
      Create an EXISTS or NOT EXISTS filter expression with the given patterns based on the exists paramater 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 not
      patterns - the patterns to pass to the filter
      Returns:
      the new GraphPattern instance
    • minus

      default GraphPattern minus(GraphPattern... patterns)
      Create a MINUS graph 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 the MINUS graph pattern with
      Returns:
      the new GraphPattern instance
      See Also:
    • 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 GraphPattern instance
      See Also:
    • 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