[Jslib] Re: RDF redesign

Martin T. Kutschker Martin.T.Kutschker@blackbox.net
Sun, 11 Nov 2001 19:47:34 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_001D_01C16AE9.B595C460
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


  Eric Plaster <plaster@urbanrage.com> schrieb in im Newsbeitrag: =
public.mozdev.jslib/3BEC5192.7050709@urbanrage.com...


  Martin T. Kutschker wrote:


      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?
    a.. 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=20
      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.

Well, but what about RDF files with multiple NCs?


    a.. 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.=20
Sure, no root in the constructor (or if, only as a shorthand).

      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 =3D new RDFFile("/tmp/bob.rdf");
    var node =3D rdf.getNode("urn:test:names:bob");
    node.getAttribute("name");


Or:

var rdf =3D new RDFFile("/tmp/bob.rdf");
rdf.setRoot("urn:test");
var node =3D rdf.getNode(":names:bob"); // starting : denotes =
"relavtive" node name
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=3D"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);

Do you mean in RDF or in Mozilla's RDF implementation?

I recall something on mozilla.org saying something about a defect in the =
implementation


  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 =3D new RDFFile("/tmp/bob.rdf");
    var res =3D rdf.addResource("urn:blah");
    res.flush();

  Your rdf file now looks like this:

     <li about=3D"urn:blah"/>

Really? I would have thought it would be

<Description about=3D"urn:blah"/>

Or does the class assert an arc to rdf#li? I don't think that it should =
do something like that, at least not in the RDF class. It could be ok =
for a Container class.
  Now you could do this:

    res.addSubResource("bob");


  Your rdf file now looks like this:

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

Ok, a child node of Seq should be a li.

And please, could you stop posting HTML? I have always a hard time =
replying to your posts. Thanx.

Masi

------=_NextPart_000_001D_01C16AE9.B595C460
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4616.200" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV>Eric Plaster &lt;<A=20
  href=3D"mailto:plaster@urbanrage.com">plaster@urbanrage.com</A>&gt; =
schrieb in=20
  im Newsbeitrag: <A=20
  =
href=3D"mailto:public.mozdev.jslib/3BEC5192.7050709@urbanrage.com">public=
.mozdev.jslib/3BEC5192.7050709@urbanrage.com</A>...</DIV><BR><BR>Martin=20
  T. Kutschker wrote:<BR>
  <BLOCKQUOTE =
cite=3D"mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org"=20
  type=3D"cite">
    <META content=3D"MSHTML 5.50.4616.200" name=3DGENERATOR>
    <STYLE></STYLE>

    <DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
    <BLOCKQUOTE=20
    style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">As=20
      you can see, I've eliminated the need for NC, or a root node. =
&nbsp;The=20
      new classes works more on the graph idea. &nbsp;You ask the RDF =
class for=20
      a seq, and it either returns a RDFContainer of type "seq" or it =
returns=20
      null. &nbsp;You can then manipulate that seq by using =
setAttribute,=20
      getSubNodes, addNode, etc...<BR></BLOCKQUOTE></BLOCKQUOTE>
  <BLOCKQUOTE =
cite=3D"mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org"=20
  type=3D"cite">
    <DIV>Well, I think that it is good that you don't need NC or a root, =
but you=20
    should be able to use it. A root node, may come in handy (if only =
set=20
    "temporarily", like the Javascript with statement). And don't you =
need NCs=20
    to turn the nodes into something useful be it a RDF thingy like Seq =
or your=20
    very own tag?</DIV></BLOCKQUOTE>
  <UL>
    <LI>NC: &nbsp;This I felt was something that is completely =
transparent.=20
    &nbsp;From what I learned, you don't need it for anything. &nbsp;You =
can get=20
    a literal with out it, and it fills it in for you. &nbsp;So for =
