owlapy.owl_ontology_manager

Classes

OWLImportsDeclaration

Represents an import statement in an ontology.

AddImport

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

OntologyManager

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

SyncOntologyManager

Create OWLManager in Python

RDFLibOntologyManager

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

Module Contents

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

Bases: owlapy.meta_classes.HasIRI

Represents an import statement in an ontology.

__slots__ = '_iri'
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

class owlapy.owl_ontology_manager.AddImport(ontology: owlapy.abstracts.abstract_owl_ontology.AbstractOWLOntology, import_declaration: OWLImportsDeclaration)[source]

Bases: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyChange

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.

class owlapy.owl_ontology_manager.OntologyManager(world_store=None)[source]

Bases: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyManager

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

__slots__ = '_world'
create_ontology(iri: str | owlapy.iri.IRI = None) owlapy.owl_ontology.Ontology[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, can also be a string.

Returns:

The newly created ontology.

load_ontology(path: str = None) owlapy.owl_ontology.Ontology[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, can also be a string.

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.

apply_change(change: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyChange)[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.

save_world()[source]

Saves the actual state of the quadstore in the SQLite3 file.

class owlapy.owl_ontology_manager.SyncOntologyManager[source]

Bases: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyManager

Create OWLManager in Python https://owlcs.github.io/owlapi/apidocs_5/org/semanticweb/owlapi/apibinding/OWLManager.html

owlapi_manager
create_ontology(iri: owlapy.iri.IRI | str) owlapy.owl_ontology.SyncOntology[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, can also be a string.

Returns:

The newly created ontology.

load_ontology(path: str) owlapy.owl_ontology.SyncOntology[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, can also be a string.

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.

get_owlapi_manager()[source]
abstract apply_change(change: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyChange)[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.

getOntologyFormat(*args)[source]
saveOntology(*args) None[source]
class owlapy.owl_ontology_manager.RDFLibOntologyManager[source]

Bases: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyManager

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

create_ontology(iri: str = None) owlapy.owl_ontology.RDFLibOntology[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, can also be a string.

Returns:

The newly created ontology.

load_ontology(path: str = None) owlapy.owl_ontology.Ontology[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, can also be a string.

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: owlapy.abstracts.abstract_owl_ontology_manager.AbstractOWLOntologyChange)[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 save_world()[source]