You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@sis.apache.org by Emmanuel Blondel <em...@gmail.com> on 2015/02/12 20:16:49 UTC

Question about TimePeriod & auto-generated id

Hello,

Moving now from geotoolkit metadata to apache SIS.

This is what i had with geotoolkit:

             <gmd:EX_TemporalExtent>
                 <gmd:extent>
                   <gml:TimePeriod *gml:id="PXA32O"*>
<gml:beginPosition>2006-12-31</gml:beginPosition>
<gml:endPosition>2015-12-30</gml:endPosition>
                   </gml:TimePeriod>
                 </gmd:extent>
               </gmd:EX_TemporalExtent>

Now moving to Apache SIS, i don't have any gml id for the TimePeriod.

I'm publishing metadata in Geonetwork, and the absence of this 
TimePeriod id causes a misinterpretation of the metadata.

Can you explain why this identifier is missing in Apache SIS? Is it 
related to the comment given here: 
https://github.com/apache/sis/blob/5b8a836588ab5e94a3cc164f7e6b3b202774407a/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java#L44

Thanks in advance for your advice,
Emmanuel

Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Le 13/02/15 00:55, Martin Desruisseaux a écrit :
> Try setting the property to "3.1".

Correction: I think it would rather be "3.2" in this case.

    Martin


On -SNAPSHOT usage on the development branch

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello all

I'm following up on an issue raised this week on the user mailing list.
We are exploring various ways to reduce slightly the risk that users of
-SNAPSHOT artifacts get NoSuchMethodError or similar exceptions. One
possible way would be to use the "Locking snapshot dependencies"
approach [1]. This approach would consist in changing the
geoapi-pending-4.0-SNAPSHOT dependency into (for example)
geoapi-pending-4.0-20150201.221833-36 (reminder: this apply only to
development branches; the Apache SIS trunk is always nailed down on
geoapi-3.0.0 standard release). We would upgrade this timestamp every
time a new geoapi snapshot is created, which is relatively rare.

However it seems that "snapshot dependencies locking" does not yet work
very well in Maven [2]. But in my understanding, it would work okay if
the new geoapi snapshots are rare, and if Apache SIS development branch
stick always on the latest version.

Is there any opinion, e.g. would it be useful or an unnecessary
complication? I have no strong opinion since I didn't had issue with
-SNAPSHOT myself; this proposal is an attempt to improve slightly some
users experience.

    Martin

[1] http://mojo.codehaus.org/versions-maven-plugin/examples/lock-snapshots.html
[2] http://stackoverflow.com/questions/25365679/why-are-my-locked-snapshots-being-ignored-and-using-the-most-recent-snapshot-in


On -SNAPSHOT usage on the development branch

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello all

I'm following up on an issue raised this week on the user mailing list.
We are exploring various ways to reduce slightly the risk that users of
-SNAPSHOT artifacts get NoSuchMethodError or similar exceptions. One
possible way would be to use the "Locking snapshot dependencies"
approach [1]. This approach would consist in changing the
geoapi-pending-4.0-SNAPSHOT dependency into (for example)
geoapi-pending-4.0-20150201.221833-36 (reminder: this apply only to
development branches; the Apache SIS trunk is always nailed down on
geoapi-3.0.0 standard release). We would upgrade this timestamp every
time a new geoapi snapshot is created, which is relatively rare.

However it seems that "snapshot dependencies locking" does not yet work
very well in Maven [2]. But in my understanding, it would work okay if
the new geoapi snapshots are rare, and if Apache SIS development branch
stick always on the latest version.

Is there any opinion, e.g. would it be useful or an unnecessary
complication? I have no strong opinion since I didn't had issue with
-SNAPSHOT myself; this proposal is an attempt to improve slightly some
users experience.

    Martin

[1] http://mojo.codehaus.org/versions-maven-plugin/examples/lock-snapshots.html
[2] http://stackoverflow.com/questions/25365679/why-are-my-locked-snapshots-being-ignored-and-using-the-most-recent-snapshot-in


Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Emmanuel

