Hackathon project: Update RDF::Helper

Toby Inkster mail at tobyinkster.co.uk
Mon Apr 12 20:46:08 CEST 2010


On Mon, 12 Apr 2010 16:36:42 +0200
Kjetil Kjernsmo <kjetil at kjernsmo.net> wrote:

> Currently, RDF::TrineShortcuts isn't OOP

And deliberately so. Most of its functionality is around areas where
making it object-oriented would only serve to add syntactic vinegar.

	$model = rdf_parse('http://example.com/data.rdf');

is intended as a shortcut around this kind of thing:

	$store  = RDF::Trine::Store->temporary_store;
	$model  = RDF::Trine::Model->new($store);
	$ua     = LWP::UserAgent->new;
	$resp   = $ua->get('http://example.com/data.rdf');
	$parser = RDF::Trine::Parser::RDFXML->new;
	$parser->parse_into_model('http://example.com/data.rdf',
		$resp->decoded_content);

The $model object it creates is an RDF::Trine::Model; an
honest-to-goodness object, with methods and everything!

I could perhaps add some little hooks to enable the functions to be
called like:

	$model = RDF::TrineShortcuts->parse($url);

And give people warm, fuzzy feelings.

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



More information about the Dev mailing list