W3C home > Mailing lists > Public > public-cwm-bugs@w3.org > October 2007

CWM Bug: bNodes Mistakenly Converted to URIs

From: Sean B. Palmer <sean@miscoranda.com>
Date: Sat, 13 Oct 2007 17:51:19 +0100
Message-ID: <b6bb4d890710130951o29ef9814o51131f9fa2890368@mail.gmail.com>
To: public-cwm-bugs@w3.org

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

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 .


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"
        "c" )
         a :List .

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


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.


Sean B. Palmer, http://inamidst.com/sbp/
Received on Saturday, 13 October 2007 16:51:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:52:01 UTC