We changed recently the Geotk dependency from "0.5-jdk7-SNAPSHOT" to
"0.5-jdk7" in an effort to increase stability. We do not have any tag
for "0.5-jdk7" since this is not an official Apache SIS release - it was
supposed to be only for development work, but admittedly Geotk depends
strongly on it. We will try to fix this issue by switching Geotk to the
official Apache SIS releases when we will have enough functionalities
ported to SIS.

In the meantime, if you have a local checkout of Geotk, would it be
possible to try the following?

  * Open the Geotk root pom.xml
  * Search the <sis.version>0.5-jdk7</sis.version> line
  * Replace the version number by 0.6-jdk7-SNAPSHOT
  * run "mvn clean install"


Please let us know if you have any issue. We will try to think tomorrow
about how we can get a better stability than having Geotk to depend on
SIS snaphots. One possibility we are thinking about is to use the
snapshot timestamps.

I will post more news about this issue tomorrow. Sorry for the
inconvenience...

    Martin


Le 23/02/15 15:06, Emmanuel Blondel a écrit :
> Hi Martin,
>
> Thanks for this. I've tested using the code modified with the patch.
> Since i was relying on Geotk 4.x-SNAPSHOT, i was using
> 0.5-jdk7-SNAPSHOT, which i've excluded as maven dep to use the built
> jar sis-utility
>
> Since i'm producing metadata using information retrieved from a WFS
> data, see the log i get (dealing with JAXB feature type stuff)..
> I'm not sure if i'm using well these new deps, should i use all apache
> sis 0.5 deps? or only sis-utility should work?
>
> Exception in thread "main" java.lang.NoSuchFieldError: NAMES
>     at
> org.geotoolkit.feature.type.DefaultName.<init>(DefaultName.java:103)
>     at org.geotoolkit.feature.type.DefaultName.<init>(DefaultName.java:89)
>     at org.geotoolkit.feature.xml.Utils.<clinit>(Utils.java:88)
>     at
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.listAllSchemas(JAXBFeatureTypeReader.java:416)
>     at
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.getAllFeatureTypeFromSchema(JAXBFeatureTypeReader.java:404)
>     at
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.read(JAXBFeatureTypeReader.java:310)
>     at
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.read(JAXBFeatureTypeReader.java:248)


Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
Hi Martin,

Thanks for this. I've tested using the code modified with the patch.
Since i was relying on Geotk 4.x-SNAPSHOT, i was using 
0.5-jdk7-SNAPSHOT, which i've excluded as maven dep to use the built jar 
sis-utility

Since i'm producing metadata using information retrieved from a WFS 
data, see the log i get (dealing with JAXB feature type stuff)..
I'm not sure if i'm using well these new deps, should i use all apache 
sis 0.5 deps? or only sis-utility should work?

Exception in thread "main" java.lang.NoSuchFieldError: NAMES
     at org.geotoolkit.feature.type.DefaultName.<init>(DefaultName.java:103)
     at org.geotoolkit.feature.type.DefaultName.<init>(DefaultName.java:89)
     at org.geotoolkit.feature.xml.Utils.<clinit>(Utils.java:88)
     at 
org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.listAllSchemas(JAXBFeatureTypeReader.java:416)
     at 
org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.getAllFeatureTypeFromSchema(JAXBFeatureTypeReader.java:404)
     at 
org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.read(JAXBFeatureTypeReader.java:310)
     at 
org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.read(JAXBFeatureTypeReader.java:248)



