serialisation issue

52 views
Skip to first unread message

richarddi...@gmail.com

unread,
Nov 12, 2021, 11:29:23 AM11/12/21
to rdflib-dev
I do not understand the following while making RML mappings and thus uri templates.

mapping.add(( bnode , RR.template , URIRef("dv3{}") )) works fine when serializing :)

while
DATA = Namespace('http://data/')
DATA["dv3{}"]

gives at serialisation:
<class 'Exception'> "dv3{}" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it? :( The { } are not handled properly.
But why?


richarddi...@gmail.com

unread,
Nov 12, 2021, 1:33:27 PM11/12/21
to rdflib-dev
Trace back was

File "C:\Users\richa\AppData\Roaming\Python\Python39\site-packages\rdflib\plugins\serializers\turtle.py", line 336, in path
or self.p_default(node, position, newline)
File "C:\Users\richa\AppData\Roaming\Python\Python39\site-packages\rdflib\plugins\serializers\turtle.py", line 343, in p_default
self.write(self.label(node, position))
File "C:\Users\richa\AppData\Roaming\Python\Python39\site-packages\rdflib\plugins\serializers\turtle.py", line 359, in label
return self.getQName(node, position == VERB) or node.n3()
File "C:\Users\richa\AppData\Roaming\Python\Python39\site-packages\rdflib\term.py", line 268, in n3
raise Exception(
Exception: "http://id/sensire/data/dv_{}" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?

richarddi...@gmail.com

unread,
Nov 12, 2021, 3:27:09 PM11/12/21
to rdflib-dev
Solved: changed  accidentally  Literal(template) into URIRef(template)

Literal(DATA['dv_{}']) works fine.
Reply all
Reply to author
Forward
0 new messages