Hackathon project: Update RDF::Helper

Gregory Williams greg at evilfunhouse.com
Tue Apr 13 04:06:55 CEST 2010


On Apr 12, 2010, at 2:46 PM, Toby Inkster wrote:

> 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);

Your point is taken, but to be fair this same task can be more concisely done with recent versions of RDF::Trine like so:

my $model  = RDF::Trine::Model->temporary_model;
RDF::Trine::Parser->parse_url_into_model( 'http://example.com/data.rdf', $model );

(With the added bonus that it will do conneg and not require you to use RDF/XML.)

.greg



More information about the Dev mailing list