[redland-dev] triples with context
Eyal Oren
eyal.oren at deri.org
Fri Oct 14 18:50:02 BST 2005
On 10/13/05/10/05 20:01 -0700, Dave Beckett wrote:
>Eyal Oren wrote:
>>Hi,
>
>>Therefore I'm trying to use a hash_store (without serialising to
>>ntriples or xml). First run: I create a model with a hash store and add
>>some triples to it. Second run, I read from the earlier hash store, but
>>if I associate a model with that hash_store it is empty.
>
>That's strange. As long as you open the second store with model options
>contexts='yes', it should find the contexts. You pretty much have to
>have the identical storage options for re/opening a model. However
>what you say suggest you have option new='yes' which will zero any
>existing model on opening.
Hi, my problem with hash storage is not specifically with contexts, but
that my model is not stored (therefore i'm using serialisation, which is
not possible with contexts). See following code:
#!/bin/ruby
require 'rdf/redland'
def make_uri uri
Redland::Node.new(Redland::Uri.new(uri))
end
store = Redland::HashStore.new('bdb', 'test', '.', false)
model = Redland::Model.new(store)
model.add make_uri('now'), make_uri('time'), make_uri(Time.now.to_s)
model.dump_model
This code adds the triple to the model every time, but after running it,
the 'test' store is empty, which can be verified with rdfproc, or by
running it the same scirpt again (it will only show the new triple).
Adding triples to a hash_store with rdfproc works fine, I can then read
them in with this little script for example.
Am I missing some code to 'close' the hash storage, and make the data
persistent? I can't find such a thing in the API.
Eyal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.gnomehack.com/pipermail/redland-dev/attachments/20051014/7816f560/attachment.pgp
More information about the redland-dev
mailing list