Hi Andy,
thanks for the quick reply – though I'm not yet sure I completely
understand what you're saying:
I thought that xsd:dateTime was one of the datatypes to be used for
sparql queries!?
Kindly asking for further explanation… – PLEASE!
So here, again, the complete samples:
PREFIX html: <http://www.w3.org/1999/xhtml>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <urn:ietf:params:xml:schema:>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX age:
<http://online-management-kontor.de/downloads/age-de-xsd-beta_110815>
PREFIX i18n21:<http://apache.org/cocoon/i18n/2.1>
PREFIX xliff: <urn:oasis:names:tc:xliff:document:1.2>
PREFIX cnt: <http://namespaces.semaworx.org/content#>
PREFIX timed: <http://namespaces.semaworx.org/timed#>
PREFIX ident: <http://namespaces.semaworx.org/identity#>
CONSTRUCT {
?PageIR rdf:type cnt:page ;
dct:Identifier ?uIdentifier ;
dct:hasVersion ?Version .
?Version rdf:type timed:versionedContent ;
dct:date ?Date ;
dct:title ?Title ;
dct:description ?Description ;
age:x-content-age ?Age .
}
WHERE {
?PageIRI rdf:type cnt:page ;
dct:Identifier ?uIdentifier ;
dct:hasVersion ?Version .
{
{?Version rdf:type timed:versionedContent ;
dct:publisher "semawine" ;
dct:date ?Date ;
timed:hasValidTimeStart ?Start ;
timed:hasValidTimeEnd ?End ;
dc:language "de-de" ;
dct:coverage "de" ;
age:x-content-age ?Age ;
dct:title ?Title ;
cnt:i18nslug "Nicht-gefunden-Fehler-404"@de-de ;
dct:description ?Description .
FILTER langMatches(lang(?Description),"de-de")
}
FILTER langMatches(lang(?Title),"de-de")
}
FILTER ( xsd:dateTime(?Start) < xsd:dateTime(?End) )
}
And here the working Minimum-Tree:
<!DOCTYPE rdf:RDF [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>
<rdf:RDF xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs= "http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd= "urn:ietf:params:xml:schema:"
xmlns:dc= "http://purl.org/dc/elements/1.1/"
xmlns:dct= "http://purl.org/dc/terms/"ns#"
xmlns:age=
"http://online-management-kontor.de/downloads/age-de-xsd-beta_110815"
xmlns:i18n21= "http://apache.org/cocoon/i18n/2.1"
xmlns:xliff= "urn:oasis:names:tc:xliff:document:1.2"
xmlns:cnt= "http://namespaces.semaworx.org/content#"
xmlns:timed= "http://namespaces.semaworx.org/timed#"
xmlns:ident= "http://namespaces.semaworx.org/identity#"
>
<rdf:Description rdf:about=
"http://resources.semaworx.eu/content/pages/pageincrediblyuniqueid002">
<rdf:type rdf:resource= "http://namespaces.semaworx.org/content#page" />
<dct:Identifier>error404</dct:Identifier>
<dc:creator rdf:resource=
"http://resources.semaworx.eu/ident/user#regUserxxxtheuniqueuserid001xxx" />
<dct:created>2013-01-10T00:08:00+01:00</dct:created>
<dct:hasVersion rdf:resource=
"http://resources.semaworx.eu/timed/version#versioncrediblyuniqueid010" />
</rdf:Description>
<rdf:Description rdf:about=
"http://resources.semaworx.eu/timed/version#versioncrediblyuniqueid010">
<rdf:type rdf:resource=
"http://namespaces.semaworx.org/timed#versionedContent"/>
<dct:isVersionOf rdf:resource=
"http://resources.semaworx.eu/content/pages/pageincrediblyuniqueid002" />
<dct:format rdf:resource=
"http://purl.org/NET/mediatypes/application/xhtml+xml" />
<cnt:webapp>yes</cnt:webapp>
<dc:language>de-de</dc:language>
<dc:language>en-us</dc:language>
<dct:coverage>de</dct:coverage>
<dct:coverage>us</dct:coverage>
<age:x-content-age>14</age:x-content-age>
<cnt:i18nslug xml:lang="de-de">Nicht-gefunden-Fehler-404</cnt:i18nslug>
<cnt:i18nslug xml:lang="en-us">not-found-404-error</cnt:i18nslug>
<dct:title xml:lang="de-de">Fehler 404 – diese Seite gibt es
nicht</dct:title>
<dct:title xml:lang="en-us">Error 404 – page could not be found</dct:title>
<dct:subject>HTTP 404 Fehlerseite</dct:subject>
<dct:description xml:lang="de-de">Hier sind Sie leider total
verkehrt!</dct:description>
<dct:description xml:lang="en-us">Hm. You're not supposed to land
here…</dct:description>
<dct:publisher>semawine</dct:publisher>
<dc:creator rdf:resource=
"http://resources.semaworx.eu/ident/user#regUserxxxtheuniqueuserid001xxx" />
<dct:created>2013-03-10T00:08:00+01:00</dct:created>
<dct:date>2013-03-10T00:08:00+01:00</dct:date>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid001"
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid002"
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid003"
/>
<timed:hasValidTimeStart rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2006-09-16T15:48:21Z</timed:hasValidTimeStart>
<timed:hasValidTimeEnd rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2006-09-17T15:48:24Z</timed:hasValidTimeEnd>
</rdf:Description>
<rdf:RDF>
On 11.10.13 14:59, Andy Seaborne wrote:
On 11/10/13 13:46, Bardo Nelgen wrote:
Dear List,
just ran into an issue with the following filter returning *no* match,
despite the respective elements happily living on the Graph tree.
FILTER ( xsd:dateTime(?Start) < xsd:dateTime(?End) )
Here come the samples:
*Query* (omitted the prefixes, since these obviously work as desired…)
Please do not omit prefixes nor give incomplete data fragments - if
someone else is going to execute the query on the data, they need a
complete, minimal example.
Your data has:
<timed:hasValidTimeStart rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2013-09-16T15:48:21Z</timed:hasValidTimeStart>
<timed:hasValidTimeEnd rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2013-09-17T15:48:24Z</timed:hasValidTimeEnd>
"2013-09-16T15:48:21Z"^^<urn:ietf:params:xml:schema:dateTime>
You can not cast a <urn:ietf:params:xml:schema:dateTime> to an
xsd:dateTime (unless you add undertanding of
<urn:ietf:params:xml:schema:dateTime> to ARQ).
Instead, extract the lexicial part and cast that.
FILTER ( xsd:dateTime(str(?Start)) < xsd:dateTime(str(?End)) )
Andy
CONSTRUCT {
?PageIRI rdf:type cnt:page ;
dct:Identifier ?uIdentifier ;
dct:hasVersion ?Version .
?Version rdf:type timed:versionedContent ;
dct:title ?Title ;
dct:description ?Description .
}
WHERE {
?PageIRI rdf:type cnt:page ;
dct:Identifier ?uIdentifier ;
dct:hasVersion ?Version .
{
{?Version rdf:type timed:versionedContent ;
dct:publisher "semawine" ;
timed:hasValidTimeStart ?Start ;
timed:hasValidTimeEnd ?End ;
dc:language "de-de" ;
dct:coverage "de" ;
dct:title ?Title ;
cnt:i18nslug "Nicht-gefunden-Fehler-404"@de-de ;
dct:description ?Description .
FILTER langMatches(lang(?Description),"de-de")
}
FILTER langMatches(lang(?Title),"de-de")
}
FILTER ( xsd:dateTime(?Start) < xsd:dateTime(?End) )
}
It's just this very last filter, which does not work (always produces an
empty result).
As soon as I remove the filter, the query instantly produces the desired
result, thus confirming there is nothing wrong e.g. with the causalities
inside the WHERE clause.
The graph in question goes:
<rdf:Description rdf:about=
"http://resources.semaworx.eu/timed/version#versioncrediblyuniqueid010">
<rdf:type rdf:resource=
"http://namespaces.semaworx.org/timed#versionedContent"/>
<dct:isVersionOf rdf:resource=
"http://resources.semaworx.eu/content/pages/pageincrediblyuniqueid002" />
<dct:format rdf:resource=
"http://purl.org/NET/mediatypes/application/xhtml+xml" />
<cnt:webapp>yes</cnt:webapp>
<dc:language>de-de</dc:language>
<dc:language>en-us</dc:language>
<dct:coverage>de</dct:coverage>
<dct:coverage>us</dct:coverage>
<age:x-content-age>14</age:x-content-age>
<cnt:i18nslug xml:lang="de-de">Nicht-gefunden-Fehler-404</cnt:i18nslug>
<cnt:i18nslug xml:lang="en-us">not-found-404-error</cnt:i18nslug>
<dct:title xml:lang="de-de">Fehler 404 – diese Seite gibt es
nicht</dct:title>
<dct:title xml:lang="en-us">Error 404 – page could not be
found</dct:title>
<dct:subject>HTTP 404 Fehlerseite</dct:subject>
<dct:description xml:lang="de-de">Hier sind Sie leider total
verkehrt!</dct:description>
<dct:description xml:lang="en-us">Hm. You certainly shouldn't be
here…</dct:description>
<dct:publisher>semawine</dct:publisher>
<dc:creator rdf:resource=
"http://resources.semaworx.eu/ident/user#regUserxxxtheuniqueuserid001xxx"
/>
<dct:created>2013-09-10T00:08:00+01:00</dct:created>
<dct:date>2013-09-10T00:08:00+01:00</dct:date>
<gml:Point rdf:resource= "urn:ogc:def:crs:EPSG:6:6:4326" />
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid001"
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid002"
/>
<dct:hasPart rdf:resource=
"http://resources.semaworx.eu/content/elements/elementincrediblyuniqueid003"
/>
<timed:hasValidTimeStart rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2013-09-16T15:48:21Z</timed:hasValidTimeStart>
<timed:hasValidTimeEnd rdf:datatype=
"urn:ietf:params:xml:schema:dateTime"
>2013-09-17T15:48:24Z</timed:hasValidTimeEnd>
</rdf:Description>
I'll be very glad to receive any hint on where I may possibly have
gotten the usage wrong.
Best,
Bardo