use a QName as variable identifier

hi all,

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

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

PREFIX dc:  <>
PREFIX foaf:  <>
PREFIX my:  <>
SELECT ?my:name ?my:title
FROM <file:foo6.rdf>
    (?person rdf:type foaf:Person)
    (?person foaf:name ?my:name)
    (?person dc:title ?my:title)

where foo6.rdf is

<?xml version="1.0"?>
    xmlns:foaf="" >

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


and use the PREFIX namespace into the XML serialization

<?xml version="1.0"?>
<results xmlns=''
  xmlns:my='' >
          <my:name>Some Name</my:name>
          <my:title>Some Title</my:title>

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

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 Reggiori, Senior Partner, R&D @Semantics S.R.L.
Milan Office,,   +39 0332 667092

Received on Monday, 1 November 2004 13:51:24 UTC