Interface Filter<R>

Type Parameters:
R - the type of resources (e.g. Feature) to filter.
All Superinterfaces:
Predicate<R>
All Known Subinterfaces:
BetweenComparisonOperator<R>, BinaryComparisonOperator<R>, BinarySpatialOperator<R>, ComparisonOperator<R>, DistanceOperator<R>, LikeOperator<R>, LogicalOperator<R>, NilOperator<R>, NullOperator<R>, ResourceId<R>, SpatialOperator<R>, TemporalOperator<R>

@Classifier(ABSTRACT) @UML(identifier="Filter", specification=ISO_19143) public interface Filter<R> extends Predicate<R>
Identification of a subset of resources from a collection of resources whose property values satisfy a set of logically connected predicates. Often a filter is used to define a set of Feature instances that are to be operated upon. The operating set can be comprised of one or more enumerated features or a set of features defined by specifying spatial and non-spatial constraints on the geometric and scalar properties of a FeatureType.

Roughly speaking, a filter encodes the information present in the WHERE clause of a SQL statement. There are various sub-interfaces of this interface that represent many types of filters, such as simple property comparisons or spatial queries.

The second use of Filter focuses on expressing constraints (or Facets). This use places restrictions on the allowable and is captured as part of schema information FeatureType. This is similar to the XML concept of "facets".

Since:
3.1
Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality In ISO specification, Filter contains a "filter" property of type Operator. Then various Operator subclasses are provided such as SpatialOperator, etc. GeoAPI removes this indirection level and extends Filter directly instead.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <R> Filter<R>
    A filter that always evaluates to false.
    List<Expression<? super R,?>>
    Returns the expressions used as arguments for this filter.
    Returns the nature of the operator.
    static <R> Filter<R>
    A filter that always evaluates to true.
    boolean
    test(R object)
    Given an object, determines if the test(s) represented by this filter are passed.

    Methods inherited from interface Predicate

    and, negate, or
  • Method Details

    • include

      static <R> Filter<R> include()
      A filter that always evaluates to true. This is a placeholder for meaning "no filtering". Filtering a set with Filter.INCLUDE results in the original set.
      Use with logic operators
      Operation Result
      INCLUDE or Filter INCLUDE
      INCLUDE and Filter Filter
      not INCLUDE EXCLUDE
      Type Parameters:
      R - the type of resources to filter.
      Returns:
      the "no filtering" filter.
    • exclude

      static <R> Filter<R> exclude()
      A filter that always evaluates to false. Filtering a set with Filter.EXCLUDE results in the empty set.
      Use with logic operators
      Operation Result
      EXCLUDE or Filter Filter
      EXCLUDE and Filter EXCLUDE
      not EXCLUDE INCLUDE
      Type Parameters:
      R - the type of resources to filter.
      Returns:
      the "exclude all" filter.
    • getOperatorType

      CodeList<?> getOperatorType()
      Returns the nature of the operator. The code list can be LogicalOperatorName, SpatialOperatorName, DistanceOperatorName or TemporalOperatorName depending on the Filter sub-interface.
      Returns:
      the nature of this operator.
      Departure from OGC/ISO abstract specification:
      Generalization by relaxation of ISO/OGC restriction The ISO/OGC standard defines an operatorType property in UnaryLogicOperator, BinaryLogicOperator, BinaryComparisonOperator, BinarySpatialOperator and DistanceOperator. This method has been added for providing a single access point for that information without the need to check for each sub-type.
    • getExpressions

      List<Expression<? super R,?>> getExpressions()
      Returns the expressions used as arguments for this filter. This method shall return all parameters used directly by the filter, including the ones also available by dedicated methods (possibly as literals).
      Returns:
      the expressions used as inputs, or an empty list if none.
      Departure from OGC/ISO abstract specification:
      Generalization by relaxation of ISO/OGC restriction This method has been added for providing a single access point for information provided in sub-types. The properties captured here have different names in OGC/ISO specification depending on the sub-type: expression (with a cardinality of 1, 2 or unlimited), operand1, operand2, or valueReference. This method provides a way to access those expressions without the need to make special cases for each sub-type.
    • test

      boolean test(R object) throws InvalidFilterValueException
      Given an object, determines if the test(s) represented by this filter are passed. This ability is used to allow queries against both features and and non spatial data (such as record) and to express constraints on permissable data values.
      Specified by:
      test in interface Predicate<R>
      Parameters:
      object - the object (often a Feature instance) to evaluate.
      Returns:
      true if the test(s) are passed for the provided object.
      Throws:
      NullPointerException - if object is null.
      InvalidFilterValueException - if the filter cannot be applied on the given object.