[GeoNetwork-devel] GetRecords with OCG Filter for date&Time

I am using Genetwork v2.6.3.

I am trying to submit a GetRecord request with an OGC filter in order to select data on the basis of tempExtent_begin (both date and time).

I tried the following query, but they gave me the same results.

--- DATE AND TIME
<?xml version="1.0"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
     xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW" outputSchema="http://www.isotc211.org/2005/gmd&quot; version="2.0.2" resultType="results" outputFormat="application/xml" startPosition="1" maxRecords="30">
<csw:Query typeNames="gmd:MD_Metadata">
<ElementSetName>summary</ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<PropertyIsGreaterThanOrEqualTo>
<PropertyName>tempExtent_begin</PropertyName>
<Literal>2010-10-14T16:42:00</Literal>
</PropertyIsGreaterThanOrEqualTo>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

--- DATE
<?xml version="1.0"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
     xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW" outputSchema="http://www.isotc211.org/2005/gmd&quot; version="2.0.2" resultType="results" outputFormat="application/xml" startPosition="1" maxRecords="30">
<csw:Query typeNames="gmd:MD_Metadata">
<ElementSetName>summary</ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<PropertyIsGreaterThanOrEqualTo>
<PropertyName>tempExtent_begin</PropertyName>
<Literal>2010-10-14</Literal>
</PropertyIsGreaterThanOrEqualTo>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

I am wondering if the problem could be due to the format of the date&time in the Metadata (Format YYYY-MM-DDThh:mm:ss).

Thanks in advance for the help.

Raffaella

--

________________________________________
Raffaella Ratti
Earth Observation Dept

Tel.: +39.0238048.205
Fax: +39.023086458
Email: rratti@anonymised.com

CGS S.p.A.
Compagnia Generale per lo Spazio
An OHB Technology Company
Via Gallarate, 150
20151 Milano MI - Italy
Website: www.cgspace.it

<< Le informazioni contenute in questo messaggio di posta elettronica e relativi allegati sono riservate e confidenziali e ne è vietata la diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a darcene gentile comunicazione. Quanto precede ai fini del rispetto delle Legge 675/96 e del Decreto Legislativo 30/06/2003 n.196, sulla tutela dei dati personali>>

<< This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person: to do so could be a breach of confidence. Thank you for your co-operation. Please contact our IT Helpdesk on +3902380481 or email ml_servizi.informatici@anonymised.com if you need assistance>>

Hi Raffaella,

You may need to put a 'Z' suffix on your <Literal> date strings as all date_times
are stored as UTC time in Lucene.

As I recall tempExtent_begin and tempExtent_end are stored as UTC
times in IS08601 format in Lucene index and the Lucene index is what is queried.

The following was the conversion behaviour from IS08601 dates in the XML metadata
to dates in Lucene:-

(Developers, correct me if this behaviour had changed, its been a while since I looked)

1) date/time suffixed with 'Z' remain unconverted i.e the time remains in GMT

2) date/time with no suffix are assumed to be local times and are converted
to GMT based on time zone of the local computer by lucene. e.g if you entered
2007-06-01T00:00 (in Sydney GMT+10) it would be converted to
2007-05-31T14:00:00.00Z for storage in Lucene's index.

3) date/times with a time zone offset e.g +10:00 have the offset added or subtracted
as appropriate for conversion back to GMT. e.g if I entered 2007-12-04T00:00+10:00
in the XML file it is converted to 2007-12-03T14:00:00.000Z in lucene index

This example query has worked fine for me with CSW:

<?xml version="1.0" encoding="UTF-8"?>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot; xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:And>

    <ogc:PropertyIsGreaterThanOrEqualTo>
          <ogc:PropertyName>TempExtent_begin</ogc:PropertyName>
           <ogc:Literal>1990-01-01T22:21:56.000Z</ogc:Literal>
     </ogc:PropertyIsGreaterThanOrEqualTo>

<ogc:PropertyIsLessThanOrEqualTo>
          <ogc:PropertyName>TempExtent_end</ogc:PropertyName>
           <ogc:Literal>2009-12-31Z</ogc:Literal>
     </ogc:PropertyIsLessThanOrEqualTo>

</ogc:And>

</ogc:Filter>

HTH

Andrew

----- Original Message ----- From: "Raffaella Ratti" <rratti@anonymised.com>
To: <GeoNetwork-devel@lists.sourceforge.net>
Sent: Friday, May 27, 2011 1:49 AM
Subject: [GeoNetwork-devel] GetRecords with OCG Filter for date&Time