example,=20
    these are equivelant </LI></UL>
  <BLOCKQUOTE>
    <BLOCKQUOTE><TT>RDF.getResource(<A class=3Dmoz-txt-link-rfc2396E=20
      =
href=3D"http://jslib.mozdev.org/rdf#name">"http://jslib.mozdev.org/rdf#na=
me"</A>);</TT><BR><TT>RDF.getResource("name");</TT></BLOCKQUOTE></BLOCKQU=
OTE>
  <BLOCKQUOTE>
    <DIV>Don't ask me why this is so, but it is. &nbsp;So if the NC is=20
    unnessary, and it's only in the rdf file it's self, why even have an =
option=20
    to set your NC? &nbsp;Just default to <A =
class=3Dmoz-txt-link-rfc2396E=20
    =
href=3D"http://jslib.mozdev.org/rdf#">"http://jslib.mozdev.org/rdf#"</A> =

    because your using our class.</DIV>
    <DIV>&nbsp;</DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV><FONT face=3D"Andale Mono">Well, but what about RDF files with =
multiple=20
NCs?<BR><BR><FONT size=3D2></FONT></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <UL>
    <LI>Root seq: &nbsp;There still can be a root seq, you just don't =
pass it in=20
    on the constructor. &nbsp;Instead you "getSeq" that root from the =
rdf.=20
    &nbsp;This is kind of nessary so that we can use this class on rdf's =
that we=20
    don't know about. &nbsp;If we don't know anything about an rdf, what =
do we=20
    pass in as the root? &nbsp;This is one of the goals that I'm =
shooting for,=20
    is being able to open any existing rdf file and be able to walk the =
graph.=20
    </LI></UL></BLOCKQUOTE>
<DIV><FONT face=3D"Andale Mono" size=3D2>Sure, no root in the =
constructor (or if,=20
only as a shorthand).</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
  <BLOCKQUOTE =
cite=3D"mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org"=20
  type=3D"cite">
    <BLOCKQUOTE=20
    style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
      <DIV>So...<BR>Now that that is all said and done. &nbsp;I'm =
thinking about=20
      rearranging it again. &nbsp;I have to do some more thinking about =
it, but=20
      here is what I was kind of thinking:<BR><BR>You have a "rdf" =
class.=20
      &nbsp;For this class you can query resources (RDFResource), with =
this=20
      resource, you can set subject, predicate, or object.</DIV>
      <DIV><FONT face=3D"Andale Mono" =
size=3D2></FONT>&nbsp;</DIV></BLOCKQUOTE>
    <DIV>It would be great that with the help of the RDF classes you may =
perform=20
    any operation on the graph you want to. But keep in mind that they =
will be=20
    most useful on graphs that can be interpreted and displayed by =
Mozilla's=20
    template generator. The templates are usually parts of a graph =
interpreted=20
    as a tree. So the classes should still focus on that. If I want to =
mess=20
    around with assertions, etc I can use Mozilla's=20
  interfaces.</DIV></BLOCKQUOTE>Agreed. &nbsp;Like I said above, we =
should be=20
  able to open any rdf, and write any rdf (that can be used in =
templates, etc...=20
  &nbsp;in other words, valid rdf). &nbsp;So for example:<BR>
  <BLOCKQUOTE>
    <DIV><TT>var rdf =3D new RDFFile("/tmp/bob.rdf");<BR>var node =3D=20
    =
rdf.getNode("urn:test:names:bob");<BR>node.getAttribute("name");</TT></DI=
V>
    <DIV><TT></TT>&nbsp;</DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV><TT><FONT face=3D"Andale Mono" size=3D2></FONT></TT>&nbsp;</DIV>
<DIV><TT><FONT face=3D"Andale Mono" size=3D2>Or:</FONT></TT></DIV>
<DIV><TT><FONT face=3D"Andale Mono" =
size=3D2></FONT></TT>&nbsp;</DIV><TT></TT><TT>
<DIV><FONT face=3D"Andale Mono">
<DIV><TT>var rdf =3D new RDFFile("/tmp/bob.rdf");</TT></DIV>
<DIV><TT>rdf.setRoot("urn:test");<BR>var node =3D =
rdf.getNode(":names:bob"); //=20
starting : denotes "relavtive" node=20
name<BR>node.getAttribute("name");</TT></DIV></FONT></DIV>
<DIV><FONT face=3D"Andale Mono"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Andale Mono"><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT><FONT size=3D2></FONT><FONT =
size=3D2></FONT><FONT=20
size=3D2></FONT><FONT size=3D2></FONT><BR></DIV><FONT =
size=3D2></FONT></FONT>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"></TT>
  <BLOCKQUOTE =
cite=3D"mid:public.mozdev.jslib%2F9shd49$t5j$1@tigris.mozdev.org"=20
  type=3D"cite">
    <BLOCKQUOTE=20
    style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
      <DIV>&nbsp;Then you can also add any sub resources if you want =
(remember=20
      you can make any li into a seq with one call, and without looseing =
any=20
      arcs). &nbsp;Thus any RDFResource can be changed into a=20
      RDFContainer...</DIV>
      <DIV><FONT face=3D"Andale Mono" =
size=3D2></FONT>&nbsp;</DIV></BLOCKQUOTE>
    <DIV>If I have a graph like this:</DIV>
    <DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
    <DIV>&nbsp;&lt;li about=3D"urn:blah"&gt;</DIV>
    <DIV>&nbsp; &lt;Seq /&gt;</DIV>
    <DIV>&nbsp;&lt;/li&gt;</DIV>
    <DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
    <DIV>Do you think the li IS A Seq? Graph or not, I don't think it =
would be a=20
    meaningful RDF if one would make arcs for li and Seq to the same =
node. But=20
    likely I am still not grasping the true meaning of =
RDF.</DIV></BLOCKQUOTE>
  <DIV>In rdf, to make a node into a container, you just have to make =
one=20
  call:</DIV>
  <DIV><TT>&nbsp; RDFCUtils.MakeSeq(this.dsource, =
myresource);</TT></DIV>
  <DIV><TT></TT>&nbsp;</DIV></BLOCKQUOTE>
<DIV><TT></TT><TT><FONT face=3D"Andale Mono" size=3D2>Do you mean in RDF =
or in=20
Mozilla's RDF implementation?<BR></FONT></TT></DIV>
<DIV><TT><FONT face=3D"Andale Mono" size=3D2>I recall something on =
mozilla.org=20
saying something about a defect in the implementation</DIV></FONT></TT>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV><FONT face=3D"Andale Mono" size=3D2></FONT><FONT face=3D"Andale =
Mono"=20
  size=3D2></FONT><FONT face=3D"Andale Mono" size=3D2></FONT><FONT =
face=3D"Andale Mono"=20
  size=3D2></FONT><FONT face=3D"Andale Mono" size=3D2></FONT><FONT =
face=3D"Andale Mono"=20
  size=3D2></FONT><BR></DIV>So, this is how it would play out (keep in =
mind, I'm=20
  just brain storming, this is not how it is currently implemented):<BR>
  <BLOCKQUOTE><TT>var rdf =3D new =
RDFFile("/tmp/bob.rdf");</TT><BR><TT>var res =3D=20
    =
rdf.addResource("urn:blah");</TT><BR><TT>res.flush();</TT><BR></BLOCKQUOT=
E>Your=20
  rdf file now looks like this:<BR>
  <BLOCKQUOTE>
    <DIV>&nbsp;<TT>&lt;li=20
  about=3D"urn:blah"/&gt;</TT></DIV><TT></TT></BLOCKQUOTE><FONT=20
  face=3D"Andale Mono"><FONT size=3D2></FONT></FONT></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV><FONT face=3D"Andale Mono"></FONT>&nbsp;</DIV></BLOCKQUOTE>
<DIV><FONT face=3D"Andale Mono" size=3D2>Really? I would have thought it =
would=20
be</FONT></DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2>&lt;Description <FONT =
face=3D"Courier New"=20
size=3D3>about=3D"urn:blah"/&gt;</FONT></FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New">Or does the class assert an arc to =
rdf#li? I don't=20
think that it should do something like that, at least not in the RDF =
class. It=20
could be ok for a Container class.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV>Now you could do this:<BR></DIV></BLOCKQUOTE>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  =
<BLOCKQUOTE><TT>res.addSubResource("bob");</TT><BR></BLOCKQUOTE><BR>Your =
rdf=20
  file now looks like this:<BR>
  <BLOCKQUOTE><TT>&lt;Seq =
about=3D"urn:blah"&gt;</TT><BR><TT>&nbsp;&nbsp;&nbsp;=20
    &lt;li=20
about=3D"urn:blah:bob"/&gt;</TT><BR><TT>&lt;/Seq&gt;</TT></BLOCKQUOTE></B=
LOCKQUOTE>
<DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2>Ok, a&nbsp;child node of Seq =
should be a=20
li.</FONT></DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2>And please, could you stop =
posting HTML? I=20
have always a hard time replying to your posts. Thanx.</FONT></DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Andale Mono" size=3D2>Masi</FONT></DIV></BODY></HTML>

------=_NextPart_000_001D_01C16AE9.B595C460--