Hello,
Right now I'm designing a distributed software system whose components (or
services) communicate through protocols. In order to minimize the efforts to
create and handle protocols I had the idea to only use linked data for
communication.
I would like to use SPARQL to send requests to other services and receive
answers as SPARQL-JSON results. So far no problem with Jena. However I would
like to also register, find and call services through SPARQL queries and this
is the point where I could need some advice on how to proceed.
The idea basically is that I create a service, for example in Java:
public class MyService {
public int run(int param1, String param2) {
return 0;
}
}
The service then can be registered by a SPARQL update:
prefix registry:<http://my.registry/kb/>
prefix service:<http://my.registry/kb/Service/>
insert data {
<http://my.registry/kb/MyService/> registry:service service:MyService .
<http://my.registry/kb/MyService/> registry:name "MyService" .
# ... more data
}
After that the (for me) complicated part starts. Finding the service is
relatively easy, for example by searching for its name, but invoking the "run"
function of the Java class and passing arguments to it is a big hurdle for me
right now. I thought of something like this:
prefix registry:<http://my.registry/kb/>
prefix service:<http://my.registry/kb/Service/>
select * where {
# find service
?s registry:service service:MyService .
# specify name of method to call
?s registry:method "run" .
# specify parameter values of method
?s registry:parameter [registry:param1 100] .
?s registry:parameter [registry:param2 "string"] .
}
The overall idea is that I pass all of the necessary information for a method
call together with the SPARQL query. As a result I would like to not get the
"?s" as a result value but of course I would like to receive the return value
of the function. The difficult part here is that this would require special
support by the query evaluation engine because it needs to understand that I
want to call the service and it needs to know how to extract the parameters out
of the SPARQL query.
My question would be: Would it be possible with Jena to alter the query engine
in a way that it can support this feature and if yes would it be a good idea to
do so? The syntax above is of course just an idea to illustrate my point, it
can look differently. I still don't know SPARQL very well, maybe it even
supports some other constructs that would make such a feature easier to
implement?
Btw, I know that there are other ways and existing technologies that would make
it easy to support a service registration framework but I want to depend only
on linked data (i.e. triples) for both requests and responses against my
software system and no existing technology that I know of can do that right now.