## org.opengis.filter.sort
Interface SortBy

    public interface SortBy

Defines the sort order, based on a property and ascending/descending.

Having SortBy at the Filter level is an interesting undertaking of Filter 1.1 support. Why you ask? It is at the Same level as Filter, it is not *used* by Filter itself. The services that make use of Filter, such as WFS are starting to make use of SortBy in the same breath.

Where is SortBy used:

- WFS 1.1 Query
- CSW 2.0.1 AbstractQuery

There may be more ...

What this means is that the GeoTools Query will make use of this construct. As for sorting the result of an expression (where an expression matches more then one element), we will splice it in to AttributeExpression as an optional parameter. Note function is defined to return a single value (so we don't need to worry there).

Since:
  GeoAPI 2.1
See Also:
  ,

Field Summary
`static SortBy` `NATURAL_ORDER` Used to indicate "natural" sorting order, usually according FID (hopefully based on Key attribtues).
`static SortBy` `REVERSE_ORDER` Indicate the reverse order, usually assoicated with "Fid".
`static SortBy[]` `UNSORTED` Used to indicate lack of a sorting order.

Method Summary
`PropertyName` `getPropertyName()` Indicate property to sort by, specification is limited to PropertyName.
`SortOrder` `getSortOrder()` The the sort order - one of `ASCENDING` or `DESCENDING`.

Field Detail

### UNSORTED

    static final SortBy[] UNSORTED

  Used to indicate lack of a sorting order.

  This is the default value for used when setting up a Query.

### NATURAL_ORDER

    static final SortBy NATURAL_ORDER

  Used to indicate "natural" sorting order, usually according FID (hopefully based on Key attribtues).

  This is the order that is most likely to be available in optimzied form, if an Attribute is marked as "key" an optimized ordering should be considered avaialble.

  Non optimized orderings are will at the very least require as pass through the data to bring it into memory, you can assume somekind of TreeSet would be used. Where the nodes in the tree would indicate a list of FeatureIds assoicated with the node, in the order encountered.

  This is a "NullObject".

### REVERSE_ORDER

    static final SortBy REVERSE_ORDER

  Indicate the reverse order, usually assoicated with "Fid".

  This is a "NullObject".

Method Detail

### getPropertyName

    PropertyName getPropertyName()

  Indicate property to sort by, specification is limited to PropertyName.

  Not sure if this is allowed to be a xPath expression?

  - It would be consist with our use in GeoTools
  - It would not seem to agree with the short hand notation used by WFS1.1 (ie. "year A, month A, day A" )

  Returns:
    Name of property to sort by.
  TODO:
    Use QName

### getSortOrder

    SortOrder getSortOrder()

  The the sort order - one of `ASCENDING` or `DESCENDING`.

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.