Running the attached example gives:
$ python test.py 3.1.0
next char: u'}'
Traceback (most recent call last): File "test.py", line 25, in <module> graph.parse(StringInputSource(prefix + '<%s>' % url + meta), format='n3') File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/graph.py", line 984, in parse location=location, file=file, data=data, **args) File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/graph.py", line 780, in parse parser.parse(source, self, **args) File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/plugins/parsers/notation3.py", line 2257, in parse p.loadStream(source.getByteStream()) File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/plugins/parsers/notation3.py", line 892, in loadStream return self.loadBuf(stream.read()) # Not ideal File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/plugins/parsers/notation3.py", line 898, in loadBuf self.feed(buf) File "/home/nikratio/.local/lib/python2.6/site-packages/rdflib/plugins/parsers/notation3.py", line 928, in feed "expected directive or statement") rdflib.plugins.parsers.notation3.BadSyntax: at line 21 of <>: Bad syntax (expected directive or statement) at ^ in: "... 0000 6\nWICHTIGES DOKUMENT - SORGFÄLTIG AUFBEWAHREN!\n " .^ } } WHERE { { ?tag1 a nao:Tag ; nao:prefLabel "()" . "
The data was generated by tracker (www.gnome.org/projects/tracker/). Personally I don't know much about RDF, so it's quite possible that the input is truly malformed. If that's the case, please let me know so that I can file a tracker bug instead.
- out.txt 452
- test.py 1.14KB
Comment #1
Posted on Oct 24, 2011 by Quick RabbitThe origin of this is currently under review but in the interim, a workaround (maybe even a fix) is to escape the newline characters:
"Betriebsnummer der Einzugsstelle:\nKnappschaft\n980 0000 6\nWICHTIGES DOKUMENT - SORGFÄLTIG AUFBEWAHREN!\n "
This will result in a successful parsing.
Status: Accepted