W3C home > Mailing lists > Public > www-tag@w3.org > September 2007

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

From: Misha Wolf <Misha.Wolf@reuters.com>
Date: Thu, 06 Sep 2007 18:15:20 +0100
To: "Williams, Stuart (HP Labs, Bristol)" <skw@hp.com>, W3C-TAG <www-tag@w3.org>
Cc: newsml-g2@yahoogroups.com
Message-id: <A29ADE959C70A1449470AA9A212F5D80062C4204@LONSMSXM06.emea.ime.reuters.com>

The G2 family of News Exchange standards from the International 
Press Telecommunications Council [1] takes a similar approach 
to SPARQL:

-  The local part (the code) is allowed to start with a digit.

-  The prefix represents the URI of the scheme within which the 
   code is allocated.

-  The two taken together *must* form a legal URI.

-  This URI *should* provide access to a definition of the 
   concept represented by that code within that scheme.

We call this datatype a QCODE.

For more details, see my presentation to the W3C AC in June 2006:
http://lists.w3.org/Archives/Public/www-archive/2006Jun/att-0013/curie-s
lides-mw2.pdf
(apologies for the broken link)

[1] http://www.iptc.org/

Misha Wolf, News Standards Manager, Reuters


-----Original Message-----
From: www-tag-request@w3.org [mailto:www-tag-request@w3.org] On Behalf
Of Williams, Stuart (HP Labs, Bristol)
Sent: 06 September 2007 17:42
To: W3C-TAG
Subject: abbreviatedURIs-56: Differences betwee XML QNAMEs and SPARQL
Prefixed Names


I have an outstanding action [1] to "Look at the difference between
QNAME in XML and SPARQL".

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
names. 
   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
digit.

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
digits.

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."

regards

Stuart Williams
--
[1] http://www.w3.org/2001/tag/group/track/actions/34 (Tracker:
ACTION-34, ISSUE-56)
[2] http://www.w3.org/TR/2007/CR-rdf-sparql-query-20070614/
[3] http://www.w3.org/TR/rdf-sparql-query/#rPrefixedName
[4] http://www.w3.org/TR/xml-names11/#NT-QName
[5] http://www.w3.org/TR/2007/CR-rdf-sparql-query-20070614/#notXmlQNames
[6] http://www.dajobe.org/2004/01/turtle/#sec-qnames
[7] http://jena.hpl.hp.com/wiki/Syntax_Comparison_of_N3_and_Turtle
--
Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks
RG12 1HN
Registered No: 690597 England





This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of Reuters Limited.

Reuters Limited is part of the Reuters Group of companies, of which Reuters Group PLC is the ultimate parent company.
Reuters Group PLC - Registered office address: The Reuters Building, South Colonnade, Canary Wharf, London E14 5EP, United Kingdom
Registered No: 3296375
Registered in England and Wales
Received on Thursday, 6 September 2007 17:19:43 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 10 December 2014 20:12:11 UTC