Le 13/02/2015 11:31, Martin Desruisseaux a écrit :
>
> Hello Emmanuel
>
> Le 13/02/15 01:22, Emmanuel Blondel a écrit :
>> Indeed, this is what i was trying.. with 3.2 and 3.2.0, it still 
>> gives http://www.opengis.net/gml/3.2
>
> It is probably a bug. Could you try to download the source code, apply 
> the patch attached to this email and try again please?
>
>   * Download link:
>     http://www.apache.org/dyn/closer.cgi/sis/0.5/apache-sis-0.5-src.zip
>   * Something like the following commands in a Unix shell should work:
>
>     unzip apache-sis-0.5-src.zip
>     cd sis-0.5
>     patch -p0 < ../GML_version.patch
>     mvn install
>
>
>> For 3.1 / 3.1.1, i get a JAXBException.
>
> Can you post the stack trace? Even if "3.1" is not the desired value 
> here, I would like to see if it is easily fixable.
>
>     Martin
>
>


Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.com>.
Hello Emmanuel

Thanks for confirming that it works, this is appreciated!

We plan to release 0.6 shortly. That 0.6 release will be almost
identical to the current 0.6-jdk7-SNAPSHOT, so it should contains the
fix too.

    Regards,

        Martin


Le 16/09/15 18:47, Emmanuel Blondel a écrit :
> Hi Martin,
>
> I've seen that this patch has been applied in the current
> 0.6-jdk7-SNAPSHOT
> I've tested it and it works well.
>
> Thanks again for your support.


Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
Hi Martin,

I've seen that this patch has been applied in the current 0.6-jdk7-SNAPSHOT
I've tested it and it works well.

Thanks again for your support.

Le 13/02/2015 11:31, Martin Desruisseaux a écrit :
>
> Hello Emmanuel
>
> Le 13/02/15 01:22, Emmanuel Blondel a écrit :
>> Indeed, this is what i was trying.. with 3.2 and 3.2.0, it still 
>> gives http://www.opengis.net/gml/3.2
>
> It is probably a bug. Could you try to download the source code, apply 
> the patch attached to this email and try again please?
>
>   * Download link:
>     http://www.apache.org/dyn/closer.cgi/sis/0.5/apache-sis-0.5-src.zip
>   * Something like the following commands in a Unix shell should work:
>
>     unzip apache-sis-0.5-src.zip
>     cd sis-0.5
>     patch -p0 < ../GML_version.patch
>     mvn install
>
>
>> For 3.1 / 3.1.1, i get a JAXBException.
>
> Can you post the stack trace? Even if "3.1" is not the desired value 
> here, I would like to see if it is easily fixable.
>
>     Martin
>
>

-- 
*Emmanuel Blondel*
International Consultant | CEO
/Geographic Information Systems in Agronomy, Environment, Fishery & 
Marine Sciences/
41, Avenue du Vacayrial
81370 Saint Sulpice la Pointe, France
Tel: +33 (0) 6 45 97 87 52
Email: emmanuel.blondel1@gmail.com <ma...@gmail.com>

Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Emmanuel

Le 13/02/15 01:22, Emmanuel Blondel a écrit :
> Indeed, this is what i was trying.. with 3.2 and 3.2.0, it still gives
> http://www.opengis.net/gml/3.2

It is probably a bug. Could you try to download the source code, apply
the patch attached to this email and try again please?

  * Download link:
    http://www.apache.org/dyn/closer.cgi/sis/0.5/apache-sis-0.5-src.zip
  * Something like the following commands in a Unix shell should work:

    unzip apache-sis-0.5-src.zip
    cd sis-0.5
    patch -p0 < ../GML_version.patch
    mvn install


> For 3.1 / 3.1.1, i get a JAXBException.

Can you post the stack trace? Even if "3.1" is not the desired value
here, I would like to see if it is easily fixable.

    Martin



Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
Indeed, this is what i was trying.. with 3.2 and 3.2.0, it still gives 
http://www.opengis.net/gml/3.2
For 3.1 / 3.1.1, i get a JAXBException..

