[Jslib] Re: RDF redesign

Eric Plaster plaster@visi.com
Fri, 09 Nov 2001 15:58:42 -0600


--------------090908060401050305020001
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



Martin T. Kutschker wrote:

>  
>
>     Eric Plaster <plaster@urbanrage.com <mailto:plaster@urbanrage.com>
>     > schrieb in im Newsbeitrag:
>     public.mozdev.jslib/3BE977FD.30405@urbanrage.com
>     <mailto:public.mozdev.jslib/3BE977FD.30405@urbanrage.com>...
>
>
>     Well, maybe this is a good time to give a status report on what I
>     have done so far.  Working on a chart of functionallity, I took an
>     OOD point of view and broke out what was common and what was (as I
>     preceived it) to be unique to a class.  So if you look in the
>     jslib/libraries/rdf directory there should be the following
>     files/classes:
>
> This overall looks good to me.
>
Thanks.  It's still got a little ways to go (error checking and such).

>  
>
>     As you can see, I've eliminated the need for NC, or a root node.
>      The new classes works more on the graph idea.  You ask the RDF
>     class for a seq, and it either returns a RDFContainer of type
>     "seq" or it returns null.  You can then manipulate that seq by
>     using setAttribute, getSubNodes, addNode, etc...
>
> Well, I think that it is good that you don't need NC or a root, but 
> you should be able to use it. A root node, may come in handy (if only 
> set "temporarily", like the Javascript with statement). And don't you 
> need NCs to turn the nodes into something useful be it a RDF thingy 
> like Seq or your very own tag?
>
    * NC:  This I felt was something that is completely transparent.
       From what I learned, you don't need it for anything.  You can get
      a literal with out it, and it fills it in for you.  So for
      example, these are equivelant

        RDF.getResource("http://jslib.mozdev.org/rdf#name");
        RDF.getResource("name");

    Don't ask me why this is so, but it is.  So if the NC is unnessary,
    and it's only in the rdf file it's self, why even have an option to
    set your NC?  Just default to "http://jslib.mozdev.org/rdf#" because
    your using our class.

    * Root seq:  There still can be a root seq, you just don't pass it
      in on the constructor.  Instead you "getSeq" that root from the
      rdf.  This is kind of nessary so that we can use this class on
      rdf's that we don't know about.  If we don't know anything about
      an rdf, what do we pass in as the root?  This is one of the goals
      that I'm shooting for, is being able to open any existing rdf file
      and be able to walk the graph.

>     So...
>     Now that that is all said and done.  I'm thinking about
>     rearranging it again.  I have to do some more thinking about it,
>     but here is what I was kind of thinking:
>
>     You have a "rdf" class.  For this class you can query resources
>     (RDFResource), with this resource, you can set subject, predicate,
>     or object.
>
>      
>
> It would be great that with the help of the RDF classes you may 
> perform any operation on the graph you want to. But keep in mind that 
> they will be most useful on graphs that can be interpreted and 
> displayed by Mozilla's template generator. The templates are usually 
> parts of a graph interpreted as a tree. So the classes should still 
> focus on that. If I want to mess around with assertions, etc I can use 
> Mozilla's interfaces.
>
Agreed.  Like I said above, we should be able to open any rdf, and write 
any rdf (that can be used in templates, etc...  in other words, valid 
rdf).  So for example:

    var rdf = new RDFFile("/tmp/bob.rdf");
    var node = rdf.getNode("urn:test:names:bob");
    node.getAttribute("name");



>      Then you can also add any sub resources if you want (remember you
>     can make any li into a seq with one call, and without looseing any
>     arcs).  Thus any RDFResource can be changed into a RDFContainer...
>
>      
>
> If I have a graph like this:
>
>  
>
>  <li about="urn:blah">
>
>   <Seq />
>
>  </li>
>
>  
>
> Do you think the li IS A Seq? Graph or not, I don't think it would be 
> a meaningful RDF if one would make arcs for li and Seq to the same 
> node. But likely I am still not grasping the true meaning of RDF.
>
In rdf, to make a node into a container, you just have to make one call:

    RDFCUtils.MakeSeq(this.dsource, myresource);

So, this is how it would play out (keep in mind, I'm just brain 
storming, this is not how it is currently implemented):

    var rdf = new RDFFile("/tmp/bob.rdf");
    var res = rdf.addResource("urn:blah");
    res.flush();

Your rdf file now looks like this:

     <li about="urn:blah"/>

