Created
August 7, 2012 20:26
-
-
Save tobyink/3289016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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