SPARQL Extensions

Variable Assignment

Variables can be created anywhere in the WHERE clause of a query using the LET keyword. The syntax is:

LET ( var := expression *)*

The expression follows the same syntax as expressions in SPARQL Filters, including the ability to use any variable that has been bound so far in the query. They can appear in the same place where a filter can appear.

Predicate Functions

This type of function refers to predicates that form statements that are calculated rather than stored.

These functions are managed by Resolvers.

Function Extensions

By default, Mulgara loads both the EXSLT functions from Xalan, and a limited set of functions from XPath.

Loading New Functions

New functionality may be introduced into SPARQL by loading any compliant XPath function library. These can be loaded through a user configuration file, using the !XpathFunctionResolver element.

This element is shown here, loading the function resolver from the Xalan library:

  <XpathFunctionResolver type="org.apache.xalan.extensions.XPathFunctionResolverImpl"/>

SPARQL expressions can refer to functions by URI or QName. However, only QNames are supported for most namespaces, since this is the way that Java finds the function.

This means that RDF nodes, and sequences from RDF graphs are not available as parameters. There are plans for a future function extension point, which will provide access to this information. However, these methods will need to be written specifically for Mulgara, and will not be general purpose like XPathFunctions are.

h3. Other Function Modules

* The [[UnsafeFunctions|Unsafe Module]]

Updated by Paula Gearon over 14 years ago ยท 9 revisions