RDF::Query - A SPARQL/RDQL implementation for RDF::Redland and RDF::Core RDF::Query allows RDQL and SPARQL queries to be run against an RDF model, returning rows of matching results. REQUIREMENTS To install RDF::Query you'll need the following perl modules installed: * RDF::Core or RDF::Redland * Parse::RecDescent * DateTime::Format::W3CDTF * JSON * Error * Storable The following additional modules are recommended for some functionality: * LWP::Simple INSTALLATION To install, run: perl Makefile.PL make make test make install VERSION HISTORY Version 1.042 (2007-06-13) * Added support for Javascript URL-based extension functions. * Added GPG signing support for Javascript functions. * Added meta methods to model classes. * Added count_statements methods to model classes. * Added default format for stringifying query result streams. * Added SPARQL syntax coverage tests. * Added stream tests. * ISIRI() now returns a sop:isIRI function IRI. * Redland bridge add_uri strips off URI fragment from parser base URI. * Underlying models aren't loaded if turned off by environment variables. * Stopped using the (currently broken) multi-get code. * Model classes aren't used if turned off by environment variable. * Standardized node testing to is_node (replacing older isa_node). * GPG verification failure now throws exceptions. * GPG fingerprint handling is now whitespace insensitive. * Removed (currently) unused multiget tests. * Redland bridge uri_value returns undef if not called with a node. Version 1.041 (2006-11-26) * Removed unwanted '+' signs on stringified bigints when running under perl 5.6.x. * Fixed unicode errors when running under perl 5.6.x. * Added tests for model bridge classes. * Fixed bugs in SQL bridge class. * RDFCore and Redland bridge classes now throw error when passed a bad model object. * Bridge class support() method now responds to feature requests for 'temp_model'. * Fixed bug in RDF::Query::Model::RDFCore::isa_resource returning true for blank nodes. * Fixed code in RDF::Query::Model::::SQL::equals(). * Added partial support for new RDF::Storage::DBI storage class. * Added support for RDF::Query:::Model::SQL models in RDF::Query bridge code. * Removed RDF::Query::Model::SQL::* code that's now in RDF::Storage::DBI. * Added tests for backend bridge classes (RDF::Query::Model::*). * Added checks for which backends support XML serialization. * Fixed naive peephole tests in cases where model supports cost-based analysis. * Fixed bugs in tests that were relying on C to act like C. * Added RDF::Base support. * Fixed bug in C that prevented running queries against multiple models. * Added SimpleQueryPatternError exception class for future work on multi-get optimizations. * Removed forced dependence on Digest::SHA1. * Makefile.PL now recommends Digest::SHA1 (for jena function) and Geo::Distance (for 07-filters.t). Version 1.040 (2006-07-21) * Added support for BOUND() fiters in SQL compilation. * SQL compiler now produces valid SQL when query variable names are SQL reserved keywords. * Moved SPARQL parser test data into YAML. * Added YAML as a build-time prerequisite. * Fixed SPARQL parsing bug for blank nodes as statement objects. * Added peephole optimizer code with naive and cost-analysis strategies. * Added add_string method to RDF::Query::Model::Redland. * Added node_count method to RDF::Query::Model::Redland (only used for testing at this point). * RDF::Query::execute() now uses the peephole optimizer. * Removed punting code in RDF::Query::execute that tried to do JIT optimization. * Removed calls to getLabel() on model objects in test files. * Fixed dawg tests (was dying because of multiple plans being printed). * Fixed cost-based peephole optimizer tests (by forcing Redland to do node counting). Version 1.039 (2006-07-14) * Removed dawg tests from distribution. Only used as developer tests now. * Updated package to use Module::Install instead of ExtUtils::MakeMaker. * Fixed a spurious uninitialized warning in RDF::Query::get_bridge. Version 1.038 (2006-07-09) * Fixed DBI case-sensitivity for PostgreSQL support. * Cleaned up SQL syntax for easier debugging. * Removed extra parens in SQL that were causing postgresql to break. * Reference test foaf file using File::Spec->catfile() instead of directly. * Fixed SPARQL parsing bug for anonymous nodes in FILTER expressions. * Fixed major SQL compilation bugs for testing equality in FILTER expressions. * Fixed bug in hashing code for blank nodes in SQL compiler. Version 1.037 (2006-07-06) * execute() method now takes optional 'bind' parameter for pre-binding query variables. * Updated code to support basic FILTERs in SQL compilation. * Fixed bug in SQL compilation where no WHERE clause was needed. * Fixed bug in SQL compilation when using model-specific Statements tables. * Added Storable to the list of required modules (was missing in the list). * Fixed typos in metadata about past versions in DOAP Changes.ttl. Version 1.036 (2006-06-26) * Fixed memory leak in RDF::Query::Stream that resulted in too many database handles. * Initial support for OPTIONALs in SQL compiler. * Removed LWP requirement for systems without libwww. * Added support for class variable to hold parsing errors. (Beware under threads.) * RDF::Query now sets error variable upon parsing error. (Access with C.) * Fixed POD errors, and added tests for POD coverage. * Added model API methods to SQL model class. * Added C method to RDF::Query::Stream. Version 1.035 (2006-06-04) * Added DAWG tests and harness. * Rewrote core logic in OPTIONAL handling code. * Comparisons on literals now respect numeric datatypes. * Fixed outdated calling conventions in casting functions. * Added custom functions: + jena:sha1sum + jena:now + jena:langeq + jena:listMember + ldodds:Distance * Added new model methods: equals, subject, predicate, object. * Relocated external http-based test data to .Mac URLs. Version 1.034 (2006-05-01) * Added JSON serialization for bindings and boolean queries. * Initial support for compiling RDF queries to SQL queries using the Redland schema. * Added to_string method to query results Stream class. * Model objects now store the query parse tree for access to data needed in serialization. * Unquoted number and boolean literals in SPARQL are now datatyped appropriately. * Fixed crashing bug when RDF::Query::Model::Redland::as_string was called with an undefined value. * Fixed bug parsing queries with predicate starting with 'a' (confused with { ?subj a ?type}). * Fixed bug parsing queries whose triple pattern ended with the optional dot. Version 1.033 (2006-03-08) * Updated test suite to work if one of the model classes is missing. * Data-typed literals are now cast appropriately when used in a FILTER. * Added support for xsd:dateTime datatypes using the DateTime module. * Added support for LANG(), LANGMATCHES() and DATATYPE() built-in functions. * Updated TODO list. * Added more exception types to RDF::Query::Error. * Added POD coverage. * Fixed SPARQL parsing bug for logical operators <= and >=. Version 1.032 (2006-03-03) * Replaced the Parse::RecDescent SPARQL parser with a much faster hand-written one. * Updated SPARQL parsing rules to be better about URI and QName character sets. * FILTER equality operator now '=', not '==' (to match SPARQL spec). * Initial support for FILTER constraints as part of the triple pattern structure (Will allow for nested FILTERs). * Implemented support for ordering query results by an expression. * Fixed bug in expresion handling of unary minus. * Fixed bug in Redland NAMED GRAPH parsing. * Fixed bug in RDF::Core parsing code where blank nodes would be accidentally smushed. Version 1.031 (2006-02-08) * Added support for NAMED graphs. Version 1.030 (2006-01-13) * Added support for SELECT * in SPARQL queries. * Added support for default namespaces in SPARQL queries. * Added tests for querying RDF collections in SPARQL (1 ?x 3) * Added tests for triple patterns of the form { ?a ?a ?b . } * Added tests for default namespaces in SPARQL. * Added tests for SELECT * SPARQL queries. * Bugfix where one of two identical triple variables would be ignored ({ ?a ?a ?b }). Version 1.028 (2005-11-18) * Added SPARQL functions: BOUND, isURI, isBLANK, isLITERAL. * Updated SPARQL REGEX syntax. * Updated SPARQL FILTER syntax. * Added SPARQL RDF Collections syntactic forms. * Fixed FILTER support in OPTIONAL queries. * Added binding_value_by_name method to Query results stream class. * Added isa_blank methods to RDF::Redland and RDF::Core model classes. * Fixed RDF literal datatyping when using Redland versions >= 1.00_02. * Updated SPARQL grammar to make 'WHERE' token optional. * Added directives to SPARQL grammar. * Updated SPARQL 'ORDER BY' syntax to use parenthesis. * Fixed SPARQL FILTER logical-and support for more than two operands. * Fixed SPARQL FILTER equality operator syntax to use '=' instead of '=='. * Now requires Test::More 0.52 because of changes to is_deeply(). Version 1.027 (2005-07-28) * Updated to follow SPARQL Draft 2005.07.21: + ORDER BY arguments now use parenthesis. + SPARQL parser now supports ORDER BY operands: variable, expression, or function call. * Added binding_value_by_name() method to query result streams. Version 1.026 (2005-06-05) * Added new DBI model bridge (accesses Redland's mysql storage directly). * Added built-in SPARQL functions and operators (not connected to grammar yet). * Added bridge methods for accessing typed literal information. Version 1.024 (2005-06-02) * Added missing SPARQL OFFSET grammar rules. * Added XML Results support for graph and boolean queries (DESCRIBE, CONSTRUCT, ASK). * Fixed major bugs in RDF::Core bridge: + Bridge wasn't using passed model. + Literal construction was broken. + Blank node construction was broken when no identifier was specified. * Stream::bindings_count now returns the right number even if there is no data. * XML Result format now works with RDF::Core models. * The Model bridge object is now passed to the Stream constructor. * Internal code now uses the variables method. * Removed redundant code from ORDER BY/LIMIT/OFFSET handling. * Removed unused count method. * Removed unused delegating AUTOLOAD. * Removed unused parse_files method. * Removed usused add_file method. * Removed duplicate net test file. * Added test file for local file-based SPARQL 'FROM' queries. * Added test file for SPARQL Result Forms (LIMIT, ORDER BY, OFFSET, DISTINCT). * Added test file for SPARQL Protocol for RDF (XML Results). * Added new tests based on Devel::Cover results. * Some test files now run against both Redland and RDF::Core: + 00-simple.t + 03-coverage.t + 10-sparql_protocol.t * All debugging is now centrally located in the _debug method. * Moved Stream class to lib/RDF/Query/Stream.pm. * Fixed tests that broke with previous fix to CONSTRUCT queries. * Fixed tests that broke with previous change to ASK query results. Version 1.021 (2005-06-01) * Added SPARQL UNION support. * Broke OPTIONAL handling code off into a seperate method. * Added new debugging code to trace errors in the twisty web of closures. Version 1.020 (2005-05-18) * Added support for SPARQL OPTIONAL graph patterns. * Calling bindings_count on a stream now returns 0 with no data. * Added Stream methods: + is_bindings + binding_name + binding_values + binding_names * Added as_xml method to Stream class for XML Binding Results format. Version 1.016 (2005-05-08) * Added initial support for SPARQL ASK, DESCRIBE and CONSTRUCT queries. + Added new test files for new query types. * Added methods to bridge classes for creating statements and blank nodes. * Added as_string method to bridge classes for getting string versions of nodes. * Broke out triple fixup code into fixup_triple_bridge_variables(). * Updated FILTER test to use new Geo::Distance API. Version 1.015 (2005-05-03) * Fixes to the arguments passed to FILTERs. * Filter tests now show example of two custom filters: + Transitive subClassOf testing. + Logical comparison operators (range testing lat/lon values). * Added literal_value, uri_value, and blank_identifier methods to bridges. * Redland bridge now calls sources/arcs/targets when only one field is missing. * Fixes to stream code. Iterators are now destroyed in a timely manner. + Complex queries no longer max out mysql connections under Redland. * Cleaned up node sorting code. + Removed dependency on Sort::Naturally. + Added new node sorting function ncmp(). * check_constraints now calls ncmp() for logical comparisons. * Added get_value method to make bridge calls and return a scalar value. * Fixed node creation in Redland bridge. * Moved DISTINCT handling code to occur before LIMITing. * Added variables method to retrieve bound variable names. * Added binding_count and get_all methods to streams. * get_statments bridge methods now return RDF::Query::Stream objects. Version 1.014 (2005-04-26) * Made FILTERs work in SPARQL. * Added initial SPARQL support for custom function constraints. * SPARQL variables may now begin with the '$' sigil. * Added direction support for ORDER BY (ascending/descending). * Added 'next', 'current', and 'end' to Stream API. Version 1.012 (2005-04-24) * Stream objects now handle being constructed with an undef coderef. * 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(). * 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. * Updated tests. Version 1.010 (2005-04-21) * 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). * 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). + Added SPARQL support for DISTINCT and ORDER BY. * Moved model-specific code into RDF::Query::Model::*. * Moving over to redland's query API (pass in the model when query is executed). COPYRIGHT Copyright (C) 2005-2006 Gregory Williams. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR Gregory Williams $Id: README 209 2007-06-13 20:04:02Z samofool $