Package org.opengis.cite.iso19142.util

# Class DataSampler

java.lang.Object
org.opengis.cite.iso19142.util.DataSampler

public class DataSampler extends Object
Obtains samples of the feature data available from the WFS under test. Instances of all feature types advertised in the service description are requested, but data need not exist for every type.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final QName`
  `BOUNDED_BY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataSampler(Document wfsCapabilities)`
  Constructs a new DataSampler for a particular WFS implementation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `acquireFeatureData()`
  Attempts to acquire instances of all feature types supported by the WFS using all supported GetFeature message bindings (request encodings).
  `boolean`
  `deleteData()`
  Deletes all saved data files.
  `net.sf.saxon.s9api.XdmValue`
  `evaluateXPathAgainstSampleData(String expr, Map<String,String> nsBindings)`
  Evaluates the given XPath expression against all sample data sets.
  `Element`
  `getFeatureById(String id)`
  Returns a feature instance from the sample data.
  `String`
  `getFeatureId()`
  Returns the identifier (gml:id attribute value) for an existing feature instance.
  `String`
  `getFeatureIdNotOfType(QName featureType)`
  Returns the identifier (gml:id attribute value) for an existing feature instance.
  `Map<QName,FeatureTypeInfo>`
  `getFeatureTypeInfo()`
  Returns a Map containing information about the feature types supported by the WFS.
  `List<QName>`
  `getNillableProperties(org.apache.xerces.xs.XSModel model, QName featureType)`
  Determines a property which is nillable and contains nilled properties for the specified feature type in the sample data.
  `List<String>`
  `getSimplePropertyValues(QName featureType, QName propName, String featureId)`
  Returns a list containing the values (in document order) of the specified feature property in the sample data set.
  `org.opengis.geometry.Envelope`
  `getSpatialExtent(org.apache.xerces.xs.XSModel model, QName featureType)`
  Determines the spatial extent of the feature instances in the sample data.
  `org.opengis.temporal.Period`
  `getTemporalExtentOfProperty(org.apache.xerces.xs.XSModel model, QName featureType, org.apache.xerces.xs.XSElementDeclaration tmPropDecl)`
  Determines the temporal extent of all instances of the specified feature property in the sample data.
  `Element`
  `randomlySelectFeatureInstance()`
  Randomly selects a feature instance from the sample data obtained from the IUT.
  `QName`
  `selectFeatureType()`
  Sort alphabetically and selects first feature type name for which instances are available in the SUT.
  `Set<String>`
  `selectRandomFeatureIdentifiers(QName featureType, int numId)`
  Returns a set of identifiers for available feature instances of a given type.
  `void`
  `setMaxFeatures(int maxFeatures)`
  Sets the maximum number of features to include in the response entity.

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

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

- ## Field Details

  - ### BOUNDED_BY

    public static final QName BOUNDED_BY

- ## Constructor Details

  - ### DataSampler

    public DataSampler(Document wfsCapabilities)
    Constructs a new DataSampler for a particular WFS implementation.
    Parameters:
      `wfsCapabilities` - A DOM Document representing the service metadata (/wfs:WFS_Capabilities).

- ## Method Details

  - ### setMaxFeatures

    public void setMaxFeatures(int maxFeatures)
    Sets the maximum number of features to include in the response entity.
    Parameters:
      `maxFeatures` - An integer value > 0 (the default value is 25).

  - ### selectRandomFeatureIdentifiers

    public Set<String> selectRandomFeatureIdentifiers(QName featureType, int numId)
    Returns a set of identifiers for available feature instances of a given type. The identifiers are randomly selected from the sample data.
    Parameters:
      `featureType` - A QName representing the qualified name of some feature type.
      `numId` - The desired number of identifiers.
    Returns:
      A Set containing zero or more feature identifiers.

  - ### getSimplePropertyValues

    public List<String> getSimplePropertyValues(QName featureType, QName propName, String featureId)
    Returns a list containing the values (in document order) of the specified feature property in the sample data set. The property value is converted to a string as if the XPath string() function were applied.
    Parameters:
      `featureType` - A QName representing the qualified name of some feature type.
      `propName` - The name of the property.
      `featureId` - A feature identifer (gml:id); if `null` or empty the evaluation context includes all members of the collection.
    Returns:
      A List containing simple property values; the list is empty if no values are found.

  - ### deleteData

    public boolean deleteData()
    Deletes all saved data files.
    Returns:
      `true` if all data files were deleted; `false` otherwise (see warnings in log file for details).

  - ### acquireFeatureData

    public void acquireFeatureData()
    Attempts to acquire instances of all feature types supported by the WFS using all supported GetFeature message bindings (request encodings). The feature representations are saved in a temporary file. If no data exist for a given feature type, `FeatureTypeInfo.isInstantiated()` returns `false`.

  - ### getFeatureTypeInfo

    public Map<QName,FeatureTypeInfo> getFeatureTypeInfo()
    Returns a Map containing information about the feature types supported by the WFS.
    Returns:
      A Map where the keys are QName objects representing the names of feature types advertised in the capabilities document.

  - ### getFeatureById

    public Element getFeatureById(String id)
    Returns a feature instance from the sample data.
    Parameters:
      `id` - The feature identifier (@gml:id).
    Returns:
      An Element representing a feature instance, or null if no matching feature is found.

  - ### getFeatureIdNotOfType

    public String getFeatureIdNotOfType(QName featureType)
    Returns the identifier (gml:id attribute value) for an existing feature instance.
    Parameters:
      `featureType` - The qualified name of a the feature type the feature should not be an instance from.
    Returns:
      A feature identifier, or null if one cannot be found.

  - ### getFeatureId

    public String getFeatureId()
    Returns the identifier (gml:id attribute value) for an existing feature instance.
    Returns:
      A feature identifier, or null if one cannot be found.

  - ### getSpatialExtent

    public org.opengis.geometry.Envelope getSpatialExtent(org.apache.xerces.xs.XSModel model, QName featureType)
    Determines the spatial extent of the feature instances in the sample data. If a feature type defines more than one geometry property, the envelope is calculated using the first non-empty property.
    Parameters:
      `model` - A model representing the supported GML application schema.
      `featureType` - The name of the feature type.
    Returns:
      An Envelope, or null if one cannot be created or the feature type has no geometry properties defined.

  - ### getTemporalExtentOfProperty

    public org.opengis.temporal.Period getTemporalExtentOfProperty(org.apache.xerces.xs.XSModel model, QName featureType, org.apache.xerces.xs.XSElementDeclaration tmPropDecl)
    Determines the temporal extent of all instances of the specified feature property in the sample data. The temporal extent is extend by 1 day and 1 hour in the beginning and the end.
    Parameters:
      `model` - A model representing the relevant GML application schema.
      `featureType` - The name of the feature type.
      `tmPropDecl` - A declaration of a temporal property.
    Returns:
      A Period, or null if the property does not occur or has no values.

  - ### getNillableProperties

    public List<QName> getNillableProperties(org.apache.xerces.xs.XSModel model, QName featureType)
    Determines a property which is nillable and contains nilled properties for the specified feature type in the sample data.
    Parameters:
      `model` - A model representing the relevant GML application schema, never `null`.
      `featureType` - The name of the feature type, never `null`.
    Returns:
      A list of property names which are nillable and contains nilled instances, empty if such a property does not occur or has no values.

  - ### randomlySelectFeatureInstance

    public Element randomlySelectFeatureInstance()
    Randomly selects a feature instance from the sample data obtained from the IUT.
    Returns:
      An Element node representing a feature instance.

  - ### selectFeatureType

    public QName selectFeatureType()
    Sort alphabetically and selects first feature type name for which instances are available in the SUT.
    Returns:
      A QName object denoting the name of a feature type, or `null` if no data exist in the SUT.

  - ### evaluateXPathAgainstSampleData

    public net.sf.saxon.s9api.XdmValue evaluateXPathAgainstSampleData(String expr, Map<String,String> nsBindings)
    Evaluates the given XPath expression against all sample data sets. The first non-empty result is returned.
    Parameters:
      `expr` - An XPath 2.0 expression.
      `nsBindings` - A collection of namespace bindings required to evaluate the XPath expression, where each entry maps a namespace URI (key) to a prefix (value).
    Returns:
      An XdmValue object containing a sequence of zero or more matching items.