deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.ogcwebservices.wfs.operation
Class Query

java.lang.Object
  extended by org.deegree.ogcwebservices.wfs.operation.Query

public class Query
extends java.lang.Object

Represents a Query operation as a part of a GetFeature request. Each individual query packaged in a GetFeature request is defined using the query value. The query value defines which feature type to query, what properties to retrieve and what constraints (spatial and non-spatial) to apply to those properties.

The mandatory typeName attribute is used to indicate the name of one or more feature type instances or class instances to be queried. Its value is a list of namespace-qualified names (XML Schema type QName, e.g. myns:School) whose value must match one of the feature types advertised in the Capabilities document of the WFS. Specifying more than one typename indicates that a join operation is being performed. All the names in the typeName list must be valid types that belong to this query's feature content as defined by the GML Application Schema. Optionally, individual feature type names in the typeName list may be aliased using the format QName=Alias. The following is an example typeName value that indicates that a join operation is to be performed and includes aliases:
typeName="ns1:InwaterA_1m=A,ns1:InwaterA_1m=B,ns2:CoastL_1M=C"
This example encodes a join between three feature types aliased as A, B and C. The join between feature type A and B is a self-join.

Version:
$Revision: 24605 $, $Date: 2010-05-27 13:24:00 +0200 (Do, 27 Mai 2010) $
Author:
Andreas Poth , Markus Schneider , last edited by: $Author: aschmitz $

Constructor Summary
Query(PropertyPath[] propertyNames, Function[] functions, SortProperty[] sortProperties, java.lang.String handle, java.lang.String featureVersion, QualifiedName[] typeNames, java.lang.String[] aliases, java.lang.String srsName, Filter filter, GetFeature.RESULT_TYPE resultType, int maxFeatures, int startPosition)
          Creates a new Query instance.
Query(PropertyPath[] propertyNames, Function[] functions, SortProperty[] sortProperties, java.lang.String handle, java.lang.String featureVersion, QualifiedName[] typeNames, java.lang.String[] aliases, java.lang.String srsName, Filter filter, GetFeature.RESULT_TYPE resultType, int maxFeatures, int startPosition, GetFeatureDocument.BBoxTest test)
           
 
Method Summary
static Query create(org.w3c.dom.Element element)
          Creates a Query instance from a document that contains the DOM representation of the request, using the 1.1.0 filter encoding.
static Query create(org.w3c.dom.Element element, boolean useVersion_1_0_0)
          Creates a Query instance from a document that contains the DOM representation of the request.
static Query create(PropertyPath[] propertyNames, Function[] functions, SortProperty[] sortProperties, java.lang.String handle, java.lang.String featureVersion, QualifiedName[] typeNames, java.lang.String[] aliases, java.lang.String srsName, Filter filter, int maxFeatures, int startPosition, GetFeature.RESULT_TYPE resultType)
          Creates a new Query instance.
static Query create(PropertyPath[] propertyNames, Function[] functions, SortProperty[] sortProperties, java.lang.String handle, java.lang.String featureVersion, QualifiedName[] typeNames, java.lang.String srsName, Filter filter, int maxFeatures, int startPosition, GetFeature.RESULT_TYPE resultType)
          Deprecated. use create(PropertyPath[], Function[], SortProperty[], String, String, QualifiedName[], String[], String, Filter, int, int, RESULT_TYPE) instead
static Query create(QualifiedName typeName)
          Creates a new simple Query instance that selects the whole feature type.
static Query create(QualifiedName typeName, Filter filter)
          Creates a new simple Query instance that selects the whole feature type.
 void deleteBBoxTest()
          Sets the test to null, thus enabling the gc.
 java.lang.String[] getAliases()
          Returns the aliases for the requested feature types.
 java.lang.String getFeatureVersion()
          Returns the featureVersion attribute.
 Filter getFilter()
          Returns the filter that limits the query.
 Function[] getFunctions()
          Beside property names a query may contains 0 to n functions modifying the values of one or more original properties.
 java.lang.String getHandle()
          Returns the handle attribute.
 int getMaxFeatures()
          Returns the value of the maxFeatures attribute ("inherited" from the GetFeature container).
 PropertyPath[] getPropertyNames()
          Returns all requested properties.
 GetFeature.RESULT_TYPE getResultType()
          Returns the value of the resultType attribute ("inherited" from the GetFeature container).
 SortProperty[] getSortProperties()
          Returns the sort criteria for the result.
 java.lang.String getSrsName()
          Returns the srsName attribute.
 int getStartPosition()
          Returns the value of the startPosition attribute ("inherited" from the GetFeature container).
 QualifiedName[] getTypeNames()
          Returns the names of the requested feature types.
 void guessAllMissingNamespaces(WFService wfs)
          Adds missing namespaces to requested feature type names, property names, filter properties and sort properties.
 void guessMissingTypeNameNamespace(WFService wfs)
          Adds missing namespaces in the names of requested feature types.
 void performBBoxTest()
           
 void setMaxFeatures(int maxFeatures)
           
 void setSrsName(java.lang.String srsName)
          Sets the srsName attribute to given value.
 void setStartPosition(int startPosition)
           
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query(PropertyPath[] propertyNames,
             Function[] functions,
             SortProperty[] sortProperties,
             java.lang.String handle,
             java.lang.String featureVersion,
             QualifiedName[] typeNames,
             java.lang.String[] aliases,
             java.lang.String srsName,
             Filter filter,
             GetFeature.RESULT_TYPE resultType,
             int maxFeatures,
             int startPosition,
             GetFeatureDocument.BBoxTest test)
