DAML+OIL and the nested element conundrum

The DAML+OIL reference, as an illustration of the representation of lists as 
cons pairs, uses the following RDF snippet:

<List>
 <first>
  <Thing rdf:resource="#red">
 </first>
 <rest>
  <List>
   <first>
    <Thing rdf:resource="#white">
   </first>
   <rest>
    <List>
     <first>
      <Thing rdf:resource="#blue">
     </first>
     <rest>
      <List rdf:resource="http://www.daml.org/2000/12/daml+oil#nil">
     </rest>
    </List>
   </rest>
  </List>
 </rest>
</List>

The first bit of bad news is that this is not well formed XML.

But even once amended, it probably doesn't mean what the DAML authors think it 
might.  It seems to me that the following makes more sense:

<List>
 <first>
  <Thing rdf:about="#red">
 </first>
 <rest>
  <List>
   <first>
    <Thing rdf:about="#white">
   </first>
   <rest>
    <List>
     <first>
      <Thing rdf:about="#blue">
     </first>
     <rest>
      <List rdf:about="http://www.daml.org/2000/12/daml+oil#nil">
     </rest>
    </List>
   </rest>
  </List>
 </rest>
</List>

4RDF (current CVS) isn't quite sure what to make of the first listing.  My 
amendment gives a (correct, IMO) model:

$ 4rdf cons-fixed.rdf 
The following is a list of resulting triples, each in the form "subject, 
predicate, object".  If a resource has an rdfs:label, it is presented with 
this label between angle brackets.
[
("ANON-1", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#List"),
("#red", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#Thing"),
("ANON-1", "http://www.daml.org/2000/12/daml+oil#first", "#red"),
("ANON-2", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#List"),
("#white", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#Thing"),
("ANON-2", "http://www.daml.org/2000/12/daml+oil#first", "#white"),
("ANON-3", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#List"),
("#blue", "<rdf:type>", "http://www.daml.org/2000/12/daml+oil#Thing"),
("ANON-3", "http://www.daml.org/2000/12/daml+oil#first", "#blue"),
("http://www.daml.org/2000/12/daml+oil#nil", "<rdf:type>", 
"http://www.daml.org/2000/12/daml+oil#List"),
("ANON-3", "http://www.daml.org/2000/12/daml+oil#rest", 
"http://www.daml.org/2000/12/daml+oil#nil"),
("ANON-2", "http://www.daml.org/2000/12/daml+oil#rest", "ANON-3"),
("ANON-1", "http://www.daml.org/2000/12/daml+oil#rest", "ANON-2"),
]


Certainly, I've squinted at RDF M&S frequently enough while working on 4RDF, 
and I can't make sense of the example.   I squinted a bit more this morning 
just to be sure I wasn't inhaling too deeply from the hookah, but it seems The 
example in the DAML ref is quite careless, and quite broken, which is truly 
unfortunate as we should be removing obstacles from understanding this spec, 
rather than erecting them.  Any corroborations or demurrals?

Just to get all the context right, I've attached cons.rdf and cons-fixed.rdf.


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management

Received on Tuesday, 20 November 2001 23:15:07 UTC