BNode reuse problem

3 views
Skip to first unread message

meme...@gmail.com

unread,
Jul 18, 2008, 10:16:20 AM7/18/08
to rdfalchemy-dev
Hello - I hope this is no stupid question, but I did not find an
answer anywhere - I still kind of hope that I do something wrong
rather than this being a bug.

I have this code (taken partially from the given example) which I
start on an empty store given by the url:

---
from rdfalchemy.sesame2 import SesameGraph
from rdflib import URIRef, Literal, BNode, Namespace

url = "http://...:8080/openrdf-sesame/repositories/testid"

store = SesameGraph(url)

FOAF = Namespace("http://xmlns.com/foaf/0.1/")

donna = BNode()
print "BNode donna: ", donna

print "Store new BNode donna"
store.add((donna, FOAF["name"], Literal("Donna Fales")))

print "Find this BNode again from the store"
for s, p, o in store.triples((None, FOAF["name"], Literal("Donna
Fales"))):
print s, p, o

print "Store new statement for the just re-found BNode"
store.add((s, FOAF["nick"], Literal("donna", lang="foo")))

print "Contents of store"
for s, p, o in store.triples((None, None, None)):
print s, p, o

---
Now the output is:

BNode donna: FePsOSsW3
Store new BNode donna
Find this BNode again from the store
node13cqu1squx36 http://xmlns.com/foaf/0.1/name Donna Fales
Store new statement for the just re-found BNode
Contents of store
node13cqu1squx36 http://xmlns.com/foaf/0.1/name Donna Fales
node13cqu1squx37 http://xmlns.com/foaf/0.1/nick donna
---
So: a new different BNode was created in the store rather than - as I
was expecting - the same being used as subject for the new statement.
Why is that? Do I do something wrong?

Thanks for any help!
Axel

PS Doing the same on a simple RDFlib Graph() behaves differently and
as I would have expected: the same BNode is used.

meme...@gmail.com

unread,
Jul 18, 2008, 4:48:29 PM7/18/08
to rdfalchemy-dev
I forgot to mention the versions I was using for this test:

Python 2.5.2
RDFAlchmeny 0.2b2dev-r106
rdflib-2.4.0
OpenRDF Sesame 2.2beta2

Thanks for any hint on the problem!
Axel
Reply all
Reply to author
Forward
0 new messages