Now you could do this:

    res.addSubResource("bob");


Your rdf file now looks like this:

    <Seq about="urn:blah">
        <li about="urn:blah:bob"/>
    </Seq>

>  
>
> Masi
>

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

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



--------------090908060401050305020001
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<br>
<br>
Martin T. Kutschker wrote:<br>
<blockquote type="cite" cite="mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org">
  <title></title>
  <meta content="MSHTML 5.50.4616.200" name="GENERATOR">
  <style></style>
  <div>&nbsp;</div>
  <blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(0,0,0); margin-right: 0px; ">
    <div>Eric Plaster &lt;<a href="mailto:plaster@urbanrage.com">plaster@urbanrage.com</a>
&gt; schrieb in    im Newsbeitrag: <a href="mailto:public.mozdev.jslib/3BE977FD.30405@urbanrage.com">
public.mozdev.jslib/3BE977FD.30405@urbanrage.com</a>...</div>
    <div><br>
Well, maybe this is a good time to give a status report on what I    have
done so far. &nbsp;Working on a chart of functionallity, I took an OOD    point
of view and broke out what was common and what was (as I preceived it)  
 to be unique to a class. &nbsp;So if you look in the jslib/libraries/rdf    directory
there should be the following files/classes:</div>
    </blockquote>
    <div><font face="Andale Mono" size="2">This overall looks good to me.</font></div>
    </blockquote>
Thanks. &nbsp;It's still got a little ways to go (error checking and such).<br>
    <blockquote type="cite" cite="mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org">
      <div>&nbsp;</div>
      <blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(0,0,0); margin-right: 0px; ">
        <div>As you can see, I've eliminated the need for NC, or a root node.
   &nbsp;The new classes works more on the graph idea. &nbsp;You ask the RDF    class
for a seq, and it either returns a RDFContainer of type "seq" or it    returns
null. &nbsp;You can then manipulate that seq by using setAttribute,    getSubNodes,
addNode, etc...<br>
        </div>
        </blockquote>
        <div>Well, I think that it is good that you don't need NC or a root,
but you  should be able to use it. A root node, may come in handy (if only
set  "temporarily", like the Javascript with statement). And don't you need
NCs to  turn the nodes into something useful be it a RDF thingy like Seq
or your very  own tag?</div>
        </blockquote>
        <ul>
          <li>NC: &nbsp;This I felt was something that is completely transparent.
&nbsp;From what I learned, you don't need it for anything. &nbsp;You can get a literal
with out it, and it fills it in for you. &nbsp;So for example, these are equivelant</li>
        </ul>
        <blockquote>
          <blockquote><tt>RDF.getResource(<a class="moz-txt-link-rfc2396E" href="http://jslib.mozdev.org/rdf#name">"http://jslib.mozdev.org/rdf#name"</a>);</tt><br>
            <tt>RDF.getResource("name");</tt></blockquote>
            </blockquote>
            <blockquote>Don't ask me why this is so, but it is. &nbsp;So if the
NC is unnessary, and it's only in the rdf file it's self, why even have an
option to set your NC? &nbsp;Just default to <a class="moz-txt-link-rfc2396E" href="http://jslib.mozdev.org/rdf#">"http://jslib.mozdev.org/rdf#"</a> because
your using our class.<br>
              <br>
              </blockquote>
              <ul>
                <li>Root seq: &nbsp;There still can be a root seq, you just don't
pass it in on the constructor. &nbsp;Instead you "getSeq" that root from the rdf.
&nbsp;This is kind of nessary so that we can use this class on rdf's that we don't
know about. &nbsp;If we don't know anything about an rdf, what do we pass in as
the root? &nbsp;This is one of the goals that I'm shooting for, is being able
to open any existing rdf file and be able to walk the graph.</li>
              </ul>
              <blockquote type="cite" cite="mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org">
                <blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(0,0,0); margin-right: 0px; ">
                  <div>So...<br>
Now that that is all said and done. &nbsp;I'm thinking about    rearranging it
again. &nbsp;I have to do some more thinking about it, but here    is what I was
kind of thinking:<br>
                  <br>
You have a "rdf" class. &nbsp;For this    class you can query resources (RDFResource),
with this resource, you can set    subject, predicate, or object.</div>
                  <div>&nbsp;</div>
                  </blockquote>
                  <div>It would be great that with the help of the RDF classes
