Apache Stanbol (Incubating) Reasoners
Checkout the source::
% svn co https://svn.apache.org/repos/asf/incubator/stanbol/trunk/reasoners reasoners
Build and run the tests::
% cd reasoners % mvn clean install
Run Stanbol, for example:
% java -jar -Xmx1g org.apache.stanbol.launchers.full-0.9.0-incubating-SNAPSHOT.jar
You must have the Ontonet and Rules modules already installed (they are if you have followed the above example). Move to the /reasoners directory, then run
% mvn install -PinstallBundle -Dsling.url=
for example
% mvn install -PinstallBundle http://localhost:8080/system/console
A serviceapi for ReasoningServices, using SCR
Base OWLApi and Jena abstract services
Jena RDFS,OWL,OWLMini reasoning services
HermiT reasoning service
A common REST endpoint at /reasoners with the following preloaded services:
/rdfs
/owl
/owlmini
/owl2
each can be accessed with one of three tasks: check,enrich,classify, for example:
/reasoners/owl/check (the Jena owl service with task classify) or /reasoners/owl2/classify (the hermit service with task classify)
Tasks description:
This is how the endpoint behave:
GET (same if POST and Content-type: application/x-www-form-urlencoded) params:
for example: $ curl “http://localhost:8080/reasoners/owl2/classify?url=http://xmlns.com/foaf/0.1/”
POST [Content-type: multipart/form-data]
Other parameters can be sent, to support inputs from Ontonet and Rules: These additional parameters can be sent:
Supported output formats: Supported return formats are all classic RDF types (n3,turtle,rdf+xml) and HTML. For HTML the returned statements are provided in Turtle (Jena) or OWL Manchester syntax (OWLApi), wrapped in the stanbol layout. It would be nice to have all in the latter, which is very much readable (todo).
To run a task as background job, you can use the same interface described above, appending ‘job’ to the resource path. For example: $ curl “http://localhost:8080/reasoners/owl2/classify/job?url=http://xmlns.com/foaf/0.1/”
Differences between Jena and OWLApi services:
curl -v -H “Accept: application/turtle” “http://localhost:8080/reasoners/owl/classify?url=http://xmlns.com/foaf/0.1/”
curl -v -H "Accept: text/n3" "http://localhost:8080/reasoners/owl/classify?url=http://xmlns.com/foaf/0.1/"
curl -v "http://localhost:8080/reasoners/owl/classify/job?url=http://xmlns.com/foaf/0.1/"
this will return a 201 Created response, with the Location header pointing to the Job url:
\> GET /reasoners/owl/classify/job?url=http://xmlns.com/foaf/0.1/ HTTP/1.1 \> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3 \> Host: localhost:8080 \> Accept: \*/\* \> \< HTTP/1.1 201 Created \< Location: http://localhost:8080/jobs/Z63Clmt49yekaYIgXk8vmw \< Content-Type: text/html \< Transfer-Encoding: chunked \< Server: Jetty(6.1.x) \<
then, ping the job at the given location, in our example:
curl -v http://localhost:8080/jobs/Z63Clmt49yekaYIgXk8vmw
response is:
\< HTTP/1.1 200 OK \< Content-Length: 169 \< Content-Type: application/json \< Server: Jetty(6.1.x) \< { "status": "finished", "outputLocation": "http://localhost:8080/reasoners/jobs/Z63Clmt49yekaYIgXk8vmw", "messages": [ "You can remove this job using DELETE", ] }
Status cane ‘ready’ or ‘running’. If ready, you can get the output in this way:
curl -v -H "Accept: text/n3" http://localhost:8080/reasoners/jobs/Z63Clmt49yekaYIgXk8vmw
Data will be there until you DELETE the job:
curl -X DELETE http://localhost:8080/jobs/Z63Clmt49yekaYIgXk8vmw
curl -v "http://localhost:8080/reasoners/owl/check?url=http://xmlns.com/foaf/0.1/"
curl -v "http://localhost:8080/reasoners/owl2/check?url=http://xmlns.com/foaf/0.1/"
curl -v "http://localhost:8080/reasoners/owl2/check?url=http://www.cnr.it/ontology/cnr/cnr.owl"
or
curl -v "http://localhost:8080/reasoners/owl2/enrich?url=http://www.cnr.it/ontology/cnr/cnr.owl"
curl -H “Accept: application/rdf+xml” http://xmlns.com/foaf/0.1/ > foaf.rdf
curl -X POST -H “Content-type: multipart/form-data” -H “Accept: text/turtle” -F file=@foaf.rdf “http://localhost:8080/reasoners/rdfs/enrich”
curl -X POST -H “Content-type: multipart/form-data” -F file=@foaf.rdf -F target=example-rdfs-inferences “http://localhost:8080/reasoners/rdfs/enrich”
This list includes some notes about improvements that can be done. Please refer to Stanbol issue tracker for a concrete workplan.