GeoTools
  1. GeoTools
  2. GEOT-3576

Filter Support for Comparing with Multi-valued Properties

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      With Complex Features, there is the possibility of properties evaluating to multiple values (collections of values) rather than a single value.
      It should be possible to apply comparison operators (like "=", "<") and geometry operators (like overlaps/touches/etc) to multi-valued properties.

      However, the current filter system in Geotools assumes a single value for each property.

      Currently in app-schema, a work-around exists for making this work on mapped feature collections. This work-around only works when the filtering is applied to the mapping datastore, not when applying filters on already built complex features. Therefore it does not work in two situations

      • in WMS styling files, it doesn't work.
      • I am currently creating a new post-filtering system for a performance improved app-schema and I cannot use the old workaround any more.

      Better would be provide proper support for filtering on multiple values in the actual filters.

      Proposal: see http://docs.codehaus.org/display/GEOTOOLS/Support+Multi-Valued+Attributes+in+Filter+Comparison+Operators

      1. patch_geotools_docs_multivalued.diff
        35 kB
        Niels Charlier
      2. patch_geotools_docs_multivalued.diff
        35 kB
        Niels Charlier
      3. patch_geotools_filterwithmultivalued.diff
        53 kB
        Niels Charlier
      4. patch_geotools_filterwithmultivalued.diff
        53 kB
        Niels Charlier
      5. patch_multivaluedfiltersextensions.diff
        100 kB
        Niels Charlier
      1. filter_model.PNG
        52 kB
      2. filter_spatial.PNG
        55 kB

        Activity

        Hide
        Niels Charlier added a comment -
        What about this:

        MultiValuedFilter filter = ff.propertyGreaterThan( ff.property( "child/age"), ff.literal( 12 ), MatchAction.ALL );

        Given that child is a multivalued attribute (someone can have multiple children), this tests whether all of the children are older than 12 years old.
        This example reflects more what it will be used for, I think
        Show
        Niels Charlier added a comment - What about this: MultiValuedFilter filter = ff.propertyGreaterThan( ff.property( "child/age"), ff.literal( 12 ), MatchAction.ALL ); Given that child is a multivalued attribute (someone can have multiple children), this tests whether all of the children are older than 12 years old. This example reflects more what it will be used for, I think
        Hide
        Niels Charlier added a comment -
        Updated patch.
        Show
        Niels Charlier added a comment - Updated patch.
        Hide
        Jody Garnett added a comment -
        I updated the pictures (while I was updating the filter temporal stuff).

        What we really need is three code examples that show how the different match actions work....

        Overview of filter goes here:
        - http://docs.geotools.org/latest/userguide/library/opengis/filter.html

        Just like we take time out to explain include and exude; we can take time explain match action.

        Filter examples here (one for each kind of filter is the goal - so one for each kind of match action would be good):
        - http://docs.geotools.org/latest/userguide/library/main/filter.html

        List<Integer> numbers = Arrays.asList( new int[]{ 4,6,7,8,10, 15 } );

        filter = ff.propertyGreaterThan( ff.literal(5), ff.literal( numbers ), Match.Action.ALL );
        System.out.println( "All: "+ ff.evaualte( null ) ); // prints All: false

        filter = ff.propertyGreaterThan( ff.literal(5), ff.literal( numbers ), Match.Action.ANY );
        System.out.println( "Any: "+ ff.evaualte( null ) ); // prints Any: true

        etc...


        Show
        Jody Garnett added a comment - I updated the pictures (while I was updating the filter temporal stuff). What we really need is three code examples that show how the different match actions work.... Overview of filter goes here: - http://docs.geotools.org/latest/userguide/library/opengis/filter.html Just like we take time out to explain include and exude; we can take time explain match action. Filter examples here (one for each kind of filter is the goal - so one for each kind of match action would be good): - http://docs.geotools.org/latest/userguide/library/main/filter.html List<Integer> numbers = Arrays.asList( new int[]{ 4,6,7,8,10, 15 } ); filter = ff.propertyGreaterThan( ff.literal(5), ff.literal( numbers ), Match.Action.ALL ); System.out.println( "All: "+ ff.evaualte( null ) ); // prints All: false filter = ff.propertyGreaterThan( ff.literal(5), ff.literal( numbers ), Match.Action.ANY ); System.out.println( "Any: "+ ff.evaualte( null ) ); // prints Any: true etc...
        Hide
        Niels Charlier added a comment -
        Committed r37422
        Show
        Niels Charlier added a comment - Committed r37422
        Hide
        Jody Garnett added a comment -
        reviewed docs change; thanks Niels.
        Show
        Jody Garnett added a comment - reviewed docs change; thanks Niels.

          People

          • Assignee:
            Niels Charlier
            Reporter:
            Niels Charlier
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: