(Python) TripleStore usage?

19 views
Skip to first unread message

Seth Shaw

unread,
Nov 10, 2011, 4:31:38 PM11/10/11
to foresite
Has anyone had success using foresite.tripleStore? I want to work on a
local persistent store but haven't had any success myself. I have
rdflib 3 installed along with the foresite trunk. Theoretically the
code below *should* work:

from foresite import *
from foresite.tripleStore import BdbTripleStore
from rdflib import URIRef, Namespace

store = BdbTripleStore(db='rdfdb')
a = Aggregation('my-aggregation-uri')
a.title = "My Aggregation"
a._dcterms.created = "2008-07-10T12:00:00"

res = AggregatedResource('my-photo-1-uri')
res.title = "My first photo"
res2 = AggregatedResource('my-photo-2-uri')
res2.title = "My second photo"
a.add_resource(res)
a.add_resource(res2)

me = Agent()
me.name = "Rob Sanderson"
a.add_agent(me, 'creator')

rdft = RdfLibSerializer('turtle')
a.register_serialization(rdft)
remdoc = a.get_serialization()
print remdoc.data

print "# Test Store and Reload #"
store.store_aggregation(a)
a_loaded = store.load_aggregation('my-aggregation-uri')
a_loaded.register_serialization(rdft)
remdoc2 = a_loaded.get_serialization()
print remdoc2

But I receive errors from the TripleStore class (line 31) stating that
URIRef doesn't have the attribute '_graph_'. Any ideas?

- Seth
Reply all
Reply to author
Forward
0 new messages