[redland] Re: Perl RDF parser
Dave Beckett
dave.beckett at bristol.ac.uk
Fri Apr 20 16:12:20 BST 2001
>>>Jonas Liljegren said:
> I looked for it in the methods that took URIs, like the perl and C
> dokumentation for parse_as_stream().
So my documentation needs updating! The perl stuff is pretty
comprehensive in POD format.
> But I don't think that the program should seg-fault. It is Perl. It
> should only die with a appropriate message. I must be able to catch
> it (with eval{}).
As I said, the URI handling inside Redland is incomplete. I'll
record this in the todo list to fix.
>
> Looking at this page:
> http://www.redland.opensource.ac.uk/docs/api/r2949.html
>
> That page should be accessible from:
> http://www.redland.opensource.ac.uk/docs/api/parser.html
>
> It says:
> base_uri: the base URI to use (or NULL if the same)
>
> But I got a segfault then $base_uri was undef (in perl).
>
> It says:
> Return value: librdf_stream of statements or NULL
>
> But I got a segfault instead of undef then file not found.
OK - another recorded bug.
That doc is the bare bones that is expanded in the perl version:
http://www.redland.opensource.ac.uk/docs/pod/RDF/Parser.html
but the phrase "with optional base RDF::URI BASE_URI" is obviously
not working. Noted.
> Yes. I just thought that you maby did that. It just seemed
> uneccessary work to convert a file path to a correct file url just to
> have it converted back again.
>
> And it is customary in Perl to provide a way to read directly from a
> filehandle instead of a temporary file. That would be much better for
> large files or slow connections.
Redland (C) reading from a Perl file handle. Cross-language stuff
like that is *hard* to do portably. I'm presently working out how to
do perl calling C calling perl in order to do callbacks. And change
perl to python, tcl, java ...
> I said: I would like to *separate* the modules. I just want the
> parser. I think it's great that you have a frontend for several
> parser plugins. That module *should* be named RDF::Parser, and be
> uploaded on CPAN.
>
> And RDF::Stream, RDF::Statement and RDF::Node must come with the
> parser. But maby they should be called RDF::Parser::Stream,
> RDF::Parser::STatement, etc.
I'm considering making Redland run on CPAN but won't grab any top
level RDF:: modules since there is no agreement on their interface.
If you just want the parser interface, tough, Redland is more than
just a parser. I could write a perl wrapper for Rapier, maybe I'll
look at.
> I don't see the necessity for a special RDF::URI, since there is a
> good perl URI module in existence.
The RDF::URI is a Redland URI - portable among languages. Again how
would Redland's URI class (in C) get access to Perl objects. I think
I made convience methods somewhere so you can just use perl URIs
objects wherever a Redland one is used. Have to check that.
>
> > All the above applies to other Redland language interfaces - Python,
> > Tcl, C.
>
> Yes. I guess that it may be a little complicated to integrate with
> Perl and at the same time have it general for several languages.
You bet. Nearly as much pain as getting expat/libxml and Berkeley DB
linking issues sorted.
> How much is realy needed for just the RDF parser interface?
>
> I'm looking for soemthing like DBI or the Template module in
> construction.
Not much.
> I searched for some Perl APIs a few days ago:
> http://uxn.nu/wraf/implementations.html
>
> Maby libgnurdf could be something? I haven't seen it before.
Redland is GNU librdf. In fact it installs as librdf.a
Never seen that before, seems to be an RDF app. of XML DOM.
Dave
More information about the redland-dev
mailing list