1

変更したい既存の 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>

すべてがほぼ正しいですが、次の 2 つの点で異なるようにしたいと考えています。

  1. 両方のエントリを含む rdf:Description セクションを 1 つだけにしたいのです。
  2. ns1エイリアスをsympにしたい

助けてくれてありがとう!

4

1 に答える 1