Stefano,

I am not sure but this seems like a bug to me.

Kind regards,
Ben.

On 01/10/15 23:48, Stefano Costa wrote:
> Dear developers,
> I'm seeing what seems to me a misbehavior in the way app-schema handles
> attribute mappings containing only client properties.
>
> Let's suppose I have a source property file for the gsml:MappedFeature type
> (I'm using GeoSciML 2.0 application schema) like this one:
>
> _=ID:String,OBS_METHOD:String
> mf1=mf1|obs_method_1
> mf1=mf1|obs_method_2
> mf1=mf1|obs_method_3
> mf4=mf4|obs_method_1
>
> The data is denormalized. I would like to map the OBS_METHOD field to the
> target attribute gsml:observationMethod/gsml:CGI_TermValue/gsml:value,
> which is a single-valued attribute nested inside a multi-valued one
> (gsml:observationMethod). I expect that "Multivalued properties from
> denormalised sources (the same source feature ID appears more than once)
> are automatically encoded", as the docs say, and, in fact, that checks out:
> MappedFeature mf1 ends up having three gsml:observationMethod attributes,
> each with a different nested gsml:value.
>
> The mapping I used:
>
> <AttributeMapping>
>    <targetAttribute>gsml:observationMethod/gsml:CGI_TermValue/gsml:value
>    </targetAttribute>
>    <isMultiple>true</isMultiple>
>    <encodeIfEmpty>true</encodeIfEmpty>
>    <sourceExpression>
>      <OCQL>OBS_METHOD</OCQL>
>    </sourceExpression>
> </AttributeMapping>
>
> Now, if I take the same OBS_METHOD field and map it to a ClientProperty
> (e.g. xlink:href) of a multi-valued attribute, without also defining a
> <sourceEpression> for it, it does not work as expected.
> The mapping I tried:
>
> <AttributeMapping>
>    <targetAttribute>gml:metaDataProperty</targetAttribute>
>    <isMultiple>true</isMultiple>
>    <encodeIfEmpty>true</encodeIfEmpty>
>    <ClientProperty>
>      <name>xlink:href</name>
>      <value>strConcat('#meta.', OBS_METHOD)</value>
>    </ClientProperty>
> </AttributeMapping>
>
> What I expected to see:
>
> ...
>    <gml:metaDataProperty xlink:href="#meta.obs_method_1" />
>    <gml:metaDataProperty xlink:href="#meta.obs_method_2" />
>    <gml:metaDataProperty xlink:href="#meta.obs_method_3" />
> ...
>
> What I got instead:
> ...
>    <gml:metaDataProperty xlink:href="#meta.obs_method_3" /> <--- only the
> last value is actually encoded
> ...
>
> Here is a test class to reproduce the issue:
> https://github.com/ridethepenguin/app-schema-testbench/blob/master/src/test/java/it/geosolutions/appschema/test/DenormalizedSingleValueNestedInMultiValueTest.java
>
> The test testObservationMethod() succeeds, while the
> test testMetadataProperty() fails.
>
> Am I wrong in my expectations, or is this really a bug?
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>

-- 
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to