[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mozilla-ui
Subject:    aurora control & XML parser
From:       Chris Waterson <waterson () netscape ! com>
Date:       1998-10-08 20:08:48
[Download RAW message or body]

In my little adventure where I created a Java-based RDF tree, I came across
some inconsistencies that I wanted to discuss. I think there's a small bug
with the way our RDF parser works, and with the way that we're specifying
columns to the tree control.

First, some background (see http://www.w3.org/TR/WD-rdf-syntax/ for more
info). In RDF, each property in a tag (e.g., "<tag property=value ...>") is
actually itself an RDF resource. Specifically, the resource that the property
refers to is computed by taking the current namespace and appending #property
to it (I think: I'm inferring this from the examples that I've seen).

Take the following sample RDF:

<Topic xmlns:foo="http://rdf.foo.com/" id="1">
<child foo:name="bar" foo:blech="cool beans"/>
</Topic>

(Forget the Topic and child nodes for now: I think these are bogus, too, but
let's just take one thing at a time.)

So what we've done here is create an XML namespace with the special xmlns
property, and assigned the prefix "foo" to refer to "http://rdf.foo.com/". So
the property foo:name really means "the resource at http://rdf.foo.com/#name".

The point being that these are just labels for properties, not the properties
themselves. To illustrate, take a look at the following sample:

<Topic xmlns:foo="http://rdf.foo.com/"
       xmlns:foo2="http://rdf.foo.com/"
       id="1">
<child foo:name="bar" foo:blech="cool beans"/>
<child foo2:name="billy"/>
</Topic>

In other words, "foo" and "foo2" refer to the same namespace, so foo:name and
foo2:name refer to the same property.

So what's my beef? First of all, I don't think that the parser is properly
"dereferencing" a property to the fully-qualified resource that it really
refers to. Instead, it's taking the raw property text and creating a property
with that name; e.g., "foo2:name". (I'm basing this claim on the current
implementation in rdfparse.c).

Secondly, in the builtin/tree control, we're actually using the raw attribute
text (e.g., "foo:name") to specify what columns get displayed via the "Column"
parameter; e.g.,

<object type="builtin/tree" ...>
<param name="Column" value="foo:name">
</object>

So the above example (which is perfectly legal RDF) would not be displayed
correctly in our tree widget because strcmp("foo:name", "foo2:name") != 0. I'd
argue we should be parameterizing the tree control like this:

<object type="builtin/tree" ...>
<param name="Column" value="http://rdf.foo.com/#name">
</object>

This seems more accurate to me.

Finally, a note on the Topic and child nodes that we're currently using. This
seems out of whack with the current rev of the spec (at
http://www.w3.org/TR/WD-rdf-syntax/). Specifically, the spec states that we
should be using rdf:Description tags (or container tags, like rdf:Seq) to
create nodes in the graph. But maybe the spec is just moving too fast? Or
maybe we're not really using RDF, just XML that sort of looks like RDF
sometimes? Maybe this will all get better when James Clark lands his new
parser?

I'd be willing to help fix some of this stuff if it seems to be the right way
to go...or, maybe I'm just horribly confused.

Thanks,
chris

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
In my little adventure where I created a Java-based RDF tree, I came across
some inconsistencies that I wanted to discuss. I think there's a small
bug with the way our RDF parser works, and with the way that we're specifying
columns to the tree control.
<P>First, some background (see <A \
HREF="http://www.w3.org/TR/WD-rdf-syntax/">http://www.w3.org/TR/WD-rdf-syntax/</A> \
for more info). In RDF, each <B>property</B> in a tag (e.g., "&lt;tag \
                <B>property</B>=value
...>") is actually <I>itself</I> an RDF resource. Specifically, the resource
that the property refers to is computed by taking the current namespace
and appending <B>#property</B> to it (I think: I'm inferring this from
the examples that I've seen).
<P>Take the following sample RDF:
<P><TT>&lt;Topic xmlns:foo="<A HREF="http://rdf.foo.com/">http://rdf.foo.com/</A>" \
id="1"></TT> <BR><TT>&lt;child foo:name="bar" foo:blech="cool beans"/></TT>
<BR><TT>&lt;/Topic></TT>
<P>(Forget the <TT>Topic</TT> and <TT>child</TT> nodes for now: I think
these are bogus, too, but let's just take one thing at a time.)
<P>So what we've done here is create an XML namespace with the special
<TT>xmlns</TT> property, and assigned the prefix "<TT>foo</TT>" to refer
to "<TT><A HREF="http://rdf.foo.com/">http://rdf.foo.com/</A></TT>". So the property \
<TT>foo:name</TT> really means "the resource at <TT><A \
HREF="http://rdf.foo.com/#name">http://rdf.foo.com/#name</A></TT>". <P>The point \
being that these are just <I>labels for properties</I>, not the properties \
themselves. To illustrate, take a look at the following sample:
<P><TT>&lt;Topic xmlns:foo="<A \
HREF="http://rdf.foo.com/">http://rdf.foo.com/</A>"</TT> \
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:foo2="<A \
HREF="http://rdf.foo.com/">http://rdf.foo.com/</A>"</TT> \
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id="1"></TT> <BR><TT>&lt;child \
foo:name="bar" foo:blech="cool beans"/></TT> <BR><TT>&lt;child \
foo2:name="billy"/></TT> <BR><TT>&lt;/Topic></TT>
<P>In other words, "foo" and "foo2" refer to the same namespace, so <TT>foo:name</TT>
and <TT>foo2:name</TT> refer to the same property.
<P>So what's my beef? First of all, I don't think that the parser is properly
"dereferencing" a property to the fully-qualified resource that it really
refers to. Instead, it's taking the raw property text and creating a property
with that name; e.g., "<TT>foo2:name</TT>". (I'm basing this claim on the
current implementation in <A \
HREF="http://cvs-mirror.mozilla.org/webtools/lxr/source/modules/rdf/src/rdfparse.c">rdfparse.c</A>).
 <P>Secondly, in the builtin/tree control, we're actually using the raw
attribute text (e.g., "<TT>foo:name</TT>") to specify what columns get
displayed via the "Column" parameter; e.g.,
<P><TT>&lt;object type="builtin/tree" ...></TT>
<BR><TT>&lt;param name="Column" value="<B>foo:name</B>"></TT>
<BR><TT>&lt;/object></TT>
<P>So the above example (which is perfectly legal RDF) would not be displayed
correctly in our tree widget because <TT>strcmp("foo:name", "foo2:name")
!= 0</TT>. I'd argue we should be parameterizing the tree control like
this:
<P><TT>&lt;object type="builtin/tree" ...></TT>
<BR><TT>&lt;param name="Column" value="<B><A \
HREF="http://rdf.foo.com/#name">http://rdf.foo.com/#name</A></B>"></TT> \
<BR><TT>&lt;/object></TT> <P>This seems more accurate to me.
<P>Finally, a note on the <B>Topic</B> and <B>child</B> nodes that we're
currently using. This seems out of whack with the current rev of the spec
(at <A HREF="http://www.w3.org/TR/WD-rdf-syntax/">http://www.w3.org/TR/WD-rdf-syntax/</A>). \
Specifically, the spec states that we should be using <TT>rdf:Description</TT> tags \
(or container tags, like <TT>rdf:Seq</TT>) to create nodes in the graph. But maybe \
the spec is just moving too fast? Or maybe we're not really using RDF, just XML
that sort of looks like RDF sometimes? Maybe this will all get better when
James Clark lands his new parser?
<P>I'd be willing to help fix some of this stuff if it seems to be the
right way to go...or, maybe I'm just horribly confused.
<P>Thanks,
<BR>chris</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic