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:
objectThis 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.Datasetper 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 formsextended (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.owland loaded from cache on subsequent calls. This significantly speeds up repeated normalization of the same ontology. Defaults toNone.use_cache (bool, optional) – Whether to use caching when
ontology_pathis provided. Defaults toTrue.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 therole_inclusionandrole_chainkeys. OnlyELModulesubclasses that implement the corresponding losses can consume them, so they are left out unless asked for. Defaults toFalse.
Attributes Summary
Returns indexed dictionary with class names present in the dataset.
Returns indexed dictionary with object property names present in the dataset.
Returns the dataset with the role chain axioms \(R \circ T \sqsubseteq S\), if any.
Returns the dataset with the role inclusion axioms \(R \sqsubseteq S\), if any.
Methods Summary
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:
- 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:
- role_chain_dataset
Returns the dataset with the role chain axioms \(R \circ T \sqsubseteq S\), if any.
- Return type:
RoleChainDatasetorNone
- role_inclusion_dataset
Returns the dataset with the role inclusion axioms \(R \sqsubseteq S\), if any.
- Return type:
RoleInclusionDatasetorNone
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. Theclass_assertionandobject_property_assertionkeys are added when the ontology contains axioms of those forms, and therole_inclusionandrole_chainkeys when it contains role axioms and the dataset was built withload_role_axioms=True.- Return type: