W3C home > Mailing lists > Public > semantic-web@w3.org > December 2007

Re: XML namespaces and RDF

From: Garret Wilson <garret@globalmentor.com>
Date: Sun, 16 Dec 2007 18:16:48 -0800
Message-ID: <4765DC10.5070007@globalmentor.com>
To: Max Voelkel <voelkel@fzi.de>
CC: Semantic Web <semantic-web@w3.org>, Michael Rys <mrys@microsoft.com>

As mentioned elsewhere on this thread, the technique for handling 
namespaces and local names in RDF is a hack that was carried over from 
XML---and even then some bad decisions were made, causing problems that 
could have been avoided.

The worse transgression was to form an RDF URI as a mere concatenation 
of the namespace URI and the local name. As you alluded, this means it 
is impossible to create a set of rules to discover what the original URI 
was. A few years back it was advocated that one could search for the 
last occurring URI reserved character (e.g. '#' or '/'), and assume that 
everything after that character was the local name, and that everything 
before and including that character was the namespace URI.

This approach is not foolproof, though. It won't work, for example, for 
a namespace like that of XLink, <http://www.w3.org/1999/xlink>. Worse 
yet, it requires modification of some namespaces to even create the 
correct resource URI. For example, the XML Schema namespace is 
<http://www.w3.org/2001/XMLSchema>, as is clearly stated at 
<http://www.w3.org/TR/xmlschema-2/#namespaces>. However, in order to 
create the appropriate datatype URIs (such as 
<http://www.w3.org/2001/XMLSchema#int>), RDF has to pretend that the XML 
Schema namespace is really <http://www.w3.org/2001/XMLSchema#> so that 
the concatenation process will work; see 
<http://www.w3.org/TR/REC-rdf-syntax/#rdfmodel> for example. This is not 
just some esoteric example---RDF datatypes are central to RDF typed 
literals (which have significant other problems, as discussed on other 
threads).

On top of all that, it's logically and aesthetically unappealing to 
think that <http://example.com/example#> is the URI of a 
namespace---it's a corruption of the usual semantics of the fragment 
identifier.

The Uniform Resource Framework (URF) explicitly took note of this 
problem and was designed to avoid it. URF provides a rigorous 
specification of the relationship between a resource's URI and the URI 
of the namespace of which it is a part (i.e. the resource's ontology). 
These rules are laid out under "Ontologies and Namespaces" at 
<http://www.urf.name/>. In short, there are three types of possible 
relationships between a namespace URI and the URI of a resource within 
that namespace:

* namespace <http://example.com/example> and local name "resource" 
yields resource URI <http://example.com/example#resource>

* namespace <http://example.com/example/> and local name "resource" 
yields resource URI <http://example.com/example/resource>

* namespace <http://example.com/example#fragment> and local name 
"resource" yields resource URI 
<http://example.com/example#fragment/resource>

These rules provide deterministic transformations from namespace/local 
name to resource URI and back with no loss of information. It provides 
namespace URIs that look like normal URIs (not some strange URI with an 
empty fragment identifier). And it allows useful relationships, like 
modeling the relationships among a Java package, class, and a class's 
properties using the same namespace/local name paradigm:

<java:/com/example/package/>
<java:/com/example/package/Class>
<java:/com/example/package/Class#property>

Garret

Max Voelkel wrote:
> Hey semantic web,
>
>   is    there    anywhere   a   general   rule   *defined*   how   to   expand
>   namespace-prefixed-XML-localnames  such  as  xs:dayTimeDuration  into  a  full
>   (possibly de-referencable) URI?
>
> ----------
> in http://www.w3.org/TR/xpath-datamodel/#notation it says:
> ----
> The following bindings are assumed.
> xs: bound to http://www.w3.org/2001/XMLSchema
> ----
>
> This implies from XML namespace rules that e.g.
> xs:dayTimeDuration  expands to
> http://www.w3.org/2001/XMLSchemadayTimeDuration
> which is not a dereferencable URI.
>
> Is   this correct and intended? For RDF, one uses usually namespace declarations
> that end with "/" or "#".
>
> Michael Rys responds:
> MR> Namespace prefixes in XML are not concatenated to the names in the way that
> MR> you do it below. Instead they form a tuple
> MR> (namespace-uri, local-name).
>
> MR> There are different expanded name notations being used, such as
> MR> {http://www.w3.org/2001/XMLSchema}dayTimeDuration,
> MR> which is non-dereferencable, or
> MR> http://www.w3.org/2001/XMLSchema#dayTimeDuration which can be.
>
> Thanks  a  lot for your quick response. Is there a sort of authorative "expanded
> name   notation"?   Especially  one  talking  about  "#"  would   be  great  to
> read/reference. I have no idea what to Google for.
>
> [1] 'defines' (but only in the examples) the rule: <url> =  <namespace> + <localname>
>
> [1] http://www.w3.org/TR/rdf-primer/
>
> Kind Regards,
> Max
> --
>        Max Völkel
>        voelkel@fzi.de | www.Xam.de
>        office     +49 721 96 54-854
>        mobile     +49 171 83 59 678
> --
> FZI Forschungszentrum Informatik an der Universität Karlsruhe
> Haid-und-Neu-Str. 10-14, D-76131 Karlsruhe
> Tel.: +49-721-9654-0, Fax: +49-721-9654-959
> Stiftung des bürgerlichen Rechts, Az: 14-0563.1 Regierungspräsidium Karlsruhe.
> Vorstand: Prof. Dr.-Ing. Rüdiger Dillmann, Dipl. Wi.-Ing. Michael Flor
> Prof. Dr. Dr.-Ing. Jivka Ovtcharova, Prof. Dr. rer. nat. Rudi Studer
> Vorsitzender des Kuratoriums: Ministerialdirigent Günther Leßnerkraus
>
>
>   
Received on Monday, 17 December 2007 02:18:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:19 GMT