GeoTools
  1. GeoTools
  2. GEOT-2528

Support for filtering complex attribute value

    Details

    • Type: Wish Wish
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 2.6-M2
    • Fix Version/s: 2.6-M2
    • Component/s: main
    • Labels:
      None

      Description

      I have a problem trying to filter complex attribute value from a complex feature.
      Ideally, the filter should be unmapped first to its simple feature form, eg.

      Query:
      feature type: CGI_TermValue
      filter: [ gml:name = significant ]
      [properties: ALL ]

      Unmapped to this:

      Query:
      feature type: CGITermValue
      filter: [ strTrim([getID()]) = significant ]
      [properties: ALL ]

      Then there's no problem. However, in my case, I don't have the simple features, as the complex features are adapted from a web service.
      So I have to filter the complex attribute directly.
      The value returned is the value collection of the complex attribute, which when compared to the string value, would return false.

      In FilterAbstract, there's this hack:

      protected Object eval(org.opengis.filter.expression.Expression expression, Object object) {
      if( expression == null ) return null;
      Object value = expression.evaluate( object );
      //HACK as this method is used internally for filter
      //evaluation comparisons, etc, they work over the
      //contents (i.e. comparing an attexpresion with a literal)
      //so, lacking a better way of doing so, I'm putting this
      //check here
      if(value instanceof org.opengis.feature.Attribute)

      { value = ((org.opengis.feature.Attribute)value).getValue(); }

      return value;
      }

      I was tempted to modify this hack to get the complex attribute value, but it felt wrong.
      Instead, I added a new converter to retrieve the complex attribute value (only if the type has no attributes, ie. Simple content).
      I'm not sure if this is a good solution, but I can't think of anything else. Opinions?

      Cheers

      Rini

        Activity

        Hide
        Rini Angreani added a comment -
        I managed to provide a workaround for my situation so this is no longer needed. If this comes up in the future, we can create a new issue and provide a proper fix.
        Show
        Rini Angreani added a comment - I managed to provide a workaround for my situation so this is no longer needed. If this comes up in the future, we can create a new issue and provide a proper fix.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rini Angreani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: