我有一个想要修改的现有 rdf 图表。我想在n变量中添加信息。
# source graph
g = source.graph
#new entry
n = (URIRef(obj.pid), URIRef('info:symplectic/symplectic-elements:def/model#hasPublicUrl'), URIRef('http://itemlocation.com'))
#add to graph
g.add(n)
#save back to source
source.graph = g
输出:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:fedora-model="info:fedora/fedora-system:def/model#"
xmlns:ns1="info:symplectic/symplectic-elements:def/model#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/sympOE:mq5zf">
<fedora-model:hasModel rdf:resource="info:fedora/emory-control:PublishedArticle-1.0"/>
</rdf:Description>
<rdf:Description rdf:about="sympOE:mq5zf">
<ns1:hasPublicUrl rdf:resource="http://itemlocation.com"/>
</rdf:Description>
</rdf:RDF>
一切几乎都是正确的,但我希望它在两个方面有所不同:
- 我希望只有一个包含两个条目的 rdf:Description 部分。
- 我希望ns1别名是symp
谢谢您的帮助!