[Jslib] Re: RDF classes

Eric Plaster plaster@visi.com
Mon, 11 Feb 2002 13:39:07 -0600


Thanks martin.  I was begining to wonder if anyone cared ;)

Anyway, a couple of things up front:

   1. I didn't have a lot of time to devote to it.
   2. I had to think of how I was going to satisfy two camps (i.e. using
      it as a hiarchical data store, and a graph).

Because of this, I wanted to just get something out.  I know it's not 
complete, but that's what open source is all about right?  Through it 
out there and see if people jump in.

Ok, not to the nitpicking ;)

Martin Kutschker wrote:

> Great! 

Thanks

> Ok, let's start with the nitpicking - just reading the docs :-)
>
> The addXXX()-methods use a relative name scheme. You cannot add a 
> resource with an arbitrary name. Perhaps some addXXXAbsolute().methods 
> could be used to solve this problem.

This was a sticky problem that someone with more js experience might 
help with.  I didn't have a good way to determine if it was an absolute 
or not (without using a magic path like we did in the past - yuck). 
 Perhaps adding these method are the answer.  In C++ I would do 
something like this:

    bool addNode( char *nodename, bool absolute = false );

> The RDF class only allows for "root" containers. Why? It is perfectly 
> ok to have a node as root element. I suggest ading addRootNode(). I'm 
> not sure if we need a getRootNode.

Just didn't get around to it.  This one is also a little tricky, because 
there is no container to attach it to.  I just need to look into it, and 
I haven't had time.  If anyone has time to do so, that would be great.

> The container class is missing a getResource method. It would be nice 
> have access to the underlying XPCOM component. [Note: RDFResource and 
> RDFContainer might derive from a RDFBaseResource class to add this 
> functionality.] 

It does have this.  If you look, RDFContainer is derived from 
RDFResource.  So the container class has all the members of the resource 
class.  I did it this way because a container can do everything a 
resource can, plus some.

> The container classes lack the insertAt and removeFrom calls the XPCOM 
> interface provides. 

Again time.

> Reference attributes are still missing. I have posted, based on 
> another post, a method for the old version of the rdf classes.
>
> Eg, in chrome.rdf i found something like this:
>
> <RDF:Seq about="urn:mozilla:locale:root">
>     <RDF:li resource="urn:mozilla:locale:en-US"/>
>     <RDF:li resource="urn:mozilla:locale:US"/>
> </RDF:Seq>
>
> How would I do this with the classes? 

I have a "getSubject()" member that would return the subject.  For 
example, for the seq above it would return "urn:mozilla:locale:root". 
 Is this different that what you would like to see?

>
> Anyway, I'm pleased you found some time to actually publish your work. 
> Thanx. 

Thanks, my basement is nearly finished (about two or three more weekends 
to go), and I should have more time to play after that.

>
> I might feel for adding some of these thing, if I create a new version 
> of mozCalc. 

It would be great if you could help.

>
>
> Masi


-- 
------------------------------------------------------------------------
Eric Plaster
Urban Rage Software <http://www.urbanrage.com>
Senior Software Engineer
RPG tools project
rpgtools@mozdev.org
http://rpgtools.mozdev.org

*/ AD&D tools for the player and the DM/*