Bugs in 2000/12 daml+oil reference on DAML collections

Folks -
There are a couple of problems with the DAML+OIL reference
(http://www.daml.org/2000/12/reference.html) on the treatment of parse type
daml:collection.

The first problem is fairly trivial. In the section explaining the
interpretation of the collection node
(http://www.daml.org/2000/12/reference.html#collection), the empty list
element is shown as:
	<rest rdf:resource="nil">
when it should be
	<List rdf:resource="nil">
otherwise the document has an illegal property of a property construction
(rest of rest).  Another typo is that the final tag should be </List> not
<List>.  Also, I suspect that the URI 'nil' should have an explicit
namespace, otherwise every DAML document will have a different list
terminator.

The second problem is that it would be nice if we could apply a simple
syntactic transformation to remove the parseType daml:collection's before
parsing with a standard RDF parser (as suggested in the reference document).
This is made more difficult because parseType daml:collection is applied to
both properties and instances in slightly different ways.

For example, the e.g. in the reference document uses the oneOf property. The
example translates:

<oneOf rdf:parseType="daml:collection">
  <Thing rdf:resource="#red"/>
  <Thing rdf:resource="#white"/>
  <Thing rdf:resource="#blue"/>
</oneOf>

to:

<List>
 <first>
  <Thing rdf:resource="#red">
 </first>
 <rest>
  ... elided for brevity ...
 </rest>
</List> 

Presumably, then, the final document contains (or should be interpreted as):

<oneOf>
  <List>
   <first>
    <Thing rdf:resource="#red">
   </first>
   <rest>
    ... elided for brevity ...
   </rest>
  </List> 
</oneOf>

So the interpretation of the daml:collection attribute on a property is that
the _value_ of the property is a List.

However, a disjoint axiom also has parseType daml:collection:

<daml:Disjoint rdf:parseType="daml:collection">
  <rdfs:Class rdf:about="#Car"/>
  <rdfs:Class rdf:about="#Person"/>
  <rdfs:Class rdf:about="#Plant"/>
</daml:Disjoint>

Since daml:Disjoint is a sub-class of List (which seems like an engineering
convenience rather than a deep statement about the domain of axioms and
lists), presumably the correct interpretation is:

<daml:Disjoint>
  <first>
    <rdfs:Class rdf:about="#Car"/>
  </first>
  <rest>
    ... nested list of person and plant ...
  </rest>
</daml:Disjoint>

I.e. the Disjoint instance itself takes the place of the outer List in the
content of the oneOf property, so the interpretation of daml:collection here
is that the axiom instance _is_ a list.

The other alternative is that there should be an intervening property
between the Disjoint axiom instance and the translated List (and by
corollary, Disjoints contain lists but are not sub-classes of List), but it
is not clear what this property would be.  

Either way, a transformation to translate daml:collection's to the List form
can't be a context-free grammar at the XML level, since it's an RDF
convention that distinguishes instances from classes from properties. At the
XML level they're all just elements.  And if we want to do document
translation pre the RDF parse phase, the only interpretation level available
is XML.

Comments welcome, especially if I've missed something in my understanding of
the specs.

Cheers,
Ian

_______________________________________________________________________
Ian J. Dickinson    HP Labs, Bristol, UK    mailto:Ian_Dickinson@hp.com

Received on Friday, 12 January 2001 05:54:30 UTC