smia.css_ontology.capability_skill_ontology module

class smia.css_ontology.capability_skill_ontology.CapabilitySkillOntology[source]

Bases: object

This class contains related methods of the Capability-Skill ontology.

async initialize_ontology()[source]

This method initializes the Capability-Skill ontology loading the definition of the OWL ontology in the file stored in the config folder.

async execute_ontology_reasoner(debug=False)[source]

This method executes the reasoner for the ontology.

Parameters:

debug (bool) – if it is true, the inconsistency of the ontology is explained.

async get_ontology_class_by_iri(class_iri)[source]

This method gets the class within the ontology by its IRI.

Parameters:

class_iri (str) – the IRI of the class to be found.

Returns:

ontology class object.

Return type:

object

async create_ontology_object_instance(class_object, instance_name)[source]

This method creates a new object instance (individual) within the ontology. To this end, a ThingClass is required.

Parameters:
  • class_object (ThingClass) – ontology class of the instance.

  • instance_name (str) – name of the instance.

Returns:

created instance object.

Return type:

ThingClass

async get_ontology_instance_by_name(instance_name)[source]

This method returns an object instance within the ontology by its name.

Parameters:

instance_name (str) – name of the instance.

Returns:

class of the instance to be found (None if it is not found).

Return type:

ThingClass

async get_ontology_instance_by_iri(instance_iri)[source]

This method returns an object instance within the ontology by its name.

Parameters:

instance_iri (str) – IRI of the instance.

Returns:

class of the instance to be found (None if it is not found).

Return type:

ThingClass

async get_ontology_instances_by_class_iri(class_iri)[source]

This method gets all the instances within the ontology with a given class IRI.

Parameters:

class_iri (str) – the IRI of the class to be found.

Returns:

list of ontology instance objects.

Return type:

list

async add_object_property_to_instances_by_names(object_property_name, domain_object_name, range_object_name)[source]

This method adds a new ObjectProperty to link two instances within the ontology. Checks are performed to ensure that the ObjectProperty is valid to link the instances.

Parameters:
  • object_property_name (str) – name of the ObjectProperty to be added.

  • domain_object_name (str) – name of the instance to which the ObjectProperty will be added.

  • range_object_name (str) – name of the instance to be added to the domain instance within the given property.

async check_instance_by_name(instance_name)[source]

This method checks an instance and removes the invalid objects. In case the instance itself is invalid, it is removed from the ontology. If any of the properties are invalid they are removed from this instance.

Parameters:

instance_name (str) – name of the instance to be checked.

async get_all_subclasses_iris_of_class(owl_class)[source]

This method gets all IRIs of the subclasses of a given OWL class.

Parameters:

owl_class (ThingClass) – OWL class of which the subclasses are to be found.

Returns:

list of IRIs of the subclasses of the given OWL class.

Return type:

list(str)