W3C home > Mailing lists > Public > www-rdf-comments@w3.org > January to March 2001

SiRPAC bugfixes

From: Karsten-A. Otto <ottoka@cs.tu-berlin.de>
Date: Fri, 23 Feb 2001 23:59:56 +0100 (MET)
To: www-rdf-comments@w3.org
Message-ID: <Pine.SOL.4.10.10102232311440.6823-100000@paula>

while testing the SiRPAC parser I encountered two cases where the parser
produced weird results. These are listed below, together with suggested

Case one: The parser simply swallows empty container elements:

<rdf:Alt ID="foo">

foo , rdf:type , rdf:Alt
foo , rdf:_2 , "bar"

without the expected
foo , rdf:_1 , ""

This can be fixed by adding a special case handler to processListItem, in
the else branch roughly at line 1760. Put the following before the while loop:

if (!e.hasMoreElements())
  addTriple (createResource(RDFMS+"_"+iCounter),
This makes sure something is done for empty list elements too.

Case two: The parser treats empty properties as resources instead of literals:

<rdf:Description ID="foo">

foo , x:empty , #genid1
foo , x:empty , #genid2

while it should be
foo , x:empty , ""
foo , x:empty , ""

This one is more complicated. The problem lies in processPredicate, where the
comment at line 1566 says 

* Before looping through the children, let's check
* if there are any. If not, the value of the predicate is
* an anonymous node
I think this is wrong in most cases. This condition is results in a triple
with a #genid, see line 1580:

addTriple (createResource(predicate.name()),

If you change the createResource(sObject) to createLiteral(""), it works as
expected. However, it then also applies to this strange case:

<rdf:Description ID="foo">
    <x:empty ID="bar"/>

While this is legitimate, I am not too sure what it is supposed to mean;
I assume a reification with an empty object or something like that. You can
identify this by checking (sStatementID != null), but as I said I am not sure
how to handle this...

Maybe the empty peroperties should already be recognized in an earlier parsing
state, such as treating them as parseLiteral in endElement. This actually
works if you force it as in

<rdf:Description ID="foo">
    <x:empty rdf:parseType="Literal"/>
You also could change the parseLiteral method to return true if there are no
non-rdf/xml attributes on the stack, but since this method is used so often
in the code I am not sure of the implications.

I hope this was some help!

Karsten Otto
Received on Friday, 23 February 2001 18:03:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:15:13 UTC