DAV object model expressed as tables

In this message I show how structured values (in the DAV object model)
could be expressed as relational tables.  I do this in the hope that those
who are expert in SQL (Alan, that's you) will immediately find a solution
that draws on SQL.

Consider the following structured value, showwn first graphically as a
tree, then as XML as it might be on the wire.  I use the graphical
representation to emphasize that XML is not the object model

I have given each node a number for purposes of identity.  If the node is
followed by a letter it's an element and the letter is the label, if the
node is followed by a string in quotes if it's a string.

    1 A                       <A>
    /\                          <B>
   /  \                           <C>frog</C>
  /    \                        </B>
 2 B   5 B                      <B>7</B>
 |     |                     </A>
 3 C   6 "7"
 |
 4 "frog"

One could represent this with four tables:

child table:    parent table     label table    string table
  node  child   node  parent     node  label    node  string
  1     2       1     *          1     A        4     "frog"
  1     5       2     1          2     B        6     "7"
  2     3       3     2          3     C
  3     4       4     3          5     B
  5     6       5     1
                6     5

(I am not really so competent in RDBs, I can't tell whether in the parent
table it's better to have no row at all for node 1, or whether it should
have a row where the entry is NULL or something.)

Anyway, having defined these four tables, the question is whether there's
some cool SQL operator what would let me define a criteria that would be
true for this structured value?  I have heard rumours of an "in" operator?
Does this handle it?

Of course we don't really want just criteria that can only compare to
constants.  Far better would be a criteria that could use the comparative
operators, pattern match operators, etc, e.g. a criteria true where the
value of the string under C was "frog" and the value of the string under B
was less than 10.  Note that this should also match a value like

    1 A                       <A>
    |                          <B>
    2 B                         <C>frog</C>
   / \                          4</B>
  /   \                        </B>
 3 C  5 "4"                   </A>
 |
 4 "frog"

Okay, any comments?  Please, if you include the text of this message in
your reply, please edit it down to something minimal.

Jim




------------------------------------
http://www.parc.xerox.com/jdavis/
650-812-4301

Received on Friday, 28 August 1998 14:12:55 UTC