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

Geert Josten Geert.Josten at marklogic.com
Fri Jan 8 02:09:36 PST 2016

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,

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


there is no comment yet on my posting concerning “FILTER conditions with xsd constants”, which can be found at

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,

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

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>

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>)
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>

       ?s onto:birthDate ?bd .
        FILTER (?bd != "1999-01-01"^^xsd:date)

<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,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20160108/92f9bbd2/attachment-0001.html 

More information about the General mailing list