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

"Dickinson, Ian J" wrote:
> 
> 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.

Not surprising... that was written up at the 11th hour...


> 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">

that is: <List rdf:about="...#nil"/>; rdf:resource is used in
propertyElements; rdf:about is used in typedNodes.

The example doesn't show a complete statement. I'd suggest the example
should say:

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

and after elimination of daml:collection syntactic sugar, it should
be...
(I'm including all the namespace stuff because I need that to check
it with SiRPAC http://www.w3.org/RDF/Implementations/SiRPAC/)


<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns="http://www.daml.org/2000/12/daml+oil#">

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

</rdf:RDF>

Sirpac will show you circles-and-arrows; I'm not sure how long
this GIF will be around, but you can always re-recreate it:

 
http://www.w3.org/RDF/Implementations/SiRPAC/SiRPACServlet.tmp/sirpac_47066.gif

> 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).

Yes, that is the idea...

> This is made more difficult because parseType daml:collection is applied to
> both properties and instances in slightly different ways.

Oops...

> 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>

as above, this should be rdf:about, rather than rdf:resource,
throughout.

> 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.

Yes, that's the idea.

> 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>

That's goofy; it should be something like:

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

though that isn't very idiomatic.

> 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.

Yes.


> 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.

equivalentTo works.

> 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.

On the contrary; you've been quite insightful; you managed to find the
design despite the inconsistencies in the documentation. ;-)

It didn't occur to me that you could eliminate daml:collection as
a pure XML->XML translation, but now that I think about it, I beleive
you can; parseType only occurs on propertyElements, so a simple
XSL thingy that explodes */@rdf:parseType="daml:collection" (where
daml: can be any prefix bound to the right namespace) into
the List representation should work.

By the way... see also some earlier design notes I made on lisp-style
lists,
in case it helps:

  List structure -- an RDF Schema
  http://www.w3.org/2000/07/hs78/lists
  Sun, 13 Aug 2000 04:11:26 GMT

I marked that obsolete in favor of some KIF stuff...

  http://www.w3.org/2000/07/hs78/KIF#List

The KIF stuff includes some XSL code for munging lists and such.

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Friday, 12 January 2001 10:02:34 UTC