RDFLib: Namespace prefixes in XML serialization

前端 未结 1 1338
感动是毒
感动是毒 2020-12-19 11:16

In a Python script using RDFLib 3.0, I get the following XML-Output when serializing my triples:



        
相关标签:
1条回答
  • 2020-12-19 12:03

    I eventually found a solution to this by looking at some (quite messily distributed) rdflib doc files. For the (Conjunctive)Graph storing the triples, call

    mygraph.bind(prefix, URIRef(url))
    

    i.e.

    mygraph.bind('ex', URIRef('http://www.my-example.intra/ontologies/ci.owl#'))
    

    Passing 'False' as 3rd argument overrides existing namespace prefix bindings.

    0 讨论(0)
提交回复
热议问题