[redland-dev] Re: Storage not getting updated.

Jorge Santos jorge.jsf at gmail.com
Thu Aug 25 05:22:43 BST 2005


On 8/24/05, Jorge Santos <jorge.jsf at gmail.com> wrote:
> On 8/24/05, Jorge Santos <jorge.jsf at gmail.com> wrote:
> > On 8/24/05, Jorge Santos <jorge.jsf at gmail.com> wrote:
> > > Hello, I'm writing an application in ruby, I'm defining the storage like so:
> > >
> > > storage = Redland::TripleStore.new("hashes", "pinfo",
> > > "hash-type='bdb',dir='" + STORAGE_DIR + "'")
> > >
> > > But I have a problem, I add statements in the program, but I can only
> > > access them as long as the program is running, once the program ends
> > > the bdb files are empty, as can be seen by:
> > >
> > > jsf at deckard$ rdfproc pinfo print
> > > [[
> > > ]]
> > >
> > > Now, I don't see anything in the docs that hints to having to "save"
> > > the database or such.  There's this function librdf_storage_sync() in
> > > the library, but is undocumented in the api.
> > >
> > > Am I missing something or is there a bug?
> >
> > On further news, something wierd is happening, if I don't have any
> > triples in the storage and I run the program, nothing is saved.
> > However, if I have some triples (inserted from a file via rdfproc
> > parse), some of the triples inserted in the program get saved and some
> > don't. Mmmh, ideas?
> >
> 
> I tested with the example.rb and I was having the same problem, so I added:
> 
> Redland::librdf_free_model(model.model)
> 
> at the very end of the file and it worked, so I get ruby is not really
> running this function as I guess it should.
> 

Well, the relevant test case is failing too, so I'm not entirely
crazy.  I think I've spotted the problem.  There is a bunch of logging
statements in the ruby finalizers, but the logging object is not
getting created.  So what I think is happening is that execution is
not reaching the call to  Redland::librdf_free_model(model) because of
the call to a method of the nil object (which nil does not have), the
only thing that puzzles me is that Ruby is not reporting an error when
trying to call this method, but commenting it out seems to solve the
problem, as well as moving it after the free call and creating the
logging object, so I guess that's it.  Any ideas why ruby is not
reporting the error?  Also in redland.rb there is a commented method
call:

        #Redland::librdf_free_world world

Does anyone know the reason why it's commented?


bye,
jorge


More information about the redland-dev mailing list