Re: CWM Bug: Don't Canonicalise Lists

On Oct 15, 2007 2:07 PM, Yosi Scharf <syosi@mit.edu> wrote:

> This shows what list canonicalization does. I'm not so sure it
> is an argument to remove it.

I finally worked out an example where it matters: in subclassing
rdf:List to come up with your own containers to which you might attach
various semantics. People have asked for this kind of thing on #swig
before, and it just came up in a JSON project I'm working on which is
how I figured it out.

Here's an example:

$ cat siblings.n3
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
@keywords a .

John siblings [
   names [ a BrotherNames;
           rdf:first "Morgan";
           rdf:rest ("Kris" "Kerry") ]
] .

Jane siblings [
   names [ a SisterNames;
           rdf:first "Morgan";
           rdf:rest ("Kris" "Kerry") ]
] .

{ ?list a BrotherNames } => { ?list a List } .
{ ?list a SisterNames } => { ?list a List } .
{ ?element list:in ?list . ?list a List }
   => { ?list member ?element } .

{ ?person siblings [ names [ a SisterNames; member ?name ] ] }
   => { ?person sisterName ?name } .

{ ?person siblings [ names [ a BrotherNames; member ?name ] ] }
   => { ?person brotherName ?name } .

$ cwm siblings.n3 --think

Gives in part:

    :John     :brotherName "Kerry",
                "Kris",
                "Morgan";
         :siblings  [
             :names  (
            "Morgan"
            "Kris"
            "Kerry" ) ];
         :sisterName "Kerry",
                "Kris",
                "Morgan" .

Which is wrong. John doesn't have any sisters, and yet the model of
the input is fine. The problem is caused by CWM canonicalising lists
and having no way to turn it off.

-- 
Sean B. Palmer, http://inamidst.com/sbp/

Received on Friday, 23 November 2007 15:40:07 UTC