Package org.eclipse.rdf4j.sparqlbuilder.graphpattern

## 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 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` | `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):
    `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):
    `default GraphPattern` | `from​(GraphName name)` | Convert this graph pattern into a named group graph pattern:
    `default boolean` | `isEmpty()` |
    `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` | `optional()` | 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 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 `GraphPattern` instance
      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 `GraphPattern` instance
      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 `GraphPattern` instance
      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 `GraphPattern` instance
      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 `GraphPattern` instance
      See Also:
        SPARQL Filter

    - #### 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:
        Filtering using Graph Pattern

    - #### 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:
        Filtering using Graph Pattern

    - #### 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:
        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 `GraphPattern` instance
      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