OntologyIndexClient Class
The OntologyIndexClient class provides a common ROS service abstraction for all exploration service. More...
Ros1 Package: | ontologenius |
Ros2 Package: | ontopy |
Inherits: | ClientBaseIndex |
Inherited By: | IndividualIndexClient, ClassIndexClient, DataPropertyIndexClient, ObjectPropertyIndexClient |
Methods
__init__(self, name) | |
integer[] | getUp(self, index, depth = -1, selector = 0) |
bool | isA(self, index, base_class) |
str | getName(self, index, take_id = True) |
str[] | getNames(self, index, take_id = True) |
str[] | getEveryNames(self, index, take_id = True) |
integer[] | find(self, name, take_id = True, selector = 0) |
integer[] | findSub(self, name, take_id = True, selector = 0) |
integer[] | findRegex(self, regex, take_id = True, selector = 0) |
str[] | findFuzzy(self, name, threshold = 0.5, take_id = True, selector = 0) |
bool | exist(self, index) |
Reimplemented Methods
- 2 methods inherited from ClientBaseIndex
Detailed Description
The OntologyIndexClient class provides an abstraction common to all ontologenius exploration ROS services.
The OntologyIndexClient implements the functions common to every ontologenius exploration based on indexes.
This class is based on ClientBaseIndex and so ensure a persistent connection with the service based on. The persistent connection ensures a minimal response time. A reconnection logic is implemented in the event that the persistent connection fails.
At the difference of the usual OntologyClient class, this one provides access to the interface based on indexes (integers) for better performances.
See also OntologyClient.
See also IndividualIndexClient, ClassIndexClient, DataPropertyIndexClient and ObjectPropertyIndexClient.
Methods Documentation
__init__(self, name)
Constructs an ontology client linked to the service ontologenius/name(str).
getUp(self, index, depth = -1, selector = 0)
Gives all concepts below the one given in the parameter: index(integer).
The optional depth(int) parameter can be set to limit tree propagation to a specific value. The default value -1 represents no propagation limitation.
The optional selector(integer) parameter can be set to only get results inheriting from the selector(integer) concept. The default value 0 represents no restriction on the result.
isA(self, index, base_class)
Returns true if the concept index(integer) is or inherits of the concept base_class(integer). This function corresponds to checking if class_base is part of the result of the function getUp applies to the concept index.
getName(self, index, take_id = True)
Gives one of the label (str) of the concept index(integer) that is not muted.
The default take_id(bool) argument can be set to False if you do not want to consider the concept identifier as a possible default name.
The result of this function depends on the setting of the working language.
getNames(self, index, take_id = True)
Gives all the labels (str[]) of the concept index(integer) excepted the muted ones.
The default take_id(bool) argument can be set to False if you do not want to consider the concept identifier as a possible default name.
The result of this function depends on the setting of the working language.
getEveryNames(self, index, take_id = True)
Gives all the labels (str[]) of the concept index(integer) even the muted ones.
The default take_id(bool) argument can be set to False if you do not want to consider the concept identifier as a possible default name.
The result of this function depends on the setting of the working language.
find(self, name, take_id = True, selector = 0)
Gives all the concepts (integer[]) having for label name(str).
The default take_id(bool) argument can be set to False if you do not want to consider the concept identifier as a possible default name.
The optional selector(integer) parameter can be set to only get results inheriting from the selector(integer) concept. The default value 0 represents no restriction on the result.
The result of this function depends on the setting of the working language.
findSub(self, name, take_id = True, selector = 0)
Gives all the concepts (integer[]) having for label a subset of name(str).
The default take_id(bool) argument can be set to false if you do not want to consider the concept identifier as a possible default name.
The optional selector(integer) parameter can be set to only get results inheriting from the selector(integer) concept. The default value 0 represents no restriction on the result.
The result of this function depends on the setting of the working language.
findRegex(self, regex, take_id = True, selector = 0)
Give all concepts (integer[]) with a label matching the regular expression regex(str).
The default take_id(bool) argument can be set to false if you do not want to consider the concept identifier as a possible default name.
The optional selector(integer) parameter can be set to only get results inheriting from the selector(integer) concept. The default value 0 represents no restriction on the result.
The result of this function depends on the setting of the working language.
findFuzzy(self, name, threshold = 0.5, take_id = True, selector = 0)
Give all the names of concepts (str[]) with the lowest edit distance with parameter name(str).
The default take_id(bool) argument can be set to false if you do not want to consider the concept identifier as a possible default name.
The optional selector(integer) parameter can be set to only get results inheriting from the selector(integer) concept. The default value 0 represents no restriction on the result.
The result of this function depends on the setting of the working language and does not correspond to the concept identifiers but to other labels known by ontologenius.
The minimum editing distance can be set with the threshold(double) parameter. This value corresponds to the number of changes to be made to pass from one word to another divided by the length of the comparison word.
exist(self, index)
Returns True if the concept index(integer) exists in the subpart of the ontology managed by the client (i.e. class, individuals, object properties, data properties).
Muted labels
Ontologenius introduces the concept of muted label. They are written <onto:label> in an OWL file.
A muted label will be useful for adding labels with errors. These labels will allow you to find a concept with an error but will make sure you never use it in output (using getName).