You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by Martin Desruisseaux <ma...@geomatys.fr> on 2013/12/11 18:13:03 UTC

Policy on usage of "xlink:href" XML attribute in metadata

Hello Frédéric

I have a somewhat philosophical question for you. I have been reported 
that the "xlink:href" attribute were sometime lost when marshalling a 
metadata object to XML. In my understanding, that attribute is used for 
replacing a verbose definition. For example instead of:

    <gmd:citation>
       <gmd:CI_Citation>
         <gmd:responsibleParty>
           <gmd:CI_ResponsibleParty>
             <gmd:organisationName>
                Apache
                ... etc for a very long XML


one could write for instance:

    <gmd:citation xlink:href="http://...#apache"/>


Where the URL is a link to an other XML document containing the complete 
<gmd:CI_Citation> definition. In the current Apache SIS implementation, 
those two representations are mutually exclusive. The rational was that 
when a xlink:href is provided, the normal intend is to not marshal the 
complete element below it, otherwise the xlink:href would be pointless.

This raise the question of what to do when both xlink:href and a 
metadata definition are provided. In current implementation, SIS uses 
the xlink:href form only if the user has explicitly flagged his metadata 
object has "nil" by implementing the NilObject interface [1]. If a 
metadata object is non-nil, then SIS conservatively marshal the whole 
object instead, no matter if a xlink:href is defined or not. It would be 
technically easy to both marshal the whole object and to write the 
xlink:href attribute, but I'm not sure if it make sense to do that in 
every cases (xlink:href are not identifiers - there is other attributes 
for the later).

Actually the user has control on whether to marshal the whole metadata 
or only xlink:href (but currently no control on whether SIS should 
marshal both together) by overriding the ReferenceResolver method. My 
question is about what should be the default behaviour?

     Martin


[1] http://sis.apache.org/apidocs/org/apache/sis/xml/NilObject.html
[2] http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html#canSubstituteByReference%28org.apache.sis.xml.MarshalContext,%20java.lang.Class,%20T,%20org.apache.sis.xml.XLink%29



Re: Policy on usage of "xlink:href" XML attribute in metadata

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Frédéric

Thank you very much for your reply.

Le 11/12/13 13:50, Frédéric Houbie a écrit :
> the xlink:href attribute is there to reference a linked information. 
> There are use cases where the value is an additional information to 
> the content of the element.
>
> <gmd:keyword>
>    <gmx:Anchor xlink:href="http://vocab.ndg.nerc.ac.uk/term/C161/0/55" xlink:actuate="onRequest">Bering Sea</gmx:Anchor>
>   </gmd:keyword>
>
> In this case, the link points to some semantic description of the 
> term, which is the content of the element. That's the kind of case 
> where you need to keep both.

In my understanding (please correct me if I'm wrong), <gmx:Anchor> can 
be used in places where a <gco:CharacterString> would normally be 
expected [1]. In this particular case Apache SIS already keep both. I 
was rather thinking about the cases where the xlink:href is used for 
replacing a bigger ISO 19139 object, for example <gmd:MD_Keywords> as 
whole. In such cases the xlink:href attribute appears higher in the 
hierarchy.

> So, I would say that the Java representation of such XML construct 
> shall keep the content, shall keep the link value and eventually 
> having some helper to resolve the link and maybe parse it.

Agree, Java representation in Apache SIS already keep both. My issue was 
rather about which information to choose by default at marshalling time. 
Unless someone makes an other proposal, I will try to change the default 
behaviour in order to write xlink:href even if the object is non-nil. 
This will lead to duplication in the XML file, but it may be a less 
surprising behaviour for users than omitted information.

     Thanks,

         Martin


[1] http://www.schemacentral.com/sc/niem20/e-gmx_Anchor.html
[2] 
http://www.schemacentral.com/sc/niem21/t-gmd_MD_Keywords_PropertyType.html


Re: Policy on usage of "xlink:href" XML attribute in metadata

Posted by Frédéric Houbie <fr...@geomatys.com>.
Hello Martin,

the xlink:href attribute is there to reference a linked information. There
are use cases where the value is an additional information to the content
of the element.

<gmd:keyword>
  <gmx:Anchor xlink:href="http://vocab.ndg.nerc.ac.uk/term/C161/0/55"
xlink:actuate="onRequest">Bering Sea</gmx:Anchor>
 </gmd:keyword>


In this case, the link points to some semantic description of the term,
which is the content of the element. That's the kind of case where you need
to keep both.

Unfortunately, there is no strict logic to know if the link is the
equivalent to the content. You could decide that if the content is XML,
then the link shall point to  the equivalent, but I'm not sure it is the
reality.

So, I would say that the Java representation of such XML construct shall
keep the content, shall keep the link value and eventually having some
helper to resolve the link and maybe parse it.

Hope that helps.

Frédéric




On 11 December 2013 18:13, Martin Desruisseaux <
martin.desruisseaux@geomatys.fr> wrote:

>  Hello Frédéric
>
> I have a somewhat philosophical question for you. I have been reported
> that the "xlink:href" attribute were sometime lost when marshalling a
> metadata object to XML. In my understanding, that attribute is used for
> replacing a verbose definition. For example instead of:
>
>  <gmd:citation>
>   <gmd:CI_Citation>
>     <gmd:responsibleParty>
>       <gmd:CI_ResponsibleParty>
>         <gmd:organisationName>
>            Apache
>            ... etc for a very long XML
>
>
> one could write for instance:
>
>  <gmd:citation xlink:href="http://...#apache" <http://...#apache>/>
>
>
> Where the URL is a link to an other XML document containing the complete
> <gmd:CI_Citation> definition. In the current Apache SIS implementation,
> those two representations are mutually exclusive. The rational was that
> when a xlink:href is provided, the normal intend is to not marshal the
> complete element below it, otherwise the xlink:href would be pointless.
>
> This raise the question of what to do when both xlink:href and a metadata
> definition are provided. In current implementation, SIS uses the
> xlink:href form only if the user has explicitly flagged his metadata
> object has "nil" by implementing the NilObject interface [1]. If a
> metadata object is non-nil, then SIS conservatively marshal the whole
> object instead, no matter if a xlink:href is defined or not. It would be
> technically easy to both marshal the whole object and to write the
> xlink:href attribute, but I'm not sure if it make sense to do that in
> every cases (xlink:href are not identifiers - there is other attributes
> for the later).
>
> Actually the user has control on whether to marshal the whole metadata or
> only xlink:href (but currently no control on whether SIS should marshal
> both together) by overriding the ReferenceResolver method. My question is
> about what should be the default behaviour?
>
>     Martin
>
>
> [1] http://sis.apache.org/apidocs/org/apache/sis/xml/NilObject.html
> [2] http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html#canSubstituteByReference%28org.apache.sis.xml.MarshalContext,%20java.lang.Class,%20T,%20org.apache.sis.xml.XLink%29
>
>
>


-- 
*Frédéric Houbie*

Systems architect / Geospatial Project Manager

url : www.geomatys.com | e-mail : frederic.houbie@geomatys.com

*Office*
Maison de la Télédétection
500 rue Jean-François Breton
34093 Montpellier Cedex 5
France
Phone : +33 (0)4 84 49 02 26
Fax: +33 (0)4 67 54 87 00
*Home Office*
26 Avenue François Bovesse
4053 Embourg
Belgique
Phone 1 : + 33 (0)4 11 93 42 97
Phone 2 : + 32 (0)4 287 02 33
Mobile : +32 (0)494 43 01 08