Closed cameronmore closed 1 month ago
This worked for me:
from rdflib import *
cco = Namespace("http://www.ontologyrepository.com/CommonCoreOntologies/")
g = Graph()
g.add((cco.A, BNode(), BNode()))
g.bind("cco", cco)
print(g.serialize())
#@prefix cco: <http://www.ontologyrepository.com/CommonCoreOntologies/> .
#cco:A [ ] [ ] .
Hello! I wrote some code that iterates through a CSV which has RDF in it like the following:
But I can't bind my user defined namespace (cco) in the graph. I've tried something like this:
And this:
But neither works. Instead,
ns1
is bound simply ascco
andns2
isrdfs
How can I bind user-defined prefixes in a graph that don't resort to ns1 ns2?