[redland-dev] Raptor Turtle Parse Error

Ian Davis lists at internetalchemy.org
Thu Apr 22 00:52:29 BST 2004


Hi,

I'm implementing a Turtle parser for an application and came across an
edge case in one of my unit tests. UriRefs are delimited by angle
brackets yet the delimited string may contain unescaped angle
brackets (any Unicode character in the range U+0 to U+10FFFF).

I checked this with rapper (freshly built from raptor-1.3.0.tar.gz)
using the following as input:

[ian at leif raptor-1.3.0]$ cat test.ttl
<http://foo.example.com/?q=>&p=1> <http://foo.example.com/prop> <http://foo.example.com/obj> .

[ian at leif raptor-1.3.0]$ ./rapper -i turtle -o ntriples test.ttl
lt-rapper: Parsing file test.ttl
lt-rapper: Error - URI file:///home/ian/temp/raptor/raptor-1.3.0/test.ttl:1 - syntax error at '&'
lt-rapper: Error - URI file:///home/ian/temp/raptor/raptor-1.3.0/test.ttl:1 - syntax error
lt-rapper: Error - URI file:///home/ian/temp/raptor/raptor-1.3.0/test.ttl:1 - syntax error at '='
lt-rapper: Error - URI file:///home/ian/temp/raptor/raptor-1.3.0/test.ttl:1 - syntax error at '>'
lt-rapper: Parsing returned 0 statements

I think the relativeUri production in the Turtle grammar is ambiguous
here. A possible solution is to add a further string escape of \> in
the relativeUri production. I think this is also a problem with
NTriples but I haven't seen a negative test for this.

The equivilent RDF/XML parses ok:

[ian at leif raptor-1.3.0]$ cat test.rdf
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://foo.example.com/">
  <rdf:Description rdf:about="http://foo.example.com/?q=>&amp;p=1">
    <ex:prop rdf:resource="http://foo3.example.com/obj"/>
  </rdf:Description>
</rdf:RDF>

[ian at leif raptor-1.3.0]$ ./rapper -i rdfxml -o ntriples test.rdf
lt-rapper: Parsing file test.rdf
<http://foo.example.com/?q=>&p=1> <http://foo.example.com/prop> <http://foo3.example.com/obj> .
lt-rapper: Parsing returned 1 statements


Ian




More information about the redland-dev mailing list