1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
import rdflib
from rdflib.plugins.parsers.notation3 import BadSyntax
# Test for https://github.com/RDFLib/rdflib/issues/336
# and https://github.com/RDFLib/rdflib/issues/345
# stripped-down culprit:
"""\
@prefix fs: <http://freesurfer.net/fswiki/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
<http://nidm.nidash.org/iri/82b79326488911e3b2fb14109fcf6ae7>
a fs:stat_header,
prov:Entity ;
fs:mrisurf.c-cvs_version
"$Id: mrisurf.c,v 1.693.2.2 2011/04/27 19:21:05 nicks Exp $" .
"""
def test_ns_localname_roundtrip():
XNS = rdflib.Namespace("http://example.net/fs")
g = rdflib.Graph()
g.bind("xns", str(XNS))
g.add(
(
rdflib.URIRef("http://example.com/thingy"),
XNS["lowecase.xxx-xxx_xxx"], # <- not round trippable
rdflib.Literal("Junk"),
)
)
turtledump = g.serialize(format="turtle")
xmldump = g.serialize(format="xml")
g1 = rdflib.Graph()
g1.parse(data=xmldump, format="xml")
g1.parse(data=turtledump, format="turtle")
|