I am using Genetwork v2.6.3.

I am trying to submit a GetRecord request with an OGC filter in order to
select data on the basis of tempExtent_begin (both date and time).

I tried the following query, but they gave me the same results.

--- DATE AND TIME
<?xml version="1.0"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
    xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW"
outputSchema="http://www.isotc211.org/2005/gmd&quot; version="2.0.2"
resultType="results" outputFormat="application/xml" startPosition="1"
maxRecords="30">
<csw:Query typeNames="gmd:MD_Metadata">
<ElementSetName>summary</ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<PropertyIsGreaterThanOrEqualTo>
<PropertyName>tempExtent_begin</PropertyName>
<Literal>2010-10-14T16:42:00</Literal>
</PropertyIsGreaterThanOrEqualTo>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

--- DATE
<?xml version="1.0"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2&quot;
    xmlns:gmd="http://www.isotc211.org/2005/gmd&quot; service="CSW"
outputSchema="http://www.isotc211.org/2005/gmd&quot; version="2.0.2"
resultType="results" outputFormat="application/xml" startPosition="1"
maxRecords="30">
<csw:Query typeNames="gmd:MD_Metadata">
<ElementSetName>summary</ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<PropertyIsGreaterThanOrEqualTo>
<PropertyName>tempExtent_begin</PropertyName>
<Literal>2010-10-14</Literal>
</PropertyIsGreaterThanOrEqualTo>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>

I am wondering if the problem could be due to the format of the
date&time in the Metadata (Format YYYY-MM-DDThh:mm:ss).

Thanks in advance for the help.

Raffaella

--

________________________________________
Raffaella Ratti
Earth Observation Dept

Tel.: +39.0238048.205
Fax: +39.023086458
Email: rratti@anonymised.com

CGS S.p.A.
Compagnia Generale per lo Spazio
An OHB Technology Company
Via Gallarate, 150
20151 Milano MI - Italy
Website: www.cgspace.it

<< Le informazioni contenute in questo messaggio di posta elettronica e relativi allegati sono riservate e confidenziali e ne è vietata la diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a darcene gentile comunicazione. Quanto precede ai fini del rispetto delle Legge 675/96 e del Decreto Legislativo 30/06/2003 n.196, sulla tutela dei dati personali>>

<< This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person: to do so could be a breach of confidence. Thank you for your co-operation. Please contact our IT Helpdesk on +3902380481 or email ml_servizi.informatici@anonymised.com if you need assistance>>

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi Andrew,

thanks for your answer.

I tried to put the suffix ‘Z’ but it seems that it considers only date values (YYYY-MM-DD). It does not consider time values (T22:21:56.000Z).

Afterwards I tried the following filters in oder to select metadata whose tempExtent_begin (gml:beginPosition) tag is compliant to a defined format

Filter 1 (Format YYYY-MM-DD+wildCard)
<Filter xmlns=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml”>

tempExtent_begin
____--%

Filter 2 (Format YYYY-MM-DDT+wildCard)
<Filter xmlns=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml”>

tempExtent_begin
____-__-__T%

The first filter returns all metadata with tempExtent_begin (gml:beginPosition) tag, without considering their format.
The second filter returns 0 hits.

Thanks for the help

Raffaella

l 27/05/2011 3.21, andrew walsh ha scritto:

···
-- 
________________________________________
Raffaella Ratti
Earth Observation Dept

Tel.:    +39.0238048.205
Fax:     +39.023086458
Email:   [rratti@anonymised.com](mailto:rratti@anonymised.com)

CGS S.p.A.
Compagnia Generale per lo Spazio
An OHB Technology Company
Via Gallarate, 150 
20151 Milano MI - Italy
Website: [www.cgspace.it](http://www.cgspace.it) 

<< Le informazioni contenute in questo messaggio di posta elettronica e relativi allegati sono riservate e confidenziali e ne è vietata la diffusione in qualunque modo eseguita. Qualora Lei non fosse la persona a cui il presente messaggio è destinato, La invitiamo ad eliminarlo e a darcene gentile comunicazione. Quanto precede ai fini del rispetto delle Legge 675/96 e del Decreto Legislativo 30/06/2003 n.196, sulla tutela dei dati personali >>

 

<< This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status. Please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person: to do so could be a breach of confidence. Thank you for your co-operation. Please contact our IT Helpdesk on +3902380481 or email [ml_servizi.informatici@anonymised.com](mailto:ml_servizi.informatici@anonymised.com) if you need assistance >>