Package org.eclipse.rdf4j.sparqlbuilder.graphpattern

## Class SubSelect

- java.lang.Object
- - org.eclipse.rdf4j.sparqlbuilder.core.query.Query<SubSelect>
  - - org.eclipse.rdf4j.sparqlbuilder.graphpattern.SubSelect

- All Implemented Interfaces:
    `QueryElement`, `GraphPattern`

      public class SubSelect
      extends Query<SubSelect>
      implements GraphPattern

  A SPARQL subquery
  See Also:
    SPARQL Subquery

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.sparqlbuilder.core.query.Query

      `bnodeCount, from, groupBy, having, limit, LIMIT, offset, OFFSET, orderBy, varCount, where`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SubSelect()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `SubSelect` | `all()` | Specify that this query's projection should select all in-scope expressions
    `SubSelect` | `all​(boolean selectAll)` | Specify if this query's projection should select all in-scope expressions or not.
    `SubSelect` | `distinct()` | Specify the query's projection to be distinct
    `SubSelect` | `distinct​(boolean isDistinct)` | Specify if the query's projection should be distinct or not
    `protected String` | `getQueryActionString()` |
    `String` | `getQueryString()` |
    `boolean` | `isEmpty()` |
    `SubSelect` | `select​(Projectable... projectables)` | Add expressions to the query's projection
    `SubSelect` | `select​(Projection select)` | Set this query's projection

    - ### Methods inherited from class org.eclipse.rdf4j.sparqlbuilder.core.query.Query

      `bNode, from, from, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, var, where, where`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.sparqlbuilder.graphpattern.GraphPattern

      `and, filter, filterExists, filterExists, filterNotExists, from, minus, optional, optional, union`

- - ### Constructor Detail

    - #### SubSelect

          public SubSelect()

  - ### Method Detail

    - #### distinct

          public SubSelect distinct()

      Specify the query's projection to be distinct
      Returns:
        this
      See Also:
        `Projection.distinct()`

    - #### distinct

          public SubSelect distinct​(boolean isDistinct)

      Specify if the query's projection should be distinct or not
      Parameters:
        `isDistinct` - if this query's projection should be distinct
      Returns:
        this
      See Also:
        `Projection.distinct(boolean)`

    - #### all

          public SubSelect all()

      Specify that this query's projection should select all in-scope expressions

      NOTE: setting this takes precedence over any expressions added to the projection via `select(Projectable...)` when printing

      Returns:
        this
      See Also:
        `Projection.all()`

    - #### all

          public SubSelect all​(boolean selectAll)

      Specify if this query's projection should select all in-scope expressions or not.

      NOTE: if called with `true`, this setting will take precedence over any expressions added to the projection via `select(Projectable...)` when printing

      Parameters:
        `selectAll` - if all in-scope expressions should be selected
      Returns:
        this
      See Also:
        `Projection.all(boolean)`

    - #### select

          public SubSelect select​(Projectable... projectables)

      Add expressions to the query's projection

      NOTE: if SELECT * has been specified (by `all()` or calling `all(boolean)` with `true`), that will take precedence over specified expressions when converting to string via `getQueryString()`

      Parameters:
        `projectables` - expressions to add
      Returns:
        this
      See Also:
        `Projection.select(Projectable...)`

    - #### select

          public SubSelect select​(Projection select)

      Set this query's projection
      Parameters:
        `select` - the `Projection` to set
      Returns:
        this

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `GraphPattern`
      Returns:
        if this pattern is a collection of GraphPatterns (ie., Group or Alternative patterns), returns if the collection contains any patterns

    - #### getQueryActionString

          protected String getQueryActionString()

      Specified by:
        `getQueryActionString` in class `Query<SubSelect>`

    - #### getQueryString

          public String getQueryString()

      Specified by:
        `getQueryString` in interface `QueryElement`
      Overrides:
        `getQueryString` in class `Query<SubSelect>`
      Returns:
        the String representing the SPARQL syntax of this element