Parameters:
propertyNames -
functions -
sortProperties -
handle -
featureVersion -
typeNames -
aliases -
srsName -
filter -
resultType -
maxFeatures -
startPosition -
test -

Query

public Query(PropertyPath[] propertyNames,
             Function[] functions,
             SortProperty[] sortProperties,
             java.lang.String handle,
             java.lang.String featureVersion,
             QualifiedName[] typeNames,
             java.lang.String[] aliases,
             java.lang.String srsName,
             Filter filter,
             GetFeature.RESULT_TYPE resultType,
             int maxFeatures,
             int startPosition)
Creates a new Query instance.

Parameters:
propertyNames - names of the requested properties, may be null or empty
functions - names of the requested functions, may be null or empty
sortProperties - sort criteria, may be null or empty
handle - client-generated identifier for the query, may be null
featureVersion - version of the feature instances to fetched, may be null
typeNames - list of requested feature types
aliases - list of aliases for the feature types, must either be null or have the same length as the typeNames array
srsName - name of the spatial reference system
filter - spatial and none-spatial constraints
resultType - deegree specific extension ("inherited" from GetFeature container)
maxFeatures - deegree specific extension ("inherited" from GetFeature container)
startPosition - deegree specific extension ("inherited" from GetFeature container)
Method Detail

create

@Deprecated
public static Query create(PropertyPath[] propertyNames,
                                      Function[] functions,
                                      SortProperty[] sortProperties,
                                      java.lang.String handle,
                                      java.lang.String featureVersion,
                                      QualifiedName[] typeNames,
                                      java.lang.String srsName,
                                      Filter filter,
                                      int maxFeatures,
                                      int startPosition,
                                      GetFeature.RESULT_TYPE resultType)
Deprecated. use create(PropertyPath[], Function[], SortProperty[], String, String, QualifiedName[], String[], String, Filter, int, int, RESULT_TYPE) instead

Creates a new Query instance.

Parameters:
propertyNames - names of the requested properties, may be null or empty
functions - names of the requested functions, may be null or empty
sortProperties - sort criteria, may be null or empty
handle - client-generated identifier for the query, may be null
featureVersion - version of the feature instances to fetched, may be null
typeNames - list of requested feature types. if more than one feature types is set a JOIN will be created (not yet supported)
srsName - name of the spatial reference system
filter - spatial and none-spatial constraints
resultType - deegree specific extension ("inherited" from GetFeature container)
maxFeatures - deegree specific extension ("inherited" from GetFeature container)
startPosition - deegree specific extension ("inherited" from GetFeature container)
Returns:
new Query instance

create

public static Query create(PropertyPath[] propertyNames,
                           Function[] functions,
                           SortProperty[] sortProperties,
                           java.lang.String handle,
                           java.lang.String featureVersion,
                           QualifiedName[] typeNames,
                           java.lang.String[] aliases,
                           java.lang.String srsName,
                           Filter filter,
                           int maxFeatures,
                           int startPosition,
                           GetFeature.RESULT_TYPE resultType)
Creates a new Query instance.

Parameters:
propertyNames - names of the requested properties, may be null or empty
functions - names of the requested functions, may be null or empty
sortProperties - sort criteria, may be null or empty
handle - client-generated identifier for the query, may be null
featureVersion - version of the feature instances to fetched, may be null
typeNames - list of requested feature types. if more than one feature types is set a JOIN will be created (not yet supported)
aliases - list of aliases for the feature types, must either be null or have the same length as the typeNames array
srsName - name of the spatial reference system
filter - spatial and none-spatial constraints
resultType - deegree specific extension ("inherited" from GetFeature container)
maxFeatures - deegree specific extension ("inherited" from GetFeature container)
startPosition - deegree specific extension ("inherited" from GetFeature container)
Returns:
new Query instance

create

public static Query create(QualifiedName typeName)
Creates a new simple Query instance that selects the whole feature type.

Parameters:
typeName - name of the feature to be queried
Returns:
new Query instance

create

public static Query create(QualifiedName typeName,
                           Filter filter)
Creates a new simple Query instance that selects the whole feature type.

