Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created August 7, 2012 21:17
Show Gist options
  • Save tobyink/3289436 to your computer and use it in GitHub Desktop.
Save tobyink/3289436 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use HTML::HTML5::Microdata::Parser;
use LWP::Simple 'get';
use RDF::Query;
my $uri = "http://helion.pl/";
my $microdata = HTML::HTML5::Microdata::Parser->new(
get($uri),
$uri,
);
my $query = RDF::Query->new(<<'SPARQL');
PREFIX v: <http://data-vocabulary.org/>
SELECT ?item ?av
WHERE {
?review v:itemreviewed ?item .
?review v:rating ?rating .
?rating v:average ?av .
}
SPARQL
my $people = $query->execute($microdata->graph);
while (my $person = $people->next)
{
printf(
"Found review: %s %s\n",
$person->{item},
$person->{av},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment