updates to RDF::Trine
Gregory Williams
greg at evilfunhouse.com
Fri Dec 25 21:54:48 CET 2009
On Dec 25, 2009, at 3:24 AM, 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.
Right. I'll look into improving it when the new callback code is in place.
>> 2) A function for parsing RDF content from a URL with proper parser
>> dispatching based on mime-type. This allows really trivial parsing of
>> content:
>>
>> RDF::Trine::Parser->parse_url_into_model( $url, $model );
>
> Given that RDF::Trine::Parser will have access to the HTTP::Response
> object, you may want to consider (at least, optionally):
>
> use HTTP::Link::Parser;
> parse_links_into_model($resp, $model);
Sure, I can look into that.
I'm also open to suggestions for other interfaces to this functionality, as I'm sure there are many ways it could be used. Before going too much farther with it, though, I'd like to address support for named graphs in both the store and parser layers (we've got methods like parse_into_model right now, but basically no support for parsing into a specific named graph). This is going to be important when integrating all this new parser code with RDF::Query's 'FROM NAMED' handling.
> Also, note that this regexp doesn't do what you want it to do:
>
> /(turtle|rdf+xml)/
Whoops! Sure enough. I'll fix that, but since it's just part of a heuristic, it generally won't cause failures...
thanks,
.greg
More information about the Dev
mailing list