|
NAMERDQL::Parser - A simple top-down LL(1) RDQL and SPARQL parser SYNOPSIS 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)
DESCRIPTIONRDQL::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/ CONSTRUCTORS
METHODS
NOTES 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....?
SEE ALSODBD::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 FAQ
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
POD ERRORSHey! The above document had some coding errors, which are explained below:
|