Using Extensions in SPARQL Queries

Once you've registered an extension library with AnzoGraph DB, you can simply include extension library UDXs within the syntax syntax of regular SPARQL or other types of query statements. For example:

select (<http://example/concat>(?a, ?b) as ?concat) where ...

The only requirement for execution of a UDX is that the arguments for input and output parameters match values provided within the query statement. See UDX Examples for more information on the signatures and specification of input and output parameters for the different types of user-defined extensions supported by AnzoGraph DB.

When executing a query containing a user-defined extension, each slice of an AnzoGraph DB server or cluster deployment creates its own distinct instance of the extension for every occurrence in the query by invoking the "create" method of the associated "ExtensionFactory". As each row of values streams through a slice, it is passed to the instance by calling its "apply" method, and the results are then passed on upward to the consumer of the stream. The factory, and the instances that it creates, are destroyed only when the query has eventually finished executing.