CWM Bug: bNodes Mistakenly Converted to URIs

CWM is converting some bNodes to URIs when it shouldn't be, having
used a filter which ironically is intended to convert formulae to
bNodes.

The motivation for the filter is that I've converted notation3.py to
run as a standalone N3 to N-Triples converter. Now I need to get CWM
to spit out some kind of reference output to test against, but the
standalone notation3.py preserves triples with formulae in them,
turning the formulae into bNodes.

Since cwm --ntriples removes statements with formulae, that's no good
as reference output. I've already filed a bug about cwm --flatten
breaking; that's no good either. I was going to file a bug about cwm
--reify, but its output is just too awful to get into at this stage,
and so I wrote this filter instead:

$ cat normalise.n3
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

{ ?s ?p ?o . ?s log:rawType log:Formula }
 => { _:s ?p ?o } .

{ ?s ?p ?o . ?o log:rawType log:Formula }
 => { ?s ?p _:o } .

{ ?s ?p ?o .
  ?s log:rawType [ log:notEqualTo log:Formula ] .
  ?o log:rawType [ log:notEqualTo log:Formula ] }
 => { ?s ?p ?o } .

Here's my test input:

$ cat test.n3
@prefix : <http://example.org/#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

[ :p :q, _:r, "r" ] .
("a" "b" "c") a :List .
{ ?p ?q ?r } a :Formula .

# EOF

And here's what happens:

$ cwm test.n3 --filter=normalise.n3
#Processed by Id: cwm.py,v 1.189 2006/08/02 16:59:14 syosi Exp

#  Notation3 generation by
#       notation3.py,v 1.191 2006/08/01 01:14:04 syosi Exp

     @prefix : <http://example.org/#> .
    @prefix test: <#> .

      ( "a"
        "b"
        "c" )
         a :List .

    test:_g0     :p "r",
                :q,
                test:_g1 .
      [      a :Formula ].

#ENDS

This is probably due to the fact that bNodes are stored internally as
URIs at the most ancient and therefore the most ingrained layer of the
API. Kinda hard to change. It would be nice, though, since this is
also behind one of the things that makes the --reify output unusable.

I'm using cwm-1.2.0a1 for this.

Just in case the universals' local name space was conflicting with
that of the bNodes, I tried it using this instead:

{ ?s ?p ?o . ?s log:rawType log:Formula }
 => { [] ?p ?o } .

{ ?s ?p ?o . ?o log:rawType log:Formula }
 => { ?s ?p [] } .

But the same problem occurs.

Thanks,

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

Received on Saturday, 13 October 2007 16:51:35 UTC