Performance
The underlying Rust library Horned-OWL offers an index system to allow fast access to different kinds of parts of an ontology.
By default, Py-Horned-OWL loads an ontology in a simple hash set (using a set index). While this allows for quick loading and iterating of all components in an ontology, queries like “give me all classes” or “give me all axioms for this IRI” are slower or even not supported at all.
Especially queries by IRI are not supported without having an iri mapped index. By default, it is implicitly created when a function requiring it is called.
The component mapped index improves the performance of entity or specific axioms lookups. For example, the functions get_classes()
, get_object_properties()
, etc., get_iri()
, or get_iri_for_label()
benefit from a component index.
The indexes can be build manually using the build_iri_index()
, build_component_index()
, or to build both indexes together build_indexes()
methods.
You change the behaviour for index creating using the index_creation_strategy parameters in the open_ontology()
functions or the constructor of PyIndexedOntology()
.