- 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 typeOperator
. Then variousOperator
subclasses are provided such asSpatialOperator
, etc. GeoAPI removes this indirection level and extendsFilter
directly instead.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> Filter<R>
exclude()
A filter that always evaluates tofalse
.List<Expression<? super R,
?>> Returns the expressions used as arguments for this filter.CodeList<?>
Returns the nature of the operator.static <R> Filter<R>
include()
A filter that always evaluates totrue
.boolean
Given an object, determines if the test(s) represented by this filter are passed.
-
Method Details
-
include
A filter that always evaluates totrue
. This is a placeholder for meaning "no filtering". Filtering a set withFilter.INCLUDE
results in the original set.Use with logic operators Operation Result INCLUDE
or FilterINCLUDE
INCLUDE
and FilterFilter not INCLUDE
EXCLUDE
- Type Parameters:
R
- the type of resources to filter.- Returns:
- the "no filtering" filter.
-
exclude
A filter that always evaluates tofalse
. Filtering a set withFilter.EXCLUDE
results in the empty set.Use with logic operators Operation Result EXCLUDE
or FilterFilter EXCLUDE
and FilterEXCLUDE
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 beLogicalOperatorName
,SpatialOperatorName
,DistanceOperatorName
orTemporalOperatorName
depending on theFilter
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 anoperatorType
property inUnaryLogicOperator
,BinaryLogicOperator
,BinaryComparisonOperator
,BinarySpatialOperator
andDistanceOperator
. 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
, orvalueReference
. This method provides a way to access those expressions without the need to make special cases for each sub-type.
-
test
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 interfacePredicate<R>
- Parameters:
object
- the object (often aFeature
instance) to evaluate.- Returns:
true
if the test(s) are passed for the provided object.- Throws:
NullPointerException
- ifobject
is null.InvalidFilterValueException
- if the filter cannot be applied on the given object.
-