ELDataset

class mowl.datasets.ELDataset(ontology, class_index_dict=None, object_property_index_dict=None, individual_index_dict=None, extended=True, load_normalized=False, device='cpu', ontology_path=None, use_cache=True, load_role_axioms=False)[source]

Bases: object

This class provides data-related methods to work with \(\mathcal{EL}\) description logic language. In general, it receives an ontology, normalizes it into 4 or 7 \(\mathcal{EL}\) normal forms and returns a torch.utils.data.Dataset per normal form. In the process, the classes and object properties names are mapped to an integer values to create the datasets and the corresponding dictionaries can be input or created from scratch.

Parameters:
  • ontology (org.semanticweb.owlapi.model.OWLOntology) – Input ontology that will be normalized into \(\mathcal{EL}\) normal forms

  • extended (bool, optional) – If true, the normalization process will return 7 normal forms. If false, only 4 normal forms. See Embedding the EL language for more information. Defaults to True.

  • class_index_dict (dict, optional) – Dictionary containing information class name –> index. If not provided, a dictionary will be created from the ontology classes. Defaults to None.

  • object_property_index_dict (dict, optional) – Dictionary containing information object property name –> index. If not provided, a dictionary will be created from the ontology object properties. Defaults to None.

  • load_normalized (bool, optional) – If true, the ontology is assumed to be already normalized and the normalization process will be skipped. Defaults to False.

  • ontology_path (str, optional) – Path to the original ontology file. If provided, the normalized ontology will be cached to <ontology_path>_mowl_el_normalized.owl and loaded from cache on subsequent calls. This significantly speeds up repeated normalization of the same ontology. Defaults to None.

  • use_cache (bool, optional) – Whether to use caching when ontology_path is provided. Defaults to True.

  • load_role_axioms (bool, optional) – Whether to also extract the two \(\mathcal{EL}^{++}\) role axiom normal forms of the ontology – role inclusions \(R \sqsubseteq S\) and role chains \(R \circ T \sqsubseteq S\) – and expose them through get_gci_datasets() under the role_inclusion and role_chain keys. Only ELModule subclasses that implement the corresponding losses can consume them, so they are left out unless asked for. Defaults to False.

Attributes Summary

class_assertion_dataset

class_index_dict

Returns indexed dictionary with class names present in the dataset.

gci0_bot_dataset

gci0_dataset

gci1_bot_dataset

gci1_dataset

gci2_dataset

gci3_bot_dataset

gci3_dataset

object_property_assertion_dataset

object_property_index_dict

Returns indexed dictionary with object property names present in the dataset.

role_chain_dataset

Returns the dataset with the role chain axioms \(R \circ T \sqsubseteq S\), if any.

role_inclusion_dataset

Returns the dataset with the role inclusion axioms \(R \sqsubseteq S\), if any.

Methods Summary

get_gci_datasets()

Returns a dictionary containing the name of the normal forms as keys and the corresponding datasets as values.

load()

Attributes Documentation

class_assertion_dataset
class_index_dict

Returns indexed dictionary with class names present in the dataset.

Return type:

dict

gci0_bot_dataset
gci0_dataset
gci1_bot_dataset
gci1_dataset
gci2_dataset
gci3_bot_dataset
gci3_dataset
object_property_assertion_dataset
object_property_index_dict

Returns indexed dictionary with object property names present in the dataset.

Return type:

dict

role_chain_dataset

Returns the dataset with the role chain axioms \(R \circ T \sqsubseteq S\), if any.

Return type:

RoleChainDataset or None

role_inclusion_dataset

Returns the dataset with the role inclusion axioms \(R \sqsubseteq S\), if any.

Return type:

RoleInclusionDataset or None

Methods Documentation

get_gci_datasets()[source]

Returns a dictionary containing the name of the normal forms as keys and the corresponding datasets as values.

The GCI datasets are always present: 7 of them if the class parameter extended is True, otherwise 4. The class_assertion and object_property_assertion keys are added when the ontology contains axioms of those forms, and the role_inclusion and role_chain keys when it contains role axioms and the dataset was built with load_role_axioms=True.

Return type:

dict

load()[source]