[redland-dev] Does Rasqal support xsd:dataType?

Hyunki Kim hkk at etri.re.kr
Tue Apr 25 02:11:44 BST 2006


Dear members,

Many thanks to Andy and Christopher.

According to Andy's comments, I fixed the SPARQL query statement and the
sample RDF document as follows:

1. SPARQL query

PREFIX dc:         <http://purl.org/dc/elements/1.1/>
PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>
SELECT ?d
WHERE { 
    ?x  dc:date ?d . 
    FILTER ( datatype(?d) = <http://www.w3.org/2001/XMLSchema#dateTime> ) }

2. RDF document

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:dc="http://purl.org/dc/elements/1.1/">
  <rdf:Description rdf:about="file:///purl.org/net/dajobe/">
    <dc:title>Dave Beckett's Home Page</dc:title>
    <dc:creator>Dave Beckett</dc:creator>
    <dc:description>The generic home page of Dave Beckett.</dc:description>
    <dc:date
rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2006-04-14T16:33:01
</dc:date>
  </rdf:Description>
</rdf:RDF>

However, I found that the current version of Redland does not support the
DATATYPE operator (http://librdf.org/rasqal/TODO.html).
In addition, I had no results when I issued the query to Redland mysql
storage.
Contary to the Redland mysql storage, when I queried to memory storage, I
had a result.
I would appreciate any kind of hints.
Thanks.

Kim



-----Original Message-----
From: Seaborne, Andy [mailto:andy.seaborne at hp.com] 
Sent: Monday, April 24, 2006 11:26 PM
To: Christopher Schmidt; Hyunki Kim
Cc: redland-dev at lists.librdf.org
Subject: RE: [redland-dev] Does Rasqal support xsd:dataType?





-------- Original Message --------
> From: Christopher Schmidt <>
> Date: 24 April 2006 13:55
> 
> On Mon, Apr 24, 2006 at 05:14:55PM +0900, Hyunki Kim wrote:
> > Hi,
> > 
> > After inserting a RDF document to the mysql, I had a problem in 
> > querying with the following SPARQL statement.
> 
> Use this instead:
> 
> 1. SPARQL Query
> prefix dc:         <http://purl.org/dc/elements/1.1/>
> PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>
> SELECT ?d
> WHERE { ?x  dc:date ?d^^<xsd:dateTime> . }#

The SPARQL idiom would be:

{ ?x  dc:date ?d . FILTER ( datatype(?d) = <xsd:dateTime> ) }

but note that the <> is an absolute URI, and not a qname related to the XSD
datatype dateTime.

The SPARQL grammar does not allow ?d^^<....>

In full:

prefix dc:         <http://purl.org/dc/elements/1.1/>
PREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>
SELECT ?d
WHERE { 
    ?x  dc:date ?d . 
    FILTER ( datatype(?d) = xsd:dateTime ) }

removing the <> on the prefixed name to get
http://www.w3.org/2001/XMLSchema#dateTime

	Andy

> 
> 
> or similar ... I'm not actually sure what the format for rdf datatypes 
> is with NS prefixes: you can definitely use:
> 
> WHERE { ?x  dc:date ?d^^<http://www.w3.org/2001/XMLSchema#dateTime> .
}
> 
> If the above doesn't work.
> 
> --
> Christopher Schmidt
> Web Developer



More information about the redland-dev mailing list