Le 13/02/2015 00:55, Martin Desruisseaux a écrit :
> Le 13/02/15 00:36, Emmanuel Blondel a écrit :
>> I've made some attempts, and finally, after debugging, i've noticed 
>> that the wrong Geonetwork UI behavior was not due temporal primitive 
>> xml representation, but simply.. to the gml schema used for 
>> MD_Metadata. Geotk 3.21 was relying on http://www.opengis.net/gml, 
>> moving to Apache SIS, the default GML version is the latest one: 
>> http://www.opengis.net/gml/3.2
>>
>> Previous GML versions seems unsupported..
>> I had found this ticket: 
>> https://issues.apache.org/jira/browse/SIS-160 which seems related to 
>> the above problem
>>
>> Any advice?
>
> I would suggest to try to set this property, in the same place than we 
> did previously for <gco:CharacterString>:
>
>     http://sis.apache.org/apidocs/org/apache/sis/xml/XML.html#GML_VERSION
>
> Try setting the property to "3.1". This is a very incomplete support 
> (really just scratching the surface), but if my memory serve me right 
> it would fix the namespace.
>
>     Martin
>
>


Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Le 13/02/15 00:36, Emmanuel Blondel a écrit :
> I've made some attempts, and finally, after debugging, i've noticed
> that the wrong Geonetwork UI behavior was not due temporal primitive
> xml representation, but simply.. to the gml schema used for
> MD_Metadata. Geotk 3.21 was relying on http://www.opengis.net/gml,
> moving to Apache SIS, the default GML version is the latest one:
> http://www.opengis.net/gml/3.2
>
> Previous GML versions seems unsupported..
> I had found this ticket: https://issues.apache.org/jira/browse/SIS-160
> which seems related to the above problem
>
> Any advice?

I would suggest to try to set this property, in the same place than we
did previously for <gco:CharacterString>:

    http://sis.apache.org/apidocs/org/apache/sis/xml/XML.html#GML_VERSION

Try setting the property to "3.1". This is a very incomplete support
(really just scratching the surface), but if my memory serve me right it
would fix the namespace.

    Martin



Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
I've made some attempts, and finally, after debugging, i've noticed that 
the wrong Geonetwork UI behavior was not due temporal primitive xml 
representation, but simply.. to the gml schema used for MD_Metadata. 
Geotk 3.21 was relying on http://www.opengis.net/gml, moving to Apache 
SIS, the default GML version is the latest one: 
http://www.opengis.net/gml/3.2

Previous GML versions seems unsupported..
I had found this ticket: https://issues.apache.org/jira/browse/SIS-160 
which seems related to the above problem

Any advice?

Emmanuel



Le 12/02/2015 23:26, Martin Desruisseaux a écrit :
>
> We do not yet have a temporal module in SIS. One tricky issue will be 
> to leverage java.time while keeping compatibility with JDK 6 and 7. We 
> are exploring avenues in the Geotk temporal module before porting to SIS.
>
> In the main time I would suggest to try the following: create a 
> DefaultPeriod subclass and implement IdentifiedObject as below:
>
>     import org.apache.sis.xml.IdentifierMap;
>     import org.apache.sis.xml.IdentifiedObject;
>     import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;
>
>     class IdentifiedPeriod extends DefaultPeriod implements IdentifiedObject {
>          private final List<Identifier> identifiers = new ArrayList<>();
>
>          @Override
>          public Collection<Identifier> getIdentifiers() {
>              return identifiers;
>          }
>
>          @Override
>          public IdentifierMap getIdentifierMap() {
>              return new IdentifierMapWithSpecialCases(identifiers);
>          }
>     }
>
> It would hopefully allow to use this period in the way proposed in my 
> previous email.
>
> About controlling the date format, we do not yet have an API for that 
> in SIS. This is part of the things to do when we will port the 
> temporal module. However in the main time, it may be possible to do 
> that by registering a custom JAXB adapter before marshalling. Are you 
> familiar with javax.xml.bind.annotation.adapters?
>
>     Martin
>
>
>
> Le 12/02/15 22:50, Emmanuel Blondel a écrit :
>> Thanks for the indications,
>>
>> I've tried your suggestion, on my side i use a DefaultPeriod to 
>> implement the TemporalPrimitive and specify it in the metadata 
>> temporal extent.
>> This is done by using the TemporalUtilities class:
>>
>> TemporalPrimitive temporalPrimitive = 
>> TemporalUtilities.createPeriod(startTime,endTime);
>> ((IdentifiedObject) 
>> temporalPrimitive).getIdentifierMap().putSpecialized(IdentifierSpace.ID, 
>> "test");
>>
>> I get the exception: /org.geotoolkit.temporal.object.DefaultPeriod 
>> cannot be cast to org.apache.sis.xml.IdentifiedObject/
>>
>> I'm also wondering (considering there would be ideally a workaround 
>> to this) how i could specify the period string format as id. Before, 
>> i was using Geotk 3.21 and DefaultPeriod. After marshalling the id 
>> was generated as shown below.
>>
>> Emmanuel
>


Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
We do not yet have a temporal module in SIS. One tricky issue will be to
leverage java.time while keeping compatibility with JDK 6 and 7. We are
exploring avenues in the Geotk temporal module before porting to SIS.

