RDFLib/rdflib — Issue #136: Malformed literals produced when rdfa contains newlines
Author: gjhiggins
Created: 2012-02-20 08:33:33+00:00
State: open

m...@iandavis.com, 2010-10-04T13:24:42.000Z

What steps will reproduce the problem?
1. See test case below

What is the expected output? What do you see instead?
I expect to see the properly formed literal "VALUE\n"@en

Instead I see "VALUE\n"""@ (i.e. a triple quote terminator and no language)

What version of the product are you using? On what operating system?
>>> print rdflib.__version__
3.0.0

Please provide any additional information below.

Test case:

from rdflib import Graph
from rdflib.parser import StringInputSource

html = """

VALUE

VALUE

"""

g = Graph()
g.parse(StringInputSource(html), format="rdfa", lax=True)

print g.serialize(format='nt')

Removing the xml:lang attribute makes the problem disappear

Comment 1 by m...@iandavis.com
Output of running the test case is:

iand@iand-e4300:~/projects/2010/rdflib-rdfa-bug$ python test.py
"VALUE\n"""@ .
"VALUE"@en .

Comment 2 by vfaronov
This is actually a bug in the NTriples serializer, which also affects typed literals.
Here is a patch that fixes it.

Comment 3 by ed.summers

Comment 4 by ed.summers
This issue was closed by revision r1898.

Comment 5 by ed.summers
This issue was closed by revision c7cd1ccb662d.