NAME

RDF::Query - A SPARQL/RDQL implementation for RDF::Redland and RDF::Core

SYNOPSIS

my $query = new RDF::Query ( $rdql, undef, undef, 'rdql' );
my @rows = $query->execute( $model );

my $query = new RDF::Query ( $sparql, undef, undef, 'sparql' );
my $iterator = $query->execute( $model );
while (my $row = $iterator->()) {
  ...
}

DESCRIPTION

RDF::Query allows RDQL and SPARQL queries to be run against an RDF model, returning rows of matching results.

See http://www.w3.org/TR/rdf-sparql-query/ for more information on SPARQL. See http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/ for more information on RDQL.

REQUIRES

L<RDF::Redland|RDF::Redland>
 or
L<RDF::Core|RDF::Core>

L<Parse::RecDescent|Parse::RecDescent>
L<LWP::Simple|LWP::Simple>
L<Sort::Naturally>

METHODS

new ( $query, $baseuri, $languri, $lang )

Returns a new RDF::Query object for the query specified. The query language used will be set if $languri or $lang is passed as the URI or name of the query language, otherwise the query defaults to SPARQL.

get ( $model )

Executes the query using the specified model, and returns the first row found.

execute ( $model )

Executes the query using the specified model. If called in a list context, returns an array of rows, otherwise returns an iterator.

query_more ( @triples )

Internal recursive query function to bind pivot variables until only result variables are left and found from the RDF store. Called from query.

parse_files ( @files )

Parse a local RDF file into the RDF store.

parse_urls ( @urls )

Retrieve a remote file by URL, and parse RDf into the RDF store.

REVISION HISTORY

$Log: Query.pm,v $
Revision 1.12  2005/04/25 01:27:40  greg
- stream objects now handle being constructed with an undef coderef

Revision 1.11  2005/04/25 00:59:29  greg
- streams are now objects usinig the Redland QueryResult API
- RDF namespace is now always available in queries
- row() now uses a stream when calling execute()
- check_constraints() now copies args for recursive calls (instead of pass-by-ref)
- added ORDER BY support to RDQL parser
- SPARQL constraints now properly use the 'FILTER' keyword
- SPARQL constraints can now use '&&' as an operator
- SPARQL namespace declaration is now optional

Revision 1.10  2005/04/21 08:12:07  greg
- updated MANIFEST
- updated POD

Revision 1.9  2005/04/21 05:24:54  greg
- execute now returns an iterator
- added core support for DISTINCT, LIMIT, OFFSET
- added initial core support for ORDER BY (only works on one column right now)
- added SPARQL support for DISTINCT and ORDER BY
- added stress test for large queries and sorting on local scutter model

Revision 1.8  2005/04/21 02:21:44  greg
- major changes (resurecting the project)
- broke out the query parser into it's own RDQL class
- added initial support for a SPARQL parser
  - added support for blank nodes
  - added lots of syntactic sugar (with blank nodes, multiple predicates and objects)
- moved model-specific code into RDF::Query::Model::*
- cleaned up the model-bridge code
- moving over to redland's query API (pass in the model when query is executed)

Revision 1.7  2005/02/10 09:57:24  greg
- add code and grammar for initial constraints support
- misc updates

Revision 1.6  2004/07/12 11:24:09  greg
- changed order of some Parse::RecDescent rules for common case

Revision 1.5  2004/07/12 11:17:34  greg
- updated namespace for relationship schema
- fixed broken qURI regex in RDQL parser
- query() now reverses result list (hack)
- RDF::Query::Redland : getLabel now returns identifier for blank nodes

Revision 1.4  2004/07/07 06:39:32  greg
- added t/02-coverage.t and made code changes based on Devel::Cover results

Revision 1.3  2004/07/07 04:45:57  greg
- updated POD
- commented out debugging code
- moved backend model detection code to C<model>
- changed block eval to string eval to only load one backend if both are present

Revision 1.2  2004/07/07 03:43:14  greg
- refactored code that deals with the RDF model
- moved RDF::Core specific code to RDF::Query::RDFCore
- added Redland support in RDF::Query::Redland
- now uses Redland if available, falls back on RDF::Core
- updated tests (removed RDF::Core specific code)

Revision 1.1.1.1  2004/07/05 03:05:38  greg
import

AUTHOR

Gregory Williams <gwilliams@cpan.org>

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 203:

=end private without matching =begin. (Stack: =over)

Around line 464:

=end private without matching =begin. (Stack: =over)

Around line 488:

=end private without matching =begin. (Stack: =over)