In the main time I would suggest to try the following: create a
DefaultPeriod subclass and implement IdentifiedObject as below:

    import org.apache.sis.xml.IdentifierMap;
    import org.apache.sis.xml.IdentifiedObject;
    import org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases;

    class IdentifiedPeriod extends DefaultPeriod implements IdentifiedObject {
        private final List<Identifier> identifiers = new ArrayList<>();

        @Override
        public Collection<Identifier> getIdentifiers() {
            return identifiers;
        }

        @Override
        public IdentifierMap getIdentifierMap() {
            return new IdentifierMapWithSpecialCases(identifiers);
        }
    }

It would hopefully allow to use this period in the way proposed in my
previous email.

About controlling the date format, we do not yet have an API for that in
SIS. This is part of the things to do when we will port the temporal
module. However in the main time, it may be possible to do that by
registering a custom JAXB adapter before marshalling. Are you familiar
with javax.xml.bind.annotation.adapters?

    Martin



Le 12/02/15 22:50, Emmanuel Blondel a écrit :
> Thanks for the indications,
>
> I've tried your suggestion, on my side i use a DefaultPeriod to
> implement the TemporalPrimitive and specify it in the metadata
> temporal extent.
> This is done by using the TemporalUtilities class:
>
> TemporalPrimitive temporalPrimitive =
> TemporalUtilities.createPeriod(startTime,endTime);
> ((IdentifiedObject)
> temporalPrimitive).getIdentifierMap().putSpecialized(IdentifierSpace.ID,
> "test");
>
> I get the exception: /org.geotoolkit.temporal.object.DefaultPeriod
> cannot be cast to org.apache.sis.xml.IdentifiedObject/
>
> I'm also wondering (considering there would be ideally a workaround to
> this) how i could specify the period string format as id. Before, i
> was using Geotk 3.21 and DefaultPeriod. After marshalling the id was
> generated as shown below.
>
> Emmanuel


Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
Thanks for the indications,

I've tried your suggestion, on my side i use a DefaultPeriod to 
implement the TemporalPrimitive and specify it in the metadata temporal 
extent.
This is done by using the TemporalUtilities class:

TemporalPrimitive temporalPrimitive = 
TemporalUtilities.createPeriod(startTime,endTime);
((IdentifiedObject) 
temporalPrimitive).getIdentifierMap().putSpecialized(IdentifierSpace.ID, 
"test");

I get the exception: /org.geotoolkit.temporal.object.DefaultPeriod 
cannot be cast to org.apache.sis.xml.IdentifiedObject/

I'm also wondering (considering there would be ideally a workaround to 
this) how i could specify the period string format as id. Before, i was 
using Geotk 3.21 and DefaultPeriod. After marshalling the id was 
generated as shown below.

Emmanuel


