RDQL::Parser - A simple top-down LL(1) RDQL and SPARQL parser
use RDQL::Parser; my $parser = RDQL::Parser->new(); my $query = <<QUERY; PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rss: <http://purl.org/rss/1.0/> SELECT ?title ?link FROM <http://xmlhack.com/rss10.php> WHERE (?item, rdf:type <rss:item>) (?item, rss:title, ?title) (?item, rss:link ?link) QUERY; $parser->parse($query); #parse the query # I.e. $parser = bless( { 'distinct' => 0, 'constructPatterns' => [], 'prefixes' => { 'fn' => 'http://www.w3.org/2004/07/xpath-functions', 'op' => 'http://www.w3.org/2001/sw/DataAccess/operations', 'owl' => 'http://www.w3.org/2002/07/owl#', 'dcq' => 'http://purl.org/dc/terms/', 'dc' => 'http://purl.org/dc/elements/1.1/', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'rss' => 'http://purl.org/rss/1.0/', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xsd' => 'http://www.w3.org/2001/XMLSchema#', 'daml' => 'http://www.daml.org/2001/03/daml+oil#' }, 'graphPatterns' => [ { 'constraints' => [], 'optional' => 0, 'triplePatterns' => [ [ 0, '?item', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<rss:item>' ], [ 0, '?item', '<http://purl.org/rss/1.0/title>', '?title' ], [ 0, '?item', '<http://purl.org/rss/1.0/link>', '?link' ] ] } ], 'sources' => [ '<http://xmlhack.com/rss10.php>' ], 'describes' => [], 'queryType' => 'SELECT', 'resultVars' => [ '?title', '?link' ], }, 'RDQL::Parser' ); $parser->serialize(*STDOUT, 'N-Triples'); #print on STDOUT the RDQL query as N-Triples if possible (or an error)
RDQL::Parser - A simple top-down LL(1) RDQL and SPARQL parser - see http://www.w3.org/TR/rdf-sparql-query/ and http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/
If use Data::Dumper(3) to actually dumpo out the content of the PARSER variable after invoching the parse() method it lokks like: $VAR1 = bless( { 'distinct' => 0, 'constructPatterns' => [], 'prefixes' => { 'fn' => 'http://www.w3.org/2004/07/xpath-functions', 'op' => 'http://www.w3.org/2001/sw/DataAccess/operations', 'owl' => 'http://www.w3.org/2002/07/owl#', 'dcq' => 'http://purl.org/dc/terms/', 'dc' => 'http://purl.org/dc/elements/1.1/', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'rss' => 'http://purl.org/rss/1.0/', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xsd' => 'http://www.w3.org/2001/XMLSchema#', 'daml' => 'http://www.daml.org/2001/03/daml+oil#' }, 'graphPatterns' => [ { 'constraints' => [], 'optional' => 0, 'triplePatterns' => [ [ 0, '?item', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>', '<rss:item>' ], [ 0, '?item', '<http://purl.org/rss/1.0/title>', '?title' ], [ 0, '?item', '<http://purl.org/rss/1.0/link>', '?link' ] ] } ], 'sources' => [ '<http://xmlhack.com/rss10.php>' ], 'describes' => [], 'queryType' => 'SELECT', 'resultVars' => [ '?title', '?link' ], }, 'RDQL::Parser' );
The RDQL implementation is actually an extension of the original RDQL spec (http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/) to allow more SQL-like Data Manipulation Language (DML) features like DELETE and INSERT - which is much more close to the original rdfdb query language which SquishQL/RDQL are inspired to (see http://www.guha.com/rdfdb). As well as the SPARQL one....?
DBD::RDFStore(3)
http://www.w3.org/TR/rdf-sparql-query/ http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/ http://ilrt.org/discovery/2002/04/query/ http://www.hpl.hp.com/semweb/doc/tutorial/RDQL/ http://rdfstore.sourceforge.net/documentation/papers/HPL-2002-110.pdf
Alberto Reggiori <areggiori@webweaving.org> Andy Seaborne <andy_seaborne@hp.com> is the original author of RDQL Libby Miller <libby.miller@bristol.ac.uk> is the original author of SquishQL
8 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
Expected text after =item, not a bullet
To install RDFStore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDFStore
CPAN shell
perl -MCPAN -e shell install RDFStore
For more information on module installation, please visit the detailed CPAN module installation guide.