I'm using rdflib-jsonld to parse some NoSQL data and insert into Sesame. This is the problematic portion of the code:
context = {
"@context": {
"isGiven": URIRef('<'+'http://purl.org/net/something#isGiven'+rdfLizerItem['FooByBar']+'>'),
"administeredAs": URIRef('<'+'http://purl.org/net/something#administeredAs'+'>'),
"type":URIRef('<'+'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'+'>'),
}
}
recipient=URIRef('<'+someUrl+rdfLizerItem['FooRecipient']+'>')
jsonldOutputIsAdmin = {"@id": recipient,"isGiven": URIRef('<'+someUrl+ rdfLizerItem['Quantity']+'>')}
print jsonldOutputIsAdmin
g = Graph()
g.parse(data=json.dumps(jsonldOutputIsAdmin), format='json-ld', context=context)
g.close()
for s,p,o in g:
pprint.pprint ((s,p,o))
The issue is upon the addition of <
and >
to the URL for @id
, the URL of the subject becomes the complete path to it. For example:
(rdflib.term.URIRef(u'file:///C:/path/to/the/url/<http:/purl.org/net/ontologyName#subject>'),
rdflib.term.URIRef(u'<http://purl.org/net/ontologyName#predicate>'),
rdflib.term.Literal(u'<http://purl.org/net/ontologyName#object>'))
I want only the URL in the subject and not the file path. What is causing the issue and how I can I resolve it?
I need <
and >
to be able to export the triples to Sesame.