[redland-dev] Redland for Revolution & questions
Dave Beckett
dave.beckett at bristol.ac.uk
Fri Oct 15 10:39:28 BST 2004
On Thu, 14 Oct 2004 23:58:26 +1300, rodney tamblyn <rodney at stonebow.otago.ac.nz> wrote:
> Hi everyone,
>
> Together with a fellow student (Noel Garside) here I've been working on
> porting Redland to a set of DLLs so they can be called from Runtime
> Revolution (Rev) programming environment (http://www.runrev.com). The
> DLLs include Rev glue and wrapper code allowing callbacks, exchange of
> variables, and exposing of the Redland API within the Rev scripting
> environment. Things have been going pretty well, we've got Redland
> compiling fine under Windows, including the extra header files and glue
> files to expose wrapped Redland functions within Revolution. Once
> everythings going fine on Windows we'll take a look at doing same on
> OSX.
I'm not familiar with that environment.
> I'm going to use Redland as part of research project I'm working on to
> create a collaborative image annotation application for use in medical
> teaching settings.
Interesting. The Annotea annotation stuff uses some of the Redland
libraries.
> So far we've been able to create a world, storage object (memory) and
> model, parse in a URI, add statements, and print out a model (using
> librdf_model_print).
>
> At the moment I have a problem which I'm hoping list members may be
> able to help with. If I create a memory storage I'm able to complete
> the example above successfully. However if change the storage params
> to create a hashes database, and repeat, the persistent database is
> created successfully on disk, but Rev crashes when calling
> librdf_model_print. I've also tried creating a serializer and calling
> serializer_print_model_to_file with same results. Executing the same
> code directly from C as a compiled application (eg example1.exe) runs
> fine.
So the errors happen when you C standard I/O (printf etc.). I don't
have an immediate diagnosis since you seem to have it working via C.
Suggests it's the runrev interfering.
> If I create an example which just reads a model from a hashes database
> on disk, and feed it the database created by Rev, it prints the model
> out fine. This shows that there's nothing wrong with the model, or
> storage, but there's something going on in the serializer when called
> from Rev. I think what may be happening is that the serializer is
> raising an error, but I have not implemented an error callback message
> (world_set_error). Perhaps this is then returning control from the
> external to Rev in such a way as to cause an memory exception error.
That's possible I guess. The serializer pretty much only calls an
error or warning handler in a few rare occasions such as unable to
write an RDF property in RDF/XML (warning) or some XML
escaping / Unicode encoding problem (error), data corruption (error).
> I'm pretty new to C programming (although very experienced in scripting
> environments) so I'm hoping someone kind could provide some C examples
> showing:
>
> - an example "hello world" redland error handling function - this could
> for example just print the error to stderr
That's what the default built-in handler does. You can of course
replace that.
> - code to setup this function (i.e appropriate syntax to configure this
> via world_set_error)
> - ideally, and example which will cause an error (so that I can test
> this is working correctly).
That should be pretty straightforward. examples/example4.c is the
basis of this code, as all it does is serialize.
...later...
I find that the error reporting code in the serializer isn't working.
Because it's so rare, looks like it hasn't been tested recently.
I'll try to make a patch sometime soon.
You can try it in my test code which makes a bad Unicode URI string
which is one way to cause a crash.
> I can then modify the example to send callback messages to Revolution
> when errors are raised. Once I've got error reporting working for the
> above, I'll implement functions for serializer_set_error and
> serializer_set_warning as this is where I think my problem is.
>
> A couple more questions:
> 1) - if an error occurs and world_set_error has not been set, what
> happens?
It gets printed to stderr.
>
> 2) - are warnings and logger actually utilized in the library? I
> notice quite a lot of messages being written to stdout and stderr, and
> just wondered if these shouldn't more appropriately be sent to the
> logger?
They are used in the library, to report information, warnings and
errors. The stdout/stderr prints are just the default. Doing nothing
on an error would be a bad default.
> Thanks for help and suggestions in advance.
Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serializer-crash.c
Type: application/octet-stream
Size: 1113 bytes
Desc: not available
Url : http://lists.usefulinc.com/pipermail/redland-dev/attachments/20041015/e9efa5f5/serializer-crash.obj
More information about the redland-dev
mailing list