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?

-- 

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts!
Visithttp://goo.gl/it488V for more information.
==
Dott. Stefano Costa
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272
http://www.geo-solutions.ithttp://twitter.com/geosolutions_it

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility  for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.
------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to