Le 12/02/2015 20:48, Martin Desruisseaux a écrit :
>
> Hello Emmanuel
>
> We do not yet have a mechanism computing automatically the ID (or at 
> least not every where). This is something for which I was hopping to 
> have more though. However gml:id can be explicitly set. Most SIS 
> metadata objects implement this interface:
>
>     http://sis.apache.org/apidocs/org/apache/sis/xml/IdentifiedObject.html
>
> So in many case, you should be able to write the following:
>
>     ((IdentifiedObject) metadata).getIdentifierMap().putSpecialized(IdentifierSpace.ID,*"PXA320"*)
>
> We can also set the UUID and XLink in the same way.
>
> However in the particular case of <gml:TimePeriod>, I'm not sure if 
> the TemporalPrimitive implements the above-cited IdentifiedObject 
> interface. If you get a ClassCastException, please let us know - we 
> will propose a workaround.
>
> As a side note, if you choose to use UUID or XLink, there is a 
> mechanism for resolving those identifiers (for example by using the 
> UUID for searching the associated metadata in some internal database):
>
>     http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html
>
> You can implement this interface, then give your implementation to the 
> properties map in a way similar to what we did in the previous email 
> for configuring <gco:CharacterString>.
>
>     Martin
>
>
>
> Le 12/02/15 20:16, Emmanuel Blondel a écrit :
>> Hello,
>>
>> Moving now from geotoolkit metadata to apache SIS.
>>
>> This is what i had with geotoolkit:
>>
>>             <gmd:EX_TemporalExtent>
>>                 <gmd:extent>
>>                   <gml:TimePeriod *gml:id="PXA32O"*>
>> <gml:beginPosition>2006-12-31</gml:beginPosition>
>> <gml:endPosition>2015-12-30</gml:endPosition>
>>                   </gml:TimePeriod>
>>                 </gmd:extent>
>>               </gmd:EX_TemporalExtent>
>>
>> Now moving to Apache SIS, i don't have any gml id for the TimePeriod.
>>
>> I'm publishing metadata in Geonetwork, and the absence of this 
>> TimePeriod id causes a misinterpretation of the metadata.
>>
>> Can you explain why this identifier is missing in Apache SIS? Is it 
>> related to the comment given here: 
>> https://github.com/apache/sis/blob/5b8a836588ab5e94a3cc164f7e6b3b202774407a/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java#L44
>>
>> Thanks in advance for your advice,
>> Emmanuel
>


Re: Question about TimePeriod & auto-generated id

Posted by Emmanuel Blondel <em...@gmail.com>.
Hi Martin,

I wanted to thank you for this helper, it works perfectly.
I'm wondering if it would be worth handling this in 
/TemporalUtilities.createPeriod(start,end)/, as the id for timePeriod 
seems to be mandatory in gml schemas.
Before applying this, i was getting a schema validation error by 
checking against the GML schemas.
But this would suppose that Apache SIS could generate period as ISO 8601 
string (which is expected as gml Id for the time period).

Thanks again,
Emmanuel

