[MarkLogic Dev General] WG: FILTER conditions with xsd constants

Weissenberg, Norbert Norbert.Weissenberg at isst.fraunhofer.de
Fri Jan 8 05:25:24 PST 2016


Hi Geert,

okay, that works. Thank you. Such small errors are hard to find.

But it is still funny that when using the wrong prefix XMLSchema/
an unequal comparison of dates by   FILTER (?birthdate != "1999-01-01"^^xsd:date)
returns  results like "--07-01"^^xs:gMonthDay (i.e. calendar day recurring each calendar year),
although birthdate is an xsd:date. With the right prefix the result is right.


A related problem I have with dataTime comparisons. E.g. Dublin Core has property dc:created.
The namespace is PREFIX dc: <http://purl.org/dc/elements/1.1/> (ending /, from the Semantics Guide)
In RDF I used         <dc:created rdf:datatype="xsd:dateTime">2014-12-13T08:42:11.265Z</dc:created>
with the corrected xsd prefix.

But SPARQL queries with a filter like
     dc:created ?dt.
  FILTER (?dt > "2010-12-13T08:40:00"^^xsd:dateTime)
always return no results.

The following questions result:

-  Is the dc prefix correct?

-  Is the datatype of dc:created correct for MarkLogic, or should it be a date, not a timestamp?

-  Is the dateTime value format  correct for MarkLogic?

Kind regards,
  Norbert

Von: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] Im Auftrag von Geert Josten
Gesendet: Freitag, 8. Januar 2016 11:10
An: MarkLogic Developer Discussion
Betreff: Re: [MarkLogic Dev General] WG: FILTER conditions with xsd constants

Hi Norbert,

It turns out there is a typo in the documentation. The xsd PREFIX is incorrect, it should be:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

E.g. the ending slash should have been a hash sign. Docs will be fixed, thanks for reporting!

Kind regards,
Geert

From: <general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com>> on behalf of "Weissenberg, Norbert" <Norbert.Weissenberg at isst.fraunhofer.de<mailto:Norbert.Weissenberg at isst.fraunhofer.de>>
Reply-To: MarkLogic Developer Discussion <general at developer.marklogic.com<mailto:general at developer.marklogic.com>>
Date: Thursday, January 7, 2016 at 11:09 AM
To: "general at developer.marklogic.com<mailto:general at developer.marklogic.com>" <general at developer.marklogic.com<mailto:general at developer.marklogic.com>>
Subject: [MarkLogic Dev General] WG: FILTER conditions with xsd constants

Hello,

there is no comment yet on my posting concerning "FILTER conditions with xsd constants", which can be found at
http://developer.marklogic.com/pipermail/general/2015-December/018414.html

It e.g. deals with problems executing a simple query sample from the Semantics Developer's Guide using ML 8.0-4.
What's wrong?

Best regards,
   Norbert

Von: Weissenberg, Norbert
Gesendet: Montag, 21. Dezember 2015 11:39
An: 'general at developer.marklogic.com<mailto:'general at developer.marklogic.com>'
Betreff: FILTER conditions with xsd constants

Hello,
I have some difficulties using FILTER conditions with xsd constants. Some samples:

1) The SPARQL query from MarkLogic Semantics Developer's Guide page 92 behaves differently in ML 8.0-3.2 and ML 8.0-4
(both in Query Console, with dbPedia ttl data imported as described):

PREFIX onto: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>

SELECT ?s
WHERE {?s rdf:type foaf:Person .
       ?s onto:birthDate ?bd .
       FILTER (?bd > "1999-01-01"^^xsd:date)
}

This query is in the older 8.0-3.2 version of the guide on page 91, but unchanged.

ML 8.0-3.2 returns:
your query returned an empty sequence

ML 8.0-4 returns:
[1.0-ml] XDMP-SPQLNOINEQ: amped-qconsole:qconsole-sparql($query, (), (), (), ()) -- Inequality operations are not supported on values of unknown type, unsupport type, or schema invalid values: "1999-01-01"^^<http://www.w3.org/2001/XMLSchema/date>
Stack Trace

At line 4 column 15:
In xdmp:eval("import module namespace amped-qconsole = &quot;http://marklogic....", (fn:QName("","query"), "# Semantics Guide page 92&#10;&#10;PREFIX onto: <http://dbpedia...."), <options xmlns="xdmp:eval"<http://dbpedia....%22),%20%3coptions%20xmlns=%22xdmp:eval%22>><database>17903852568952700635</database><modules>25934252216363...</options>)
2.
3. PREFIX onto: <http://dbpedia.org/ontology/>
4. PREFIX foaf: <http://xmlns.com/foaf/0.1/>
...


2) The following query variant returns birthDates of type xs:gMonthDay (???) in both ML  versions:

PREFIX onto: <http://dbpedia.org/ontology/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>

SELECT *
WHERE {
       ?s onto:birthDate ?bd .
        FILTER (?bd != "1999-01-01"^^xsd:date)
}
LIMIT 100

<http://dbpedia.org/resource/A._E._J._Collins>              "--08-18"^^xs:gMonthDay
<http://dbpedia.org/resource/A._F._M._Ahsanuddin_Chowdhury>      "--07-01"^^xs:gMonthDay
...

but without the FILTER line the birthDate is okay, but the order of results is changed:

<http://dbpedia.org/resource/%22Dr._Death%22_Steve_Williams>       "1960-05-14"^^xs:date
<http://dbpedia.org/resource/%22Irish%22_Teddy_Mann>       "1951-09-05"^^xs:date
...

3) The same problems occur when comparing e.g. integers: although they are correctly tagged: (a simple query returns e.g. "30"^^<xsd:integer>),
a FILTER (?d > "3"^^xsd:integer)  in 8.0.4 again returns the error from 1): Inequality operations are not supported on values of unknown type

Best regards and seasons greatings,
   Norbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20160108/ccfb0a9a/attachment-0001.html 


More information about the General mailing list