W3C home > Mailing lists > Public > www-rdf-interest@w3.org > January 2002

Re: rdf-ns-prefix-confusion

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Mon, 14 Jan 2002 17:13:25 +0000
To: Uche Ogbuji <uche.ogbuji@fourthought.com>
cc: www-rdf-interest <www-rdf-interest@w3.org>
Message-ID: <18605.1011028405@tatooine.ilrt.bris.ac.uk>
>>>Uche Ogbuji said:
> I've read the most recent syntax/grammar draft.  The grammar
> specification is
> very confusing, but it does look quite thorough.

I'm sorry to hear it is confusing - what exactly did you find was the
problem?  (Maybe you could reply in a separate message?)


> However, I am disappointed to still see no good justification for
> the decision the WG has made w.r.t.
> 
> http://www.w3.org/2000/03/rdf-tracking/#rdf-ns-prefix-confusion 

I think Jeremy's explanation of
  http://lists.w3.org/Archives/Public/www-rdf-interest/2002Jan/0089.html

outlines the reasoning, although since he wasn't on the RDF Core WG
at that time, I'll try to explain what I think why the issue was
resolved that way.


RDF/XML in RDF M&S allows RDF attributes to be put on pretty much
any XML element including ones from the rdf: namespace itself.  So
here is an example of the old unprefixed use.

  <?xml version="1.0"?>
  <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <Description about="http://example.org/">
    </Description>
  </RDF>

XML Namespace defines that unqualified attributes do not share
the namespace of their element - so 'about' here has no relationship
to the element (which is namespace prefixed, although I'm using the
defult one here).


Again:
  <?xml version="1.0"?>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description about="http://example.org/">
    </rdf:Description>
  </rdf:RDF>

So in particular 'about' is *not* associated with the namespace
behind the rdf: prefix.


RDF/XML allows abbreviations where the RDF attributes can appear on
typed nodes elements e.g.

  <?xml version="1.0"?>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
           xmlns:a="http://example.org/properties/">
    <rdf:Description about="http://example.org/">
    </rdf:Description>
    <a:foo about="http://example.org/">
    </a:foo>
  </rdf:RDF>

So which namespace is the second 'about' attribute in?  None.
Definitely not the one attached to the a: prefix.

This looked confusing.

The RDF/Core WG decided that it would be much clearer if all RDF
attributes were always in the rdf namespace i.e:

  <?xml version="1.0"?>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
           xmlns:a="http://example.org/properties/">
    <rdf:Description rdf:about="http://example.org/">
    </rdf:Description>
    <a:foo rdf:about="http://example.org/">
    </a:foo>
  </rdf:RDF>

It is now clear that the rdf:about for the a:foo element is an RDF
attribute and is intended to mean the same thing as the rdf:about on
the rdf:Description.

This has a slight impact when the RDF namespace is used as the
default; another has to be declared, but this is very commonly seen
in XSD and other modern XML specifications:

  <?xml version="1.0"?>
  <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:a="http://example.org/properties/">
    <Description rdf:about="http://example.org/">
    </Description>
    <a:foo rdf:about="http://example.org/">
    </a:foo>
  </RDF>


In addition, the RDF M&S document itself mixed the use of unprefixed
and rdf:-prefixed attributes despite only the former being allowed in
the BNF grammar.  Examples:
   'about' most places except 7.5 example.
   'rdf:parseType' used throughout
   'rdf:resource' mixed used throughout

The RDF/XML syntax was designed in 1998/1999 in parallel with XML
Namespaces.  This was thus before qnames and namespaces were more
widely used, before other ways of using them were tried such as for
XSLT, XML Schema.  We can't always take advantage of newer ideas
since we are mostly revising <insert-caveats="lots"/> :)


Looking at how XSLT uses attributes, it seems to only allow non
namespace-prefixed attributes on XSLT's own elements. 
  ( It also requires that other attributes on its elements are
    namespace-prefixed: http://www.w3.org/TR/xslt#xslt-namespace
    and XSLT requires namespaced elements.
  )
This method won't work for RDF; since RDF attributes can appear on
an element with pretty much any prefix /namespace.


This update was made by the working group in May 2001 and I think we
would need substantial evidence of why this resolution was a big
problem before we would revisit it.

Dave
Received on Monday, 14 January 2002 12:13:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:52 GMT