| org.geotools.data.Query
All known Subclasses: org.geotools.data.FIDSQuery, org.geotools.data.ALLQuery, org.geotools.data.DefaultQuery,
Query | public interface Query (Code) | | Encapsulates a data request.
The query object is used by the FeatureSource.getFeatures(Query) to
encapsulate a request. For this use it the
FeatureSource.getSchema().getTypeName() should match the one provided by
the Query, or the Query should not provide one.
Suggested Extensions (Jody):
-
Transient CoordianteSystem override done getCoordianteSystem()
-
Transient Geometry reproject to an alternate CoordinateSystem - done
getCoordinateSystemReproject()
-
Consider Namespace, FeatueType name override - not done considered evil
-
DataStore.getFeatureReader( Query, Transaction )
-
DataStore.getView( Query ) - prototype in AbstractDataStore (not really
ready for primetime, see Expr)
author: Chris Holmes version: $Id: Query.java 26489 2007-08-08 15:36:02Z aaime $ |
Field Summary | |
final Query | ALL Implements a query that will fetch all features from a datasource. | final String[] | ALL_NAMES Ask for all properties when used with setPropertyNames. | final static int | DEFAULT_MAX So getMaxFeatures does not return null we use a very large number. | final Query | FIDS Implements a query that will fetch all the FeatureIDs from a datasource. | final String[] | NO_NAMES Ask for no properties when used with setPropertyNames. | final static URI | NO_NAMESPACE |
Method Summary | |
CoordinateReferenceSystem | getCoordinateSystem() Specifies the coordinate system that the features being queried are in.
This denotes a request to Temporarily to override the coordinate system
contained in the FeatureSource being queried. | CoordinateReferenceSystem | getCoordinateSystemReproject() Request data reprojection. | Filter | getFilter() The Filter can be used to define constraints on a query. | String | getHandle() The handle attribute is included to allow a client to associate a
mnemonic name to the Query request. | Hints | getHints() Specifies some hints to drive the query execution and results build-up. | int | getMaxFeatures() The optional maxFeatures can be used to limit the number of features
that a query request retrieves. | URI | getNamespace() The namespace attribute is used to indicate the namespace of the schema
being represented. | String[] | getPropertyNames() The properties array is used to specify the attributes that should be
selected for the return feature collection.
-
ALL_NAMES:
null
If no properties are specified (getProperties returns ALL_NAMES or
null) then the full schema should be used (all attributes).
-
NO_NAMES:
new String[0]
If getProperties returns an array of size 0, then the datasource should
return features with no attributes, only their ids.
The available properties can be determined with a getSchema call from
the DataSource interface. | SortBy[] | getSortBy() SortBy results according to indicated property and order.
SortBy is part of the Filter 1.1 specification, it is referenced
by WFS1.1 and Catalog 2.0.x specifications and is used to organize
results.
The SortBy's are ment to be applied in order:
- SortBy( year, ascending )
- SortBy( month, decsending )
Would produce something like:
[year=2002 month=4],[year=2002 month=3],[year=2002 month=2],
[year=2002 month=1],[year=2003 month=12],[year=2002 month=4],
SortBy should be considered at the same level of abstraction as Filter,
and like Filter you may sort using properties not listed in
getPropertyNames.
At a technical level the interface SortBy2 is used to indicate the
additional requirements of a GeoTools implementation. | String | getTypeName() The typeName attribute is used to indicate the name of the feature type
to be queried. | String | getVersion() From WFS Spec: The version attribute is included in order to
accommodate systems that support feature versioning. | boolean | retrieveAllProperties() Convenience method to determine if the query should use the full schema
(all properties) of the data source for the features returned. |
ALL | final Query ALL(Code) | | Implements a query that will fetch all features from a datasource. This
query should retrieve all properties, with no maxFeatures, no
filtering, and the default featureType.
|
ALL_NAMES | final String[] ALL_NAMES(Code) | | Ask for all properties when used with setPropertyNames.
|
DEFAULT_MAX | final static int DEFAULT_MAX(Code) | | So getMaxFeatures does not return null we use a very large number.
|
FIDS | final Query FIDS(Code) | | Implements a query that will fetch all the FeatureIDs from a datasource.
This query should retrive no properties, with no maxFeatures, no
filtering, and the a featureType with no attribtues.
|
NO_NAMES | final String[] NO_NAMES(Code) | | Ask for no properties when used with setPropertyNames.
Note the query will still return a result - limited to FeatureIDs.
|
NO_NAMESPACE | final static URI NO_NAMESPACE(Code) | | TODO: should this be ANY_URI
|
getCoordinateSystem | CoordinateReferenceSystem getCoordinateSystem()(Code) | | Specifies the coordinate system that the features being queried are in.
This denotes a request to Temporarily to override the coordinate system
contained in the FeatureSource being queried. The same coordinate
values will be used, but the features created will appear in this
Coordinate System.
This change is not persistant at all, indeed it is only for the Features
returned by this Query. If used in conjunction with
Query.getCoordinateSystemReproject() the reprojection will occur from
Query.getCoordinateSystem() to
Query.getCoordinateSystemReproject() .
The coordinate system to be returned for Features from thisQuery (override the set coordinate system). |
getCoordinateSystemReproject | CoordinateReferenceSystem getCoordinateSystemReproject()(Code) | | Request data reprojection.
Gets the coordinate System to reproject the data contained in the
backend datastore to.
If the DataStore can optimize the reprojection it should, if not then a
decorator on the reader should perform the reprojection on the fly.
If the datastore has the wrong CS then
Query.getCoordinateSystem() should be set to
the CS to be used, this will perform the reprojection on that.
The coordinate system that Features from the datasource shouldbe reprojected to. |
getFilter | Filter getFilter()(Code) | | The Filter can be used to define constraints on a query. If no Filter
is present then the query is unconstrained and all feature instances
should be retrieved.
The filter that defines constraints on the query. |
getHandle | String getHandle()(Code) | | The handle attribute is included to allow a client to associate a
mnemonic name to the Query request. The purpose of the handle attribute
is to provide an error handling mechanism for locating a statement
that might fail.
the mnemonic name of the query request. |
getHints | Hints getHints()(Code) | | Specifies some hints to drive the query execution and results build-up.
Hints examples can be the GeometryFactory to be used, a generalization
distance to be applied right in the data store, to data store specific
things such as the fetch size to be used in JDBC queries.
The set of hints supported can be fetched by calling
.
Depending on the actual values of the hints, the data store is free to ignore them.
No mechanism is in place, at the moment, to figure out which hints where
actually used during the query execution.
the Hints the data store should try to use when executing the query(eventually empty but never null). |
getMaxFeatures | int getMaxFeatures()(Code) | | The optional maxFeatures can be used to limit the number of features
that a query request retrieves. If no maxFeatures is specified then
all features should be returned.
This is the only method that is not directly out of the Query element in
the WFS spec. It is instead a part of a GetFeature request, which can
hold one or more queries. But each of those in turn will need a
maxFeatures, so it is needed here.
the max features the getFeature call should return. |
getNamespace | URI getNamespace()(Code) | | The namespace attribute is used to indicate the namespace of the schema
being represented.
the gml namespace of the feature type to be returned with thisquery |
getPropertyNames | String[] getPropertyNames()(Code) | | The properties array is used to specify the attributes that should be
selected for the return feature collection.
-
ALL_NAMES:
null
If no properties are specified (getProperties returns ALL_NAMES or
null) then the full schema should be used (all attributes).
-
NO_NAMES:
new String[0]
If getProperties returns an array of size 0, then the datasource should
return features with no attributes, only their ids.
The available properties can be determined with a getSchema call from
the DataSource interface. A datasource can use
Query.retrieveAllProperties() as a shortcut to determine if all its
available properties should be returned (same as checking to see if
getProperties is ALL_NAMES, but clearer)
If properties that are not part of the datasource's schema are requested
then the datasource shall throw an exception.
This replaces our funky setSchema method of retrieving select
properties. It makes it easier to understand how to get certain
properties out of the datasource, instead of having users get the
schema and then compose a new schema using the attributes that they
want. The old way had problems because one couldn't have multiple
object reuse the same datasource object, since some other object could
come along and change its schema, and would then return the wrong
properties.
the attributes to be used in the returned FeatureCollection. |
getSortBy | SortBy[] getSortBy()(Code) | | SortBy results according to indicated property and order.
SortBy is part of the Filter 1.1 specification, it is referenced
by WFS1.1 and Catalog 2.0.x specifications and is used to organize
results.
The SortBy's are ment to be applied in order:
- SortBy( year, ascending )
- SortBy( month, decsending )
Would produce something like:
[year=2002 month=4],[year=2002 month=3],[year=2002 month=2],
[year=2002 month=1],[year=2003 month=12],[year=2002 month=4],
SortBy should be considered at the same level of abstraction as Filter,
and like Filter you may sort using properties not listed in
getPropertyNames.
At a technical level the interface SortBy2 is used to indicate the
additional requirements of a GeoTools implementation. The pure
WFS 1.1 specification itself is limited to SortBy.
SortBy array or order of application |
getTypeName | String getTypeName()(Code) | | The typeName attribute is used to indicate the name of the feature type
to be queried. If no typename is specified, then the default typeName
should be returned from the dataStore. If the datasstore only supports
one feature type then this part of the query may be ignored.
the name of the feature type to be returned with this query. |
getVersion | String getVersion()(Code) | | From WFS Spec: The version attribute is included in order to
accommodate systems that support feature versioning. A value of ALL
indicates that all versions of a feature should be fetched. Otherwise
an integer, n, can be specified to return the n th version of a
feature. The version numbers start at '1' which is the oldest version.
If a version value larger than the largest version is specified then
the latest version is return. The default action shall be for the query
to return the latest version. Systems that do not support versioning
can ignore the parameter and return the only version that they have.
the version of the feature to return, or null for latest. |
retrieveAllProperties | boolean retrieveAllProperties()(Code) | | Convenience method to determine if the query should use the full schema
(all properties) of the data source for the features returned. This
method is equivalent to if (query.getProperties() == null), but allows
for more clarity on the part of datasource implementors, so they do not
need to examine and use null values. All Query implementations should
return true for this function if getProperties returns null.
if all datasource attributes should be included in the schema ofthe returned FeatureCollection. |
|
|