SPARQL API hooks

Last modified: February 18, 2008 - 05:01

The SPARQL API exposes the following Drupal hooks that third-party extension modules can implement to provide extended functionality:

hook_sparql()

Allows modules to modify SPARQL queries before they are executed. This could be said to be the RDF equivalent of db_rewrite_sql().

Example of usage

<?php
/**
* Implementation of hook_sparql().
*/
function mymodule_sparql($op, &$query) {
  switch (
$op) {
    case
'ask':
     
// An ASK query is being executed
     
break;
    case
'select':
     
// A SELECT query is being executed
     
break;
    case
'construct':
     
// A CONSTRUCT query is being executed
     
break;
    case
'describe':
     
// A DESCRIBE query is being executed
     
break;
  }
}
?>

 
 

Drupal is a registered trademark of Dries Buytaert.