Hi rdflib-dev,
I've run into another issue with Turtle syntax. This time the problem is
that some Turtle files produced by rdflib cannot be parsed with the
Sesame/OpenRDF Turtle parser. I think the problem is mostly with Sesame,
but since an easy workaround exists, maybe this could also be addressed
in rdflib.
The problem is with the shorthand syntax for boolean literals. So with a
Turtle file like this:
@prefix ex: <
http://example.com/> .
ex:A ex:prop true;
ex:prop2 "foo" .
...Sesame will (as of the newest version 2.6.10) throw an
org.openrdf.rio.RDFParseException.
But if I add a single space before the semicolon, it will be parsed just
fine by Sesame:
@prefix ex: <
http://example.com/> .
ex:A ex:prop true ;
ex:prop2 "foo" .
All the other Turtle serializers I've tried, including Jena and Redland,
will insert whitespace before the semicolon. Only rdflib does not. I
don't think the Turtle spec mandates having whitespace before the
semicolon, though I confess I'm not sure.
Maybe it would be a good idea for rdflib to insert that whitespace
anyway? This should obviously be fixed in Sesame if and when that's the
root cause of the issue, but still there may be lots of old versions of
Sesame in use a long time after the fix is released.
Thoughts?
-Osma
PS. Sesame also requires whitespace before the final period, but rdflib
already inserts that.
PPS. The issue does not seem to affect shorthand syntax for numbers,
only boolean values.
--
Osma Suominen |
Osma.S...@aalto.fi | +358 40 5255 882
Aalto University, Department of Media Technology, Semantic Computing
Research Group
Room 2541, Otaniementie 17, Espoo, Finland; P.O. Box 15500, FI-00076
Aalto, Finland