Parameters:
typeName - name of the feature to be queried
filter - spatial and none-spatial constraints
Returns:
new Query instance

create

public static Query create(org.w3c.dom.Element element)
                    throws XMLParsingException
Creates a Query instance from a document that contains the DOM representation of the request, using the 1.1.0 filter encoding.

Note that the following attributes from the surrounding element are also considered (if it present):

Parameters:
element -
Returns:
corresponding Query instance
Throws:
XMLParsingException

create

public static Query create(org.w3c.dom.Element element,
                           boolean useVersion_1_0_0)
                    throws XMLParsingException
Creates a Query instance from a document that contains the DOM representation of the request.

Note that the following attributes from the surrounding element are also considered (if it present):

Parameters:
element -
useVersion_1_0_0 - if the filterencoding 1.0.0 rules should be applied.
Returns:
corresponding Query instance
Throws:
XMLParsingException

getHandle

public java.lang.String getHandle()
Returns the handle attribute.

The handle attribute is included to allow a client to associate a mnemonic name to the query. The purpose of the handle attribute is to provide an error handling mechanism for locating a statement that might fail.

Returns:
the handle attribute

getTypeNames

public QualifiedName[] getTypeNames()
Returns the names of the requested feature types.

Returns:
the names of the requested feature types

getAliases

public java.lang.String[] getAliases()
Returns the aliases for the requested feature types.

The returned array is either null or has the same length as the array returned by getTypeNames().

Returns:
the aliases for the requested feature types, or null if no aliases are used
See Also:
getTypeNames()

getSrsName

public java.lang.String getSrsName()
Returns the srsName attribute.

Returns:
the srsName attribute

setSrsName

public void setSrsName(java.lang.String srsName)
Sets the srsName attribute to given value.

Parameters:
srsName - name of the requested SRS

performBBoxTest

public void performBBoxTest()
                     throws InvalidParameterValueException
Throws:
InvalidParameterValueException

deleteBBoxTest

public void deleteBBoxTest()
Sets the test to null, thus enabling the gc.


getFeatureVersion

public java.lang.String getFeatureVersion()
Returns the featureVersion attribute. 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 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.

Returns:
the featureVersion attribute

getPropertyNames

public PropertyPath[] getPropertyNames()
Returns all requested properties.

Returns:
all requested properties
See Also:
getFunctions()

getFunctions

public Function[] getFunctions()
Beside property names a query may contains 0 to n functions modifying the values of one or more original properties. E.g. instead of area and population the density of a country can be requested by using a function instead:
  <ogc:Div>
   <ogc:PropertyName>population</ogc:PropertyName>
   <ogc:PropertyName>area</ogc:PropertyName>
  </ogc:Div>
 

If no functions and no property names are specified all properties should be fetched.

Returns:
requested functions
See Also:
getPropertyNames()

getFilter

public Filter getFilter()
Returns the filter that limits the query.

Returns:
the filter that limits the query

getSortProperties

public SortProperty[] getSortProperties()
Returns the sort criteria for the result.

Returns:
the sort criteria for the result

getResultType

public GetFeature.RESULT_TYPE getResultType()
Returns the value of the resultType attribute ("inherited" from the GetFeature container).

Returns:
the value of the resultType attribute

getMaxFeatures

public int getMaxFeatures()
Returns the value of the maxFeatures attribute ("inherited" from the GetFeature container). The optional maxFeatures attribute can be used to limit the number of features that a GetFeature request retrieves. Once the maxFeatures limit is reached, the result set is truncated at that point. If not limit is set -1 will be returned

Returns:
the value of the maxFeatures attribute

setMaxFeatures

public void setMaxFeatures(int maxFeatures)
Parameters:
maxFeatures -

getStartPosition

public int getStartPosition()
Returns the value of the startPosition attribute ("inherited" from the GetFeature container).

The startPosition parameter identifies the first result set entry to be returned. If no startPosition is set explicitly, 1 will be returned.

Returns:
the value of the startPosition attribute, 1 if undefined

setStartPosition

public void setStartPosition(int startPosition)
Parameters:
startPosition -
See Also:
getStartPosition()

guessMissingTypeNameNamespace

public void guessMissingTypeNameNamespace(WFService wfs)
Adds missing namespaces in the names of requested feature types.

If the QualifiedName of a requested type has a null namespace, the first qualified feature type name of the given WFService with the same local name is used instead.

Note: The method changes this request part (the feature type names) and should only be called by the WFSHandler class.

Parameters:
wfs - WFService instance that is used for the lookup of proper (qualified) feature type names

guessAllMissingNamespaces

public void guessAllMissingNamespaces(WFService wfs)
Adds missing namespaces to requested feature type names, property names, filter properties and sort properties.

Note: The method changes the request and should only be called by the WFSHandler class.

Parameters:
wfs - WFService instance that is used for the lookup of proper (qualified) feature and property names

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org