Le 12/02/2015 20:48, Martin Desruisseaux a écrit :
>
> Hello Emmanuel
>
> We do not yet have a mechanism computing automatically the ID (or at 
> least not every where). This is something for which I was hopping to 
> have more though. However gml:id can be explicitly set. Most SIS 
> metadata objects implement this interface:
>
>     http://sis.apache.org/apidocs/org/apache/sis/xml/IdentifiedObject.html
>
> So in many case, you should be able to write the following:
>
>     ((IdentifiedObject) metadata).getIdentifierMap().putSpecialized(IdentifierSpace.ID,*"PXA320"*)
>
> We can also set the UUID and XLink in the same way.
>
> However in the particular case of <gml:TimePeriod>, I'm not sure if 
> the TemporalPrimitive implements the above-cited IdentifiedObject 
> interface. If you get a ClassCastException, please let us know - we 
> will propose a workaround.
>
> As a side note, if you choose to use UUID or XLink, there is a 
> mechanism for resolving those identifiers (for example by using the 
> UUID for searching the associated metadata in some internal database):
>
>     http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html
>
> You can implement this interface, then give your implementation to the 
> properties map in a way similar to what we did in the previous email 
> for configuring <gco:CharacterString>.
>
>     Martin
>
>
>
> Le 12/02/15 20:16, Emmanuel Blondel a écrit :
>> Hello,
>>
>> Moving now from geotoolkit metadata to apache SIS.
>>
>> This is what i had with geotoolkit:
>>
>>             <gmd:EX_TemporalExtent>
>>                 <gmd:extent>
>>                   <gml:TimePeriod *gml:id="PXA32O"*>
>> <gml:beginPosition>2006-12-31</gml:beginPosition>
>> <gml:endPosition>2015-12-30</gml:endPosition>
>>                   </gml:TimePeriod>
>>                 </gmd:extent>
>>               </gmd:EX_TemporalExtent>
>>
>> Now moving to Apache SIS, i don't have any gml id for the TimePeriod.
>>
>> I'm publishing metadata in Geonetwork, and the absence of this 
>> TimePeriod id causes a misinterpretation of the metadata.
>>
>> Can you explain why this identifier is missing in Apache SIS? Is it 
>> related to the comment given here: 
>> https://github.com/apache/sis/blob/5b8a836588ab5e94a3cc164f7e6b3b202774407a/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java#L44
>>
>> Thanks in advance for your advice,
>> Emmanuel
>

-- 
*Emmanuel Blondel*
International Consultant | CEO
/Geographic Information Systems in Agronomy, Environment, Fishery & 
Marine Sciences/
41, Avenue du Vacayrial
81370 Saint Sulpice la Pointe, France
Tel: +33 (0) 6 45 97 87 52
Email: emmanuel.blondel1@gmail.com <ma...@gmail.com>

Re: Question about TimePeriod & auto-generated id

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Hello Emmanuel

We do not yet have a mechanism computing automatically the ID (or at
least not every where). This is something for which I was hopping to
have more though. However gml:id can be explicitly set. Most SIS
metadata objects implement this interface:

    http://sis.apache.org/apidocs/org/apache/sis/xml/IdentifiedObject.html

So in many case, you should be able to write the following:

    ((IdentifiedObject) metadata).getIdentifierMap().putSpecialized(IdentifierSpace.ID, *"PXA320"*)

We can also set the UUID and XLink in the same way.

However in the particular case of <gml:TimePeriod>, I'm not sure if the
TemporalPrimitive implements the above-cited IdentifiedObject interface.
If you get a ClassCastException, please let us know - we will propose a
workaround.

As a side note, if you choose to use UUID or XLink, there is a mechanism
for resolving those identifiers (for example by using the UUID for
searching the associated metadata in some internal database):

    http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html

You can implement this interface, then give your implementation to the
properties map in a way similar to what we did in the previous email for
configuring <gco:CharacterString>.

    Martin



Le 12/02/15 20:16, Emmanuel Blondel a écrit :
> Hello,
>
> Moving now from geotoolkit metadata to apache SIS.
>
> This is what i had with geotoolkit:
>
>             <gmd:EX_TemporalExtent>
>                 <gmd:extent>
>                   <gml:TimePeriod *gml:id="PXA32O"*>
>                     <gml:beginPosition>2006-12-31</gml:beginPosition>
>                     <gml:endPosition>2015-12-30</gml:endPosition>
>                   </gml:TimePeriod>
>                 </gmd:extent>
>               </gmd:EX_TemporalExtent>
>
> Now moving to Apache SIS, i don't have any gml id for the TimePeriod.
>
> I'm publishing metadata in Geonetwork, and the absence of this
> TimePeriod id causes a misinterpretation of the metadata.
>
> Can you explain why this identifier is missing in Apache SIS? Is it
> related to the comment given here:
> https://github.com/apache/sis/blob/5b8a836588ab5e94a3cc164f7e6b3b202774407a/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java#L44
>
> Thanks in advance for your advice,
> Emmanuel