Re: rdf-ns-prefix-confusion

Uche Ogbuji wrote:

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

Here is where I get confused about the Namespace Rec, because certain key
words and passages are not quite clearly enough worded.  To wit:

In section 5.2, it says:

"A default namespace is considered to apply to the element where it is
declared (if that element has no namespace prefix), and to all elements with
no prefix within the content of that element. If the URI reference in a
default namespace declaration is empty, then unprefixed elements in the
scope of the declaration are not considered to be in any namespace. Note
that default namespaces do not apply directly to attributes. "

I've never seem a convincing explanation of what the word "directly" is
intended to imply here in the last sentence.  Doesn't it imply that default
namespaces could apply "indirectly", whatever that might mean (see below,
about Appendix A.2, for more about what it could mean)?

There is an illustration in section 5.3, though, that seems to show that a
default namespace is not applied to an unprefixed attribute:

"However, each of the following is legal, the second because the default
namespace does not apply to attribute names: <!-- http://www.w3.org is bound
to n1 and is the default -->
      <x xmlns:n1="http://www.w3.org"
         xmlns="http://www.w3.org" >
        <good a="1"     b="2" />
        <good a="1"     n1:a="2" />
      </x>

"

Here they don't use the word "directly".

So far so good, and in line with the new recommendation for RDF.  But look
in Appendix A.2 (which is non-normative):

"The Per-Element-Type Partitions
Each type in the All Element Types Partition has an associated namespace in
which appear the names of the unqualified attributes that are provided for
that element. This is a traditional namespace because the appearance of
duplicate attribute names on an element is forbidden by XML 1.0. The
combination of the attribute name with the element's type and namespace name
uniquely identifies each unqualified attribute. "

Here it is clear that unqualified attributes in an element with an
applicable namespace will be different from unprefixed attributes of the
same name but in some other namespace.  Although this is not, perhaps, the
same as saying that these elements are in effect qualified, it does show
that the xslt style of unprefixed attributes makes sense in that it is
consistent with this non-normative text.

It's confusing because the default namespace is said not no apply to these
unqualified attributes, yet the combination of the default namespace with
the attribute name may still serve to "uniquely identify" them.  It appears
that "identification" and qualification are not the same thing.

I suppose that section 5.2 and Appendix A.2 don't really contradict one
another.  Between them, they say that an unprefixed attribute, in an element
which is given its namespace by being n a default namespace, is
distinguished from other attributes of the same name by virtue of that
namespace.

According to this, rdf attributes wouldn't always need to be qualified.
However, it's not clear to me just what any given parser will report for the
effective namespace of these unqualified attributes whose owner elements do
have a namespace.  Whatever the parser reports, though, the rdf processor
could easily take the parent element's namespace and use it to determine
whether a given attribute was really an rdf attribute or not.

Notice, though, that an intended but unprefixed rdf attribute within an
element having a non-rdf namespace would not be interpreted as an rdf
attribute just because there was also a default rdf namespace in effect.
Instead, it would pick up its namespace from its owner regardless of the
default namespace, according to these rules.

It seems to me that this would be asking for trouble - sometimes an
unprefixed attribute would be interpreted as a real rdf attribute and
sometimes it would not.  It's true that we can always walk through and
figure it out, but at least for human-generated rdf it would cause some
number of
errors, I would think.

This line of thinking supports the WG's decision, because the decision
removes this possible ambiguity.  It would be wise, though, for processors
to check out unprefixed candidate rdf attributes to see if, by these rules,
they should be considered as rdf attributes after all.  Once again, a case
of being strict in creation and tolerant on receiving, right?

Cheers,

Tom P

Received on Tuesday, 15 January 2002 01:13:31 UTC