NAME
RDQL::Parser - A simple top-down LL(1) RDQL parser - see http://www.hpl.hp.com/semweb/rdql-grammar.html
SYNOPSIS
use RDQL::Parser;
my $parser = RDQL::Parser->new();
my $query = <<QUERY;
SELECT
?title, ?link
FROM
<http://xmlhack.com/rss10.php>
WHERE
(?item, <rdf:type>, <rss:item>),
(?item, <rss::title>, ?title),
(?item, <rss::link>, ?link)
USING
rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>,
rss for <http://purl.org/rss/1.0/>
QUERY;
$parser->parse($query); #parse the query
# I.e.
$parser = bless( {
'constraints' => [],
'resultVars' => [ '?title', '?link' ],
'triplePatterns' => [
[ '?item', '<rdf:type>', '<rss:item>' ],
[ '?item', '<rss::title>', '?title' ],
[ '?item', '<rss::link>', '?link' ]
],
'sources' => [ '<file:t/rdql-tests/rdf/rss10.php>' ],
'prefixes' => {
'rss' => 'http://purl.org/rss/1.0/',
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
}
}, 'RDQL::Parser' );
$parser->serialize(*STDOUT, 'N-Triples'); #print on STDOUT the RDQL query as N-Triples if possible (or an error)
DESCRIPTION
RDQL::Parser - A simple top-down LL(1) RDQL parser - see http://www.hpl.hp.com/semweb/rdql-grammar.html
CONSTRUCTORS
METHODS
- parse( PARSER, RDQL_QUERY )
-
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( { 'constraints' => [], 'resultVars' => [ '?title', '?link' ], 'triplePatterns' => [ [ '?item', '<rdf:type>', '<rss:item>' ], [ '?item', '<rss::title>', '?title' ], [ '?item', '<rss::link>', '?link' ] ], 'sources' => [ '<file:t/rdql-tests/rdf/rss10.php>' ], 'prefixes' => { 'rss' => 'http://purl.org/rss/1.0/', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' } }, 'RDQL::Parser' );
NOTES
The following 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).
SEE ALSO
DBD::RDFStore(3)
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
FAQ
- What's the difference between RDQL and SquishQL?
- None :-) The former is a bit of an extension of the original SquishQL proposal defining a proper BNF to the query language; the only practical difference is that triple patterns in the WHERE clause are expressed in a different order s,p,o for RDQL while SquishQL uses '(p s o)' without commas. In addition the URLs are expressed with angle brackets on RDQL while SquishQL do not. For more about differences between the two languages see http://rdfstore.sourceforge.net/documentation/papers/HPL-2002-110.pdf
- Is RDQL::Parser compliant to RDQL BNF?
- Yes
- Is RDQL::Parser compliant to SquishQL syntax ?
- Not yet :)
- What are RDQL::Parser extensions to RDQL BNF?
- RDQL::Parser leverage on RDFStore(3) to run proper free-text UTF-8 queries over literals; the two main extensions are
- * LIKE operator in AND clause
- * free-text triple matching like (?x, ?y, %"whatever"%)
AUTHOR
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:
- Around line 635:
'=item' outside of any '=over'
- Around line 637:
You forgot a '=back' before '=head1'
- Around line 639:
'=item' outside of any '=over'
- Around line 676:
You forgot a '=back' before '=head1'
- Around line 693:
'=item' outside of any '=over'
- Around line 709:
Expected text after =item, not a bullet
- Around line 711:
Expected text after =item, not a bullet
- Around line 713:
You forgot a '=back' before '=head1'