owlapy.owl_ontology_manager

Module Contents

Classes

OWLOntologyChange

Represents an ontology change.

OWLOntologyManager

An OWLOntologyManager manages a set of ontologies. It is the main point for creating, loading and accessing

OWLImportsDeclaration

Represents an import statement in an ontology.

AddImport

Represents an ontology change where an import statement is added to an ontology.

class owlapy.owl_ontology_manager.OWLOntologyChange(ontology: owlapy.owl_ontology.OWLOntology)[source]

Represents an ontology change.

__slots__ = ()
get_ontology() owlapy.owl_ontology.OWLOntology[source]

Gets the ontology that the change is/was applied to.

Returns:

The ontology that the change is applicable to.

class owlapy.owl_ontology_manager.OWLOntologyManager[source]

An OWLOntologyManager manages a set of ontologies. It is the main point for creating, loading and accessing ontologies.

abstract create_ontology(iri: owlapy.iri.IRI) owlapy.owl_ontology.OWLOntology[source]

Creates a new (empty) ontology that that has the specified ontology IRI (and no version IRI).

Parameters:

iri – The IRI of the ontology to be created.

Returns:

The newly created ontology, or if an ontology with the specified IRI already exists then this existing ontology will be returned.

abstract load_ontology(iri: owlapy.iri.IRI) owlapy.owl_ontology.OWLOntology[source]

Loads an ontology that is assumed to have the specified ontology IRI as its IRI or version IRI. The ontology IRI will be mapped to an ontology document IRI.

Parameters:

iri – The IRI that identifies the ontology. It is expected that the ontology will also have this IRI (although the OWL API should tolerate situations where this is not the case).

Returns:

The OWLOntology representation of the ontology that was loaded.

abstract apply_change(change: OWLOntologyChange)[source]

A convenience method that applies just one change to an ontology. When this method is used through an OWLOntologyManager implementation, the instance used should be the one that the ontology returns through the get_owl_ontology_manager() call.

Parameters:

change – The change to be applied.

Raises:

ChangeApplied.UNSUCCESSFULLY – if the change was not applied successfully.

abstract add_axiom(ontology: owlapy.owl_ontology.OWLOntology, axiom: owlapy.owl_axiom.OWLAxiom)[source]

A convenience method that adds a single axiom to an ontology.

Parameters:
  • ontology – The ontology to add the axiom to.

  • axiom – The axiom to be added.

abstract remove_axiom(ontology: owlapy.owl_ontology.OWLOntology, axiom: owlapy.owl_axiom.OWLAxiom)[source]

A convenience method that removes a single axiom from an ontology.

Parameters:
  • ontology – The ontology to remove the axiom from.

  • axiom – The axiom to be removed.

abstract save_ontology(ontology: owlapy.owl_ontology.OWLOntology, document_iri: owlapy.iri.IRI)[source]

Saves the specified ontology, using the specified document IRI to determine where/how the ontology should be saved.

Parameters:
  • ontology – The ontology to be saved.

  • document_iri – The document IRI where the ontology should be saved to.

class owlapy.owl_ontology_manager.OWLImportsDeclaration(import_iri: owlapy.iri.IRI)[source]

Bases: owlapy.meta_classes.HasIRI

Represents an import statement in an ontology.

property iri: owlapy.iri.IRI

Gets the import IRI.

Returns:

The import IRI that points to the ontology to be imported. The imported ontology might have this IRI as its ontology IRI but this is not mandated. For example, an ontology with a non-resolvable ontology IRI can be deployed at a resolvable URL.

property str: str

Gets the string representation of this object

Returns:

The IRI as string

__slots__ = '_iri'
class owlapy.owl_ontology_manager.AddImport(ontology: owlapy.owl_ontology.OWLOntology, import_declaration: OWLImportsDeclaration)[source]

Bases: OWLOntologyChange

Represents an ontology change where an import statement is added to an ontology.

__slots__ = ('_ont', '_declaration')
get_import_declaration() OWLImportsDeclaration[source]

Gets the import declaration that the change pertains to.

Returns:

The import declaration.