abbreviatedURIs-56: Differences betwee XML QNAMEs and SPARQL Prefixed Names

I have an outstanding action [1] to "Look at the difference between

Strictly SPARQL does not use QNAMEs [4], however it defines a
syntactically similar construct called a prefixed name [3].

Syntactic differences
1) Either or both of the prefix and local part of a SPARQL prefixed name
can be 'empty' ie, both ":local" and "ex:" are valid SPARQL prefixed
   XML QNAMEs are composed of either of two NCNAMEs separated by a ':'
or  a single localname NCNAME component. Each NCNAME is at least one
character long.
   ":local", "ex:" and ":" are all valid SPARQL prefixed names subject
to appropriate prefix declarations.
2) The local part of a SPARQL prefixed name is allowed to begin with a

3) The prefix part of a SPARQL prefixed name may *not* begin with an '_'
(although an anonymous variable name can).

Non-initial character constraints for prefix and local parts between XML
QNAME and SPARQL appear to be identical.

Semantic Differences
Strictly, a QNAME in XML is a syntactic abbreviation for an expanded
name comprising {<namespaceURI>, <localname>} where <namespaceURI> is
obtained by namespace expansion of the prefix component of a QNAME.

SPARQL prefixed names are abbreviations for an IRI formed by the direct
concatenation of <prefixExpansionURI><localName> where prefix expansion
resolves a prefix to an absolute IRI. A SPARQL 
prefixed name is ill-formed if the corresponding IRI is not
syntactically valid.

It should be noted that SPARQL is not an XML based syntax, ie. prefixed
names do not appear enclosed in either angle brackets or quotes. 

The Turtle syntax for RDF [6] has a similar construct to SPARQL and a
comparison is available at [7].

Finally it may be worth noting the following warning from the current
SPARQL CR draft [5]:

"At-Risk Feature: Not all Prefixed Names are XML QNames
The Prefixed Name representation for IRIs is derived from the syntax for
XML QNames. This practice first appeared in the RDF/XML specification,
in which it is used to express statement predicates. However, the
constraints XML stipulates for QNames rule out certain otherwise
convenient character strings, such as isbn:0752820907 or rfc:0822.txt.
The issue in these particular cases is that the local name (the part
following the colon) must be an XML NCName, which may not have leading

Earlier drafts of the SPARQL Query Language restricted the grammar of
Prefixed Names to always be valid QNames. The Working Group decided in
May 2007 to relax this restriction, so that the examples posed above are
now allowed. This extension is being marked as a feature at-risk because
of its late addition to the specification, and because existing software
(e.g. RDF-XML serializers) may rely on Prefixed Names being
transparently expressible as QNames."


Stuart Williams
[1] (Tracker:
Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks
RG12 1HN
Registered No: 690597 England

Received on Thursday, 6 September 2007 16:44:32 UTC