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

Re: rdf-ns-prefix-confusion

From: Uche Ogbuji <uche.ogbuji@fourthought.com>
Date: Mon, 14 Jan 2002 20:43:37 -0700
Message-Id: <200201150343.g0F3hbh30111@localhost.localdomain>
To: Dave Beckett <dave.beckett@bristol.ac.uk>
cc: www-rdf-interest <www-rdf-interest@w3.org>
> >>>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?)

OK.  Will do, but I'm not sure where to start.

Actually, I should leave off, because I rwally meant to say that it is not 
accessible, but we have to get out of the notion that langfuage specs must be 
accessible.  I as an implementor can follow it, and that is most important.  
As long as the RDF tutorial provides a good prešis of the grammar, all should 
be well.


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

I did reply to this, specifically stating why, all respect to Jeremy, I didn't 
consider those points strong enough justification for the WG's decision.

http://lists.w3.org/Archives/Public/www-rdf-interest/2002Jan/0094.html

et seq.


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

Yes it does.  The element is the owner element of the attribute.  This is good 
enough for any half-decent tool to treat it as the (original) RDF spec 
prescribes

Why the insistence that using the namespace of an attribute directly be an 
inviolate principle in RDF?  Why not defer to the namespace of the owner 
element in some cases as a convenience?

If all XML specs went this way, there wouldn't be any such thing as an 
unprefixed attribute anywhere.


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

Yes it is, though its owner element.


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

That is why I said that in typed nodes and other non RDF-core elements, The 
RDF namespace should be mandatory via the attribute's prefix.


> This looked confusing.

But, as I say, it is common in XML formats.  Maybe it is confusing to someone 
coming new to the XML world...?  But such a person would find much else in 
RDF/XML to confound them.


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

I think you gain a superficial explicitness at the expense of customary 
practice.  I think it makes RDF/XML less natural and consistent with respect 
to other XML specs.


> 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

I assumed this was some confusion with XMLNS practice in M&S 1.0 (which IIRC 
predates XMLNS 1.0).

In practice, I and most implementors used the convention I'm suggesting 
because it is most natural, and it in no way contradicts the XML namespace 
spec, or the Infoset.


> 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"/> :)

Well, even if the older approach came about by accident, I think it is 
superior in effect.


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

Yes.  This is pretty much what I'm advocating.  That ID and about, which are 
RDF-specific attributes be unprefixed in RDF-specific elements, and that all 
other attributes be mandated as prefixed.

To illustrate, if the RDF WG's decision were extrapolated to XSLT, I would 
write a variable as follows (assume proper decl for "xsl" prefix):

<xsl:variable xsl:name="spam" xsl:select="'eggs'"/>

rather than the actual

<xsl:variable name="spam" select="'eggs'"/>

Notice that from the infoset POV, the attributes "name" and "select" are not 
in the XSLT namespace, but applications are expected to handle them as XSLT 
syntactic elements anyway.  I don't see why this wouldn't work for RDF.


> This method won't work for RDF; since RDF attributes can appear on
> an element with pretty much any prefix /namespace.

So can at least two XSLT attributes: version and id.  If they appear on a 
non-XSLT element, they must be prefixed (i.e. xsl:version and xsl:id).  I have 
a vague inkling there are other examples I'm forgetting off-head.

Again, works for XSLT, should work for RDF.


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

It's such a shame I have so little time to keep up with these affairs.

Well, this may be the knock-out blow for my argument.  I do think that the WG 
agreement is much more confusing than going with general XML convention, but 
even I don't claim that it is an earth-shaking problem.

I guess I just have to wait until I can find a working time machine, go back 
and have this debate a good six-month before now.  :-(


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management
Received on Monday, 14 January 2002 22:44:18 GMT

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