updates to RDF::Trine

Toby Inkster mail at tobyinkster.co.uk
Wed Jan 20 23:11:43 CET 2010


On Fri, 2009-12-25 at 11:24 +0000, Toby Inkster wrote:
> On Thu, 2009-12-24 at 21:33 -0800, Gregory Williams wrote:
> > 1) An RDFa parser (a trivial wrapper around tobyink's
> > RDF::RDFa::Parser module)
> 
> This fakes streaming parsing, by getting the full graph and iterating
> though it, but using RDF::RDFa::Parser's callbacks it could perform
> proper streaming parsing.
> 
> The callbacks are a little annoying to use right now because they
> don't get passed RDF::Trine::Statement objects, but rather strings
> containing URIs, literals, etc. I hope to make callbacks a little
> nicer in 0.30. 

Here's an example of how RDF::Trine::Parser::RDFa could perform proper
streaming parsing using RDF::RDFa::Parser's callback functions:

http://goddamn.co.uk/viewvc/perlmods/RDF-RDFa-Parser/TrineCompat/TrineCompatibleInterface.pm

Note of caution though: depending on $opts, the "ontriple" event will
sometimes get called with quads. (As RDF::RDFa::Parser has an optional
mode that allows named subgraphs within the document.)

The same technique would work with XML::Atom::OWL, which mimics
RDF::RDFa::Parser's API; and should work with the next release (but not
the current release) of XRD::Parser.

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>


More information about the Dev mailing list