OpenTox API 1.2 Ontology

From ToxBank API Wiki
Jump to: navigation, search

Contents

REST operations

Description Method URI Parameters Result Status codes
Retrieve SPARQL query results
GET
/ontology
?query=SPARQL_QUERY
(mandatory)

'
RDF representation of the query results 200,404,500
Predefined query to retrieve all models
GET
/ontology/models

RDF representation of all models

Predefined query to retrieve all endpoints GET

/ontology/endpoints

RDF representation of all endpoints

Predefined query to retrieve all algorithms
GET
/ontology/algorithms

RDF representation of all algorithms

Submit SPARQL query and/or OpenTox service URL


POST /ontology
uri[]=URL of a OpenTox RDF resource

query=SPARQL_QUERY
RDF representation of the query results, if query is specified

if uri[]'''' is specified, the server retrievea RDF representation and adds it to the RDF storage, thus making it available for the subsequent queries.

Any non-empty subset of parameters is valid (i.e. only query, only model_uri, query and algorithm_uri, etc.)
200,404,500,502

Mode of operation

The Ontology service provides RDF storage and SPARQL endpoint for objects, defined in OpenTox ontology and relevant (AlgorithmTypes , Blue Obelisk, ECHA endpoints

) ontologies.

Algorithms, models, reports, validation, datasets (metadata) and features (if they are dependent and/or predicted variables only) can be registered, the resource owner decides which resources are published. After initial registration the ontology server refreshes resource metadata periodically. DELETE deregisters a service./p> The query interface is compliant with http://www.w3.org/TR/rdf-sparql-protocol/#query-bindings-http

The Ontology service adds new information to its storage, by retrieving RDF representation of OpenTox objects (e.g. Algorithm, Model, Feature, etc.) from OpenTox services. The URL of OpenTox services are either predefined, or obtained via parameters of GET/POST query, as described above.

A specific implementation of Ontology service may select to connect to a set of OpenTox services on regular intervals and retrieve updated RDF representation of OpenTox objects.

Representation

RDF representation defined in OpenTox API ontology

Algorithm

Supported MIME types

Mandatory

  • application/rdf xml (default)
  • application/sparql-results xml

Optional

  • other RDF formats

HTTP status codes

Interpretation Nr Name
Success 200 OK
Wrong query syntax
404 Bad request

500
Internal server error
Error when retrieving RDF representation from specified URL
502

Examples

Retrieve all available Models

query=
 PREFIX ot:<http://www.opentox.org/api/1.1#>
 PREFIX ota:<http://www.opentox.org/algorithms.owl#>
 
 PREFIX owl:<http://www.w3.org/2002/07/owl#>
 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
 select ?x
 where {
 ?x rdf:type ot:Model
 }
 

Given an endpoint, retrieve all relevant Models

Preconditions

1) Model1 has dependent variable Feature1

2) Feature1 is set to be owl:sameAs to http://www.opentox.org/echaEndpoints.owl#EndpointA

3) RDF representations of Model1, Feature1 and the ECHA endpoints ontology are all available via OpenTox Ontology service

Query

query=
 PREFIX ot:<http://www.opentox.org/api/1.1#>
 PREFIX ota:<http://www.opentox.org/algorithms.owl#>
 PREFIX owl:<http://www.w3.org/2002/07/owl#>
 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 
 PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
 select ?model ?target
 where {
 ?model rdf:type ot:Model.
 ?target owl:sameAs otee:EndpointA.
 ?model ot:dependentVariables ?target.
 }

Retrieve list of all Models and relevant endpoints

Preconditions

same as above

Query

query=
 PREFIX ot:<http://www.opentox.org/api/1.1#>
 
 PREFIX ota:<http://www.opentox.org/algorithms.owl#>
 PREFIX owl:<http://www.w3.org/2002/07/owl#>
 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
 select ?model ?target ?endpoint
 where {
 ?model rdf:type ot:Model.
 ?target owl:sameAs ?endpoint.
 ?model ot:dependentVariables ?target.
 }

Register an OpenTox resource into an ontology service

Preconditions

An ontology service, running at http://localhost:8080/ontology

An OpenTox service, running at http://localhost:8080/ambit2/dataset/1 , to be registered into the ontology service

Optional: OpenSSO token (to access protected resources)

cURL command

curl -X POST -d "uri=http://localhost:8080/ambit2/dataset/1" http://localhost:8080/ontology \ -H "subjectid:YOUROPENSSOTOKEN"

Ontology

More examples

Querying/Reasoning with Jena and SPARQL

Additional information

Personal tools