NAME

RDF::Query::Compiler::SQL - Compile a SPARQL query directly to SQL.

VERSION

This document describes RDF::Query::Compiler::SQL version 2.902.

METHODS

new ( $parse_tree )

Returns a new compiler object.

compile ()

Returns a SQL query string for the specified parse tree.

emit_select

Returns a SQL query string representing the query.

limit_clause

Returns a SQL LIMIT clause, or an empty string if the query does not need limiting.

order_by_clause

Returns a SQL ORDER BY clause, or an empty string if the query does not use ordering.

variable_columns ( $var )

Given a variable name, returns the set of column aliases that store the values for the column (values for Literals, URIs, and Blank Nodes).

add_variable_values_joins

Modifies the query by adding LEFT JOINs to the tables in the database that contain the node values (for literals, resources, and blank nodes).

patterns2sql ( \@triples, \$level, %args )

Builds the SQL query in instance data from the supplied @triples. $level is used as a unique identifier for recursive calls.

%args may contain callback closures for the following keys:

'where_hook'
'from_hook'

When present, these closures are used to add SQL FROM and WHERE clauses to the query instead of adding them directly to the object's instance data.

expr2sql ( $expression, \$level, %args )

Returns a SQL expression for the supplied query $expression. $level is used as a unique identifier for recursive calls.

%args may contain callback closures for the following keys:

'where_hook'
'from_hook'

When present, these closures are used to add necessary SQL FROM and WHERE clauses to the query.

_mysql_hash ( $data )

Returns a hash value for the supplied $data string. This value is computed using the same algorithm that Redland's mysql storage backend uses.

_mysql_node_hash ( $node )

Returns a hash value (computed by _mysql_hash for the supplied $node. The hash value is based on the string value of the node and the node type.

qualify_uri ( $uri )

Returns a fully qualified URI from the supplied $uri. $uri may already be a qualified URI, or a parse tree for a qualified URI or QName. If $uri is a QName, the namespaces defined in the query parse tree are used to fully qualify.

add_function ( $uri, $function )

Associates the custom function $function (a CODE reference) with the specified URI, allowing the function to be called by query FILTERs.

get_function ( $uri )

If $uri is associated with a query function, returns a CODE reference to the function. Otherwise returns undef.

AUTHOR

Gregory Williams <gwilliams@cpan.org>