ONKI REST API (beta)
General information about the API
The REST API of the ontology service ONKI is still in the testing phase, so using it in production systems is not encouraged yet. Some of the methods are not optimized, so please delays in responses. Also, the methods of the interface may be changed without notice. Improvement ideas and problem reports can be sent via the feedback form of the ONKI service.
The REST API is used by making HTTP GET requests to URLs which are formed as follows:
http://www.yso.fi/key-[YOUR_ONKI_KEY]/onki/[ONTOLOGY_ID]/rest/[METHOD_NAME][?][PARAMETERS]
- YOUR_ONKI_KEY is the key received when registering to the ONKI service
- ONTOLOGY_ID is the unique identifier of the ontology, e.g. "yso" (The Finnish General Upper Ontology)
- METHOD_NAME is the name of the method, e.g. "getProperties"
- PARAMETERS are the parameters given to the method, e.g. "u=http://www.yso.fi/onto/yso/p17093&l=fi"
The responses of the REST API are in JSON format.
Methods of the API
The status information of the server: The ontology metadata: Concept search: Concept hierarchy: Concept information:- getProperties
- getLabels
- getAltLabels
- getDescriptions
- getEquivalentConcepts
- getRelatedConcepts
- getGroups
- getTypes
- getFullPresentation
The required parameters are marked as bold.
The status information of the server
ping
description: testing: is the server runningparameters: -
response: "1"
The ontology metadata
getMetadata
description: metadata about the ontologyparameters:
- l - language
getAvailableLanguages
description: available languages of concept labels in the ontologyparameters: -
response: list of language codes
getAvailableTypeUris
description: available types of the concepts in the ontologyparameters: -
response: list of concept type URIs
Concept search
search
description: concept searchparameters:
- q - query string
- l - query language
- qt - restrict query to concept type (URI)
- qp - restrict query to transitive subconcepts of a concept (URI)
- qg - restrict query to concepts in a group (URI)
- h - maximum amount of search results
- s - start result set from hit # (for paging)
- ac - include the concepts starting with the query string (boolean: true/false)
Concept hierarchy
getConceptHierarchy
description: concept hierarchy (superconcepts/subconcepts/sibling concepts)parameters:
- u - concept URI
- l - language
- p - the amount of superconcept levels: 0..n; 1 == only direct superconcepts, 2 == direct superconcepts and their direct superconcepts, etc.
- c - the amount of subconcept levels: 0..n
- s - sibling concepts: 0..1
getHierarchyRoots
description: the roots of a concept's hierarchy, or if the URI is not given, all the concepts of the ontology which have no superconceptsparameters:
- u - concept URI
- l - language
Concept information
getProperties
description: properties of the conceptparameters:
- u - concept URI
- l - language
- p - property URI, if only a specific property is wanted
getLabels
description: labels of the conceptparameters:
- u - concept URI
- l - language
- pl - language of the property label
getAltLabels
description: alternative labels of the conceptparameters:
- u - concept URI
- l - language
- pl - language of the property label
getDescriptions
description: descriptions of the conceptparameters:
- u - concept URI
- l - language
- pl - language of the property label
getEquivalentConcepts
description: equivalent conceptsparameters:
- u - concept URI
- l - language
getRelatedConcepts
description: associative concepts / related conceptsparameters:
- u - concept URI
- l - language
getGroups
description: groups the concept belongs toparameters:
- u - concept URI
- l - language
getTypes
description: types of the conceptparameters:
- u - concept URI
- l - language
getFullPresentation
description: all the relevant information about the concept (merges methods getProperties, getLabels etc. in a single method call)parameters:
- u - concept URI
- l - language
- pl - language of the property label
Ontology directory
getDirectory
description: ontology directory - alphabetical index, groups (e.g. YSA) or topconcepts (SKOS vocabularies)parameters:
- t - directory type: "groups", "topconcepts" or "alphabetical"; default value is "groups", if the ontology contains concept groups; "topconcepts", if the ontology is a SKOS vocabulary and there is maximum of 50 topconcepts; otherwise "alphabetical"
- m - amount of concepts returned per a directory element (group, topconcept, alphabet): 0..n
- l - language
is provided by:

