Skip to content

Instantly share code, notes, and snippets.

@tobyink
Created August 7, 2012 20:26
Show Gist options
  • Save tobyink/3289016 to your computer and use it in GitHub Desktop.
Save tobyink/3289016 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://buzzword.org.uk/2012/schema-org.html";
my $microdata = HTML::HTML5::Microdata::Parser->new(
get($uri),
$uri,
);
my $query = RDF::Query->new(<<'SPARQL');
PREFIX schema: <http://schema.org/>
SELECT ?name ?page
WHERE {
?person
a schema:Person ;
schema:name ?name ;
schema:url ?page .
}
SPARQL
my $people = $query->execute($microdata->graph);
while (my $person = $people->next)
{
printf(
"Found person: %s %s\n",
$person->{name},
$person->{page},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment