n3 (turtle, nt) serializer fails to encode '>' character · Issue #263 · RDFLib/rdflib (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
graphs containing urls containing the '>' are not escaped properly.
for example:
>>> u = rdflib.URIRef("http://foo/less<than>greater")
>>> g = rdflib.Graph()
>>> g.add((u, u, u))
>>> g.serialize(format='nt')
b'<http://foo/less<than>greater> <http://foo/less<than>greater> <http://foo/less<than>greater> .\n\n'
the best documentation i could strike up was [1](on turtle), where it explicitly says that a URI may only contain ucharacter, which may not contain an unescaped '>'. i don't know how precisely characters are to be escaped to be valid in n3/turtle/nt, but but return "<%s>" % self
(from rdflib.term.URIRef's n3 method) most certainly isn't.