you may perform any  operation on the graph you want to. But keep in mind
that they will be most  useful on graphs that can be interpreted and displayed
by Mozilla's template  generator. The templates are usually parts of a graph
interpreted as a tree. So  the classes should still focus on that. If I want
to mess around with  assertions, etc I can use Mozilla's interfaces.</div>
                  </blockquote>
Agreed. &nbsp;Like I said above, we should be able to open any rdf, and write
any rdf (that can be used in templates, etc... &nbsp;in other words, valid rdf).
&nbsp;So for example:<br>
                  <blockquote><tt>var rdf = new RDFFile("/tmp/bob.rdf");<br>
var node = rdf.getNode("urn:test:names:bob");<br>
node.getAttribute("name");<br>
                    </tt></blockquote>
                    <br>
                    <br>
                    <blockquote type="cite" cite="mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org">
                      <blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(0,0,0); margin-right: 0px; ">
                        <div>&nbsp;Then you can also add any sub resources if
you want (remember you    can make any li into a seq with one call, and without
looseing any arcs).    &nbsp;Thus any RDFResource can be changed into a RDFContainer...</div>
                        <div>&nbsp;</div>
                        </blockquote>
                        <div>If I have a graph like this:</div>
                        <div>&nbsp;</div>
                        <div>&nbsp;&lt;li about="urn:blah"&gt;</div>
                        <div>&nbsp; &lt;Seq /&gt;</div>
                        <div>&nbsp;&lt;/li&gt;</div>
                        <div>&nbsp;</div>
                        <div>Do you think the li IS A Seq? Graph or not,
I don't think it would be a  meaningful RDF if one would make arcs for li
and Seq to the same node. But  likely I am still not grasping the true meaning
of RDF.</div>
                        </blockquote>
In rdf, to make a node into a container, you just have to make one call:<br>
                        <blockquote><tt>RDFCUtils.MakeSeq(this.dsource, myresource);</tt><br>
                          </blockquote>
So, this is how it would play out (keep in mind, I'm just brain storming,
this is not how it is currently implemented):<br>
                          <blockquote><tt>var rdf = new RDFFile("/tmp/bob.rdf");</tt><br>
                            <tt>var res = rdf.addResource("urn:blah");</tt><br>
                            <tt>res.flush();</tt><br>
                            </blockquote>
Your rdf file now looks like this:<br>
                            <blockquote>&nbsp;<tt>&lt;li about="urn:blah"/&gt;</tt><br>
                              </blockquote>
Now you could do this:<br>
                              <blockquote><tt>res.addSubResource("bob");</tt><br>
                                </blockquote>
                                <br>
Your rdf file now looks like this:<br>
                                <blockquote><tt>&lt;Seq about="urn:blah"&gt;</tt><br>
                                  <tt>&nbsp;&nbsp;&nbsp; &lt;li about="urn:blah:bob"/&gt;</tt><br>
                                  <tt>&lt;/Seq&gt;</tt><br>
                                  </blockquote>
                                  <blockquote type="cite" cite="mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org">
                                    <div>&nbsp;</div>
                                    <div>Masi</div>
                                    </blockquote>
                                    <br>
                                    <div class="moz-signature">-- <br>
                                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                      <tbody>
                                        <tr>
                                          <td valign="Top">Eric Plaster<br>
                                          </td>
                                          <td valign="Top" align="Right"><a href="http://www.urbanrage.com" style="color: maroon; text-decoration: none; ">
   Urban Rage Software</a><br>
                                          </td>
                                        </tr>
                                        <tr>
                                          <td valign="Top"> Senior Software
Engineer<br>
                                          </td>
                                          <td valign="Top" align="Right">
 RPG tools project<br>
                                          </td>
                                        </tr>
                                        <tr>
                                          <td valign="Top"> <a class="moz-txt-link-abbreviated" href="mailto:rpgtools@urbanrage.com">rpgtools@urbanrage.com</a><br>
                                          </td>
                                          <td valign="Top" align="Right"><a href="http://rpgtools.mozdev.org" style="color: maroon; text-decoration: none; ">
   http://rpgtools.mozdev.org<br>
                                          </a></td>
                                        </tr>
                                      </tbody>
                                    </table>
                                    <div align="Center"><font color="#999999"><b><i><font color="#666666"><small>
   AD&amp;D tools for the player and the DM</small></font></i></b></font></div>
                                    </div>
                                    <br>
                                    </body>
                                    </html>

--------------090908060401050305020001--