Turtle syntax incompatibility with Sesame

19 views
Skip to first unread message

Osma Suominen

unread,
Nov 20, 2012, 9:44:56 AM11/20/12
to rdfli...@googlegroups.com
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

Gunnar Aastrand Grimnes

unread,
Nov 20, 2012, 9:54:59 AM11/20/12
to rdfli...@googlegroups.com
> 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.

Agreed. Fixed in
https://github.com/RDFLib/rdflib/commit/2ec123f9314e55e5fe7459fc8cf2be2cedc4fb55

- Gunnar
--
http://gromgull.net

Osma Suominen

unread,
Nov 20, 2012, 10:01:00 AM11/20/12
to rdfli...@googlegroups.com
20.11.2012 16:54, Gunnar Aastrand Grimnes kirjoitti:
>> 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.
>
Wow, that must be some kind of a record! :D Thanks a lot!

-Osma

Gunnar Aastrand Grimnes

unread,
Nov 20, 2012, 10:03:40 AM11/20/12
to rdfli...@googlegroups.com
Well, if it'll make you feel worse you can compare with this
yet-to-be-solved ticket from 2008:

https://github.com/RDFLib/rdflib/issues/14

:)
> --
> You received this message because you are subscribed to the Google Groups
> "rdflib-dev" group.
> To post to this group, send email to rdfli...@googlegroups.com.
> To unsubscribe from this group, send email to
> rdflib-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
http://gromgull.net
Reply all
Reply to author
Forward
0 new messages