W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2004

use a QName as variable identifier

From: Alberto Reggiori <alberto@asemantics.com>
Date: Mon, 1 Nov 2004 14:51:13 +0100
Message-Id: <17F4604A-2C0D-11D9-90D4-0011242E4018@asemantics.com>
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>


hi all,

while implementing the newer XML format to serialize query results  
proposed by Dave Beckett

	http://lists.w3.org/Archives/Public/public-rdf-dawg/2004JulSep/ 
0565.html

it came to my mind a simple use-case where the user wants to prefix  
each variable with a meaningful namespace

PREFIX dc:  <http://foo.com/foo/>
PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
PREFIX my:  <http://foo.com/my/namespace/>
SELECT ?my:name ?my:title
FROM <file:foo6.rdf>
WHERE
    (?person rdf:type foaf:Person)
    (?person foaf:name ?my:name)
    (?person dc:title ?my:title)

where foo6.rdf is

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:foaf="http://xmlns.com/foaf/0.1/" >

<foaf:Person foaf:name="Some Name" dc:title="Some Title" />

</rdf:RDF>

and use the PREFIX namespace into the XML serialization

<?xml version="1.0"?>
<results xmlns='http://www.w3.org/sw/2001/DataAccess/result1#'
  xmlns:my='http://foo.com/my/namespace/' >
    <result>
          <my:name>Some Name</my:name>
          <my:title>Some Title</my:title>
    </result>
</results>

which would allow a kind of "lightweight" construct to map a input  
namespace to an output one - CONSTRUCT clause would provide a more  
general solution to the mapping/rules problem.

The above query can be tested at  
http://demo2.asemantics.com/rdfstore/rdql/

In other words we could use QNAME in place of VAR terminal symbol...

Any bigger implication on SPARQL grammar I did not think of?

Alberto


-
Alberto Reggiori, Senior Partner, R&D @Semantics S.R.L.
alberto@asemantics.com  www.asemantics.com
Milan Office, milano@asemantics.com,   +39 0332 667092
Received on Monday, 1 November 2004 13:51:24 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:21 GMT