On this page
SPARQL API hooks
Last updated on
30 April 2025
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
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
/**
* 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;
}
}
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion