Module org.apache.sis.storage
Package org.apache.sis.storage

# Class Query

Object
Query

Direct Known Subclasses:
  `CoverageQuery`, `FeatureQuery`

public abstract class Query extends Object
Definition of filtering to apply for fetching a resource subset. Filtering can be applied on `FeatureSet` or on `GridCoverageResource`. A query contains at least two parts:

- Selection for choosing the feature instances to fetch. This is equivalent to choosing rows in a database table.
- Projection (not to be confused with map projection) for choosing the feature properties or the coverage sample dimensions to fetch. This is equivalent to choosing columns in a database table.

Compared to the SQL language, `Query` contains the information in the `SELECT` and `WHERE` clauses of a SQL statement. A `Query` typically contains filtering capabilities and (sometimes) simple attribute transformations. Well known query languages include SQL and CQL.

## Optional values

All aspects of this query are optional and initialized to "none". Unless otherwise specified, all methods accept a null argument or can return a null value, which means "none".

Since:
  0.8
See Also:
  - `FeatureSet​.subset(Query)`
  - `GridCoverageResource​.subset(Query)`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Query()`
  Creates a new, initially empty, query.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract void`
  `setProjection(String... properties)`
  Sets the properties to retrieve by their names.
  `abstract void`
  `setSelection(Envelope domain)`
  Sets the approximate area of feature instances or pixels to include in the subset.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Query

    protected Query()
    Creates a new, initially empty, query.

- ## Method Details

  - ### setSelection

    public abstract void setSelection(Envelope domain)
    Sets the approximate area of feature instances or pixels to include in the subset. For feature set, the domain is materialized by a `Filter`. For grid coverage resource, the given envelope specifies the coverage domain.

    The given envelope is approximate. Features may test intersections using only bounding boxes instead of full geometries. Coverages may expand the envelope to an integer amount of tiles.

    Parameters:
      `domain` - the approximate area of interest, or `null` if none.
    Since:
      1.1

  - ### setProjection

    public abstract void setProjection(String... properties)
    Sets the properties to retrieve by their names. For features, the arguments are names of feature properties. For coverages, the arguments are names of sample dimensions.

    Note: in this context, the "projection" word come from relational database terminology. It is unrelated to map projection.

    Parameters:
      `properties` - properties to retrieve, or `null` to retrieve all properties.
    Throws:
      `IllegalArgumentException` - if a property is duplicated.
    Since:
      1.1