function
elements specified to use in Jena SPARQL queries can only make calculations using data properties passed to the function in the query.uaFunction
elements can invoke and subscribe to services.
org.da.protoframework.jena.sparql.functions.UAFunctionFactory
interface to be able to handle UA functions. This interface extends the FunctionFactory interface and has the following API:public class org.da.protoframework.jena.sparql.functions.UAFunctionFactory |
---|
Modifier and Type | Method and Description |
---|---|
Function | createFunction(String uri)
Create a function with the given URI (this method is the method provided by the
FunctionFactory interface) |
void | invokeAndBlock(UAFunction function, long timeOut)
Invoke a function and block. You will need to call
unlock() after you have computed the function results |
boolean | unlock()
To be called after you have computed the function results
|
org.da.protoframework.jena.sparql.functions.AbstractUAFunctionFactory
class handle almost all these methods. The only method you will have to implement if you implement this class is:public class org.da.protoframework.jena.sparql.functions.AbstractUAFunctionFactory |
---|
Modifier and Type | Method and Description |
---|---|
Function | createFunctionImpl(String uri)
Create a function (this method is called by the
createFunction(String uri) method) |
UAFunctionFactory
is a valid FunctionFactory, so it is not limited to create UAFunctions but can also create regular functions as any FunctionFactory can.
public class org.da.protoframework.jena.sparql.functions.UAFunction |
---|
Modifier and Type | Method and Description |
---|---|
void | init(Module module, UAFunctionFactory factory)
Initialize the function after its creation
|
void | invoke()
Invoke the function
|
void | subscribe(ServiceInstance service)
Subscribe to a Service
|
<application name="jena"> <deployment> <lib url="../JenaModule.jar" /> <lib url="TestUAFunctions.jar" /> </deployment> <modules> <module name="jena"> <interfaces> <requestReceived service="owlObjectRequest" uri="http://dassault-aviation.com/jena" /> <requestSend service="compute" /> </interfaces> </module> </modules> </application>In this case the
compute
service is not part of the Jena module definition interfaces, which means that:compute
requestsubscribe
method will be called if a response from this request is receivedexec(...)
method.UAFunctionFactory
has two utility methods which will help you to do just that:public class org.da.protoframework.jena.sparql.functions.UAFunctionFactory |
---|
Modifier and Type | Method and Description |
---|---|
void | invokeAndBlock(UAFunction function, long timeOut)
Invoke a function and block. You will need to call
unlock() after you have computed the function results |
boolean | unlock()
To be called after you have computed the function results
|
invokeAndBlock
and passing your UAFunction as argument (and a timeOut) will call the invoke()
method of your UAFunction in a background Thread and block the execution of the calling Thread until the unlock()
is called.invokeAndBlock()
rather than invoke()
in your function code (see Invoking a service for more information).Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence