Apache Stanbol OntoNet
Stanbol OntoNet implements the API section for managing OWL/OWL2 ontologies, in order to prepare them for consumption by reasoning services, refactorers, rule engines and the like. Once loaded internally from their remote or local resources, ontologies live and are known within the realm they were loaded in. This allows loose-coupling and (de-)activation of ontologies in order to scale the data sets for reasoners to process and optimize them for efficiency.
From here you can reach the following sub-endpoints:
Note: OWL import targets will be included. Ontology loading is set to fail on missing imports.
Stored ontologies
Orphan ontologies
ID |
Aliases |
Direct handles |
The following concepts have been introduced along with the Ontology Network Manager:
-
Scope: a "logical realm" for all the ontologies that encompass a certain CMS-related set of concepts (such as "User", "ACL", "Event", "Content", "Domain", "Reengineering", "Community", "Travelling" etc.). Scopes never inherit from each other, though they can load the same ontologies if need be.
-
Space: an access-restricted container for synchronized access to ontologies within a scope. The ontologies in a scope are loaded within its set of spaces. An ontology scope contains: (a) exactly one core space, which contains the immutable set of essential ontologies that describe the scope; (b) exactly one (possibly empty) custom space, which extends the core space according to specific CMS needs (e.g. the core space for the User scope may contains alignments to FOAF).
-
Session: a collector of volatile semantic data, not intended for persistent storage. Sessions can be used for stateful management of ontology networks. It is not equivalent to an HTTP session (since it can live persistently across multiple HTTP sessions), although its behaviour can reflect the one of the HTTP session that created it, if required by the implementation.
Service Endpoints
The RESTful API of the Ontology Network Manager is structured as follows.
Ontology Scope Management ("/ontonet/ontology"
):
- Scope manager @/ontonet/ontology:
Perform CRUD operations on ontology scopes.
- Ontology scope @
/ontonet/ontology/{scopeName}
:
Manage the set of ontologies loaded within a single scope.
- Ontology within scope @
/ontonet/ontology/{scopeName}/{ontologyID}
:
Load/Unload operations on a single ontology loaded within a scope.
OntoNet Session Management ("/ontonet/session"
):
- Session registry @/ontonet/session:
Perform CRUD operations on ontology sessions.
- OntoNet Session @
/ontonet/session/{sessionId}
:
Manage metadata for a single OntoNet session.
Subresource ontonet/ontology
Service to get/clear the set of registered and/or active ontology scopes.
GET ontonet/ontology
Description |
Service to get the set of registered and/or active ontology scopes |
Request |
GET /ontonet/ontology |
Parameter |
with-inactive : include registered inactive scopes (optional, default is false) |
Produces |
An ontology. Format depends on requested media type |
Example
curl -H "Accept:application/rdf+xml" "http://wit.istc.cnr.it:9090/ontonet/ontology?with-inactive=true
DELETE ontonet/ontology
Description |
Service to clear all ontology scopes and stored ontologies |
Request |
DELETE /ontonet/ontology |
Parameters |
none |
Produces |
nothing |
Example
curl -X DELETE "http://wit.istc.cnr.it:9090/ontonet/ontology
Subresource ontonet/ontology/{scopeName}
Service for full CRUD operations on ontology scopes.
GET ontonet/ontology/{scopeName}
Description |
Service to get the root ontology of the scope. |
Request |
GET /ontonet/ontology/{scopeName} |
Parameters |
none |
Produces |
An ontology. Format depends on requested media type. 404 if the scope does not exist. |
Example
curl -H "Accept:application/rdf+xml" "http://wit.istc.cnr.it:9090/ontonet/ontology/User
POST ontonet/ontology/{scopeName}
Description |
Service to load an ontology into the custom space of the scope. |
Request |
POST /ontonet/ontology/ {scopeName}
Content types :
application/owl+xml , application/rdf+json ,
application/rdf+xml , application/x-turtle ,
multipart/form-data , text/owl-functional ,
text/owl-manchester , text/plain ,
text/rdf+n3 , text/rdf+nt , text/turtle
|
Parameters |
For multipart/form-data content:
file : the physical URL of the ontology to be loaded.
format : combined with file , the format of the submitted file.
If not supplied, all known parsers will be tried until one succeeds or all fail.
library : the identifier of the ontology library whose ontologies have to be loaded.
The available libraries are shown on the /ontonet/registry endpoint.
stored : the public key of the ontology to be loaded, if already stored in Stanbol.
url : the physical URL of the ontology to be loaded.
For text/plain content: will be interpreted as url .
For any other content type: will be interpreted as file .
Limitations:
- Only one of
file , library or url
can be specified in a single POST.
- Only one value for
file , library or url per POST is accepted.
stored can have multiple values and can be used in combination with the above parameters.
|
Response |
201 Created if ontology loading was successful.
303 See Other if ontology loading was successful (for multipart/form-data content).
400 Bad Request if no proper content or parameters were supplied,
or if library or url are not well-formed or do not match an existing resource.
403 Forbidden if the scope is locked and cannot be modified.
404 Not Found if no such scope was registered.
409 Conflict if the supplied ontology was found to have the same ID as one already loaded.
500 Internal Server Error if ontology loading failed for some other reason.
|
Examples
Load and store the SKOS thesaurus of ISO 3166-1 country codes into a scope that manages Geographical content.
curl -X POST -F "url=http://eulersharp.sourceforge.net/2003/03swap/countries" http://wit.istc.cnr.it:9090/ontonet/ontology/Geographical
or
curl -H "Content-type: text/plain" -d http://eulersharp.sourceforge.net/2003/03swap/countries http://wit.istc.cnr.it:9090/ontonet/ontology/Geographical
Load an ontology from local file
acme-hierarchy.owl in the scope about the ACME organization, knowing the file is in RDF/XML format.
curl -X POST -F file=@acme-hierarchy.owl -F format=application/rdf+xml http://wit.istc.cnr.it:9090/ontonet/ontology/ACME
or
curl -H "Content-type: application/rdf+xml" -d @acme-hierarchy.owl http://wit.istc.cnr.it:9090/ontonet/ontology/ACME
PUT ontonet/ontology/{scopeName}
Description |
Service to get the root ontology of the scope. |
Request |
PUT /ontonet/ontology/ {scopeName} |
Parameters |
corereg : the physical URL of the registry that points to the ontologies to be loaded into the core space.
This parameter overrides coreont if both are specified.
|
|
coreont : the physical URL of the top ontology to be loaded into the core space.
This parameter is ignored if corereg is specified.
|
|
activate : If true , the ontology scope will be set as active upon creation.
This parameter is optional, default is false .<
/td>
|
Response |
|
Example
curl -X PUT "http://wit.istc.cnr.it:9090/ontonet/ontology/User?corereg=[registry_location]&customont=[ontology_location]
DELETE ontonet/ontology/{scopeName}
Description |
Unregisters the ontology scope and unloads its resources,
but does not necessarily delete its ontologies. |
Request |
DELETE /ontonet/ontology/ {scopeName} |
Parameters |
None.
|
Response |
200 OK if deletion was successful.
404 Not Found if no such scope was registered.
500 Internal Server Error if the scope was found but deletion failed for some other reason.
|
Example
curl -X DELETE "http://wit.istc.cnr.it:9090/ontonet/ontology/Users
Subresource ontonet/session
Service to manage the set of active OntoNet sessions.
GET ontonet/session
Description |
Gets an RDF graph that describes the registered sessions. |
Request |
GET /ontonet/session |
Parameters |
none |
Produces |
application/owl+xml,
application/rdf+json,
application/rdf+xml,
application/x-turtle,
text/owl+functional,
text/owl+manchester,
text/plain,
text/rdf+n3,
text/rdf+n3,
text/turtle
|
Example
curl -X GET -H "Accept: text/turtle" http://wit.istc.cnr.it:9090/ontonet/session
PUT ontonet/session/[id]
Creates a session with the specified ID, if not used already.
POST ontonet/session
Description |
Creates a session and lets Stanbol choose its identifier. |
Request |
POST /ontonet/session |
Parameters |
none |
Produces |
- 201 CREATED, with the session URI in the Location response header.
- 503 FORBIDDEN if the session could not be created due to session quota exceeded.
|
Example
curl -X POST http://wit.istc.cnr.it:9090/ontonet/session
HTTP/1.1 201 Created
Location: http://wit.istc.cnr.it:9090/ontonet/session/1341413780858