Ontologies

struct CowlOntology : public CowlObject

Represents an Ontology in the OWL 2 specification.

Public Functions

CowlManager *cowl_ontology_get_manager(CowlOntology *onto)

Gets the manager of this ontology.

Parameters

onto – The ontology.

Returns

The manager.

CowlSymTable *cowl_ontology_get_sym_table(CowlOntology *onto)

Gets the symbol table of this ontology.

Parameters

onto – The ontology.

Returns

The symbol table.

CowlOntologyId cowl_ontology_get_id(CowlOntology *onto)

Gets the ontology ID.

Parameters

onto – The ontology.

Returns

The ontology ID.

void cowl_ontology_set_iri(CowlOntology *onto, CowlIRI *iri)

Sets the IRI of the ontology.

Parameters
  • onto – The ontology.

  • iri – The IRI.

void cowl_ontology_set_version(CowlOntology *onto, CowlIRI *version)

Sets the version IRI of the ontology.

Parameters
  • onto – The ontology.

  • version – The version IRI.

CowlVector *cowl_ontology_get_annot(CowlOntology *onto)

Gets the annotations of the specified ontology.

Parameters

onto – The ontology.

Returns

The annotations.

cowl_ret cowl_ontology_add_annot(CowlOntology *onto, CowlAnnotation *annot)

Adds an annotation to the ontology.

Parameters
  • onto – The ontology.

  • annot – The annotation.

Returns

Return code.

void cowl_ontology_remove_annot(CowlOntology *onto, CowlAnnotation *annot)

Removes an annotation from the ontology.

Parameters
  • onto – The ontology.

  • annot – The annotation.

CowlOntology *cowl_ontology_get_import(CowlOntology *onto, CowlIRI *iri)

Gets an imported ontology given its import IRI.

Parameters
  • onto – The ontology.

  • iri – Import IRI.

Returns

Imported ontology.

CowlIRI *cowl_ontology_get_import_iri(CowlOntology *onto, CowlOntology *import)

Gets the import IRI of an imported ontology.

Parameters
  • onto – The ontology.

  • import – The imported ontology.

Returns

Import IRI.

cowl_ret cowl_ontology_add_import(CowlOntology *onto, CowlIRI *import)

Adds an import to the ontology.

Parameters
  • onto – The ontology.

  • import – IRI of the imported ontology.

Returns

Return code.

void cowl_ontology_remove_import(CowlOntology *onto, CowlIRI *import)

Removes an import from the ontology.

Parameters
  • onto – The ontology.

  • import – IRI of the imported ontology.

cowl_ret cowl_ontology_add_axiom(CowlOntology *onto, CowlAnyAxiom *axiom)

Adds an axiom to the ontology.

Parameters
  • onto – The ontology.

  • axiom – The axiom.

Returns

Return code.

void cowl_ontology_remove_axiom(CowlOntology *onto, CowlAnyAxiom *axiom)

Removes an axiom from the ontology.

Parameters
  • onto – The ontology.

  • axiom – The axiom.

ulib_uint cowl_ontology_axiom_count(CowlOntology *onto, bool imports)

Gets the number of axioms in the ontology.

Parameters
  • onto – The ontology.

  • imports – If true, the query recurses over imported ontologies.

Returns

Number of axioms.

ulib_uint cowl_ontology_imports_count(CowlOntology *onto, bool imports)

Gets the number of imported ontologies.

Parameters
  • onto – The ontology.

  • imports – If true, the query recurses over imported ontologies.

Returns

Number of imports.

ulib_uint cowl_ontology_axiom_count_for_type(CowlOntology *onto, CowlAxiomType type, bool imports)

Gets the number of axioms of the specified type.

Parameters
  • onto – The ontology.

  • type – The axiom type.

  • imports – If true, the query recurses over imported ontologies.

Returns

Number of axioms.

ulib_uint cowl_ontology_axiom_count_for_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive, bool imports)

Gets the number of axioms referencing the specified primitive.

Parameters
  • onto – The ontology.

  • primitive – The primitive.

  • imports – If true, the query recurses over imported ontologies.

Returns

Number of axioms.

ulib_uint cowl_ontology_primitives_count(CowlOntology *onto, CowlPrimitiveFlags flags, bool imports)

Gets the number of primitives.

Parameters
  • onto – The ontology.

  • flags – Primitive flags.

  • imports – If true, the query recurses over imported ontologies.

Returns

Number of primitives.

bool cowl_ontology_has_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive, bool imports)

Checks if the specified primitive is referenced by an axiom in the ontology.

Parameters
  • onto – The ontology.

  • primitive – The primitive.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the primitive is referenced by an axiom, false otherwise.

bool cowl_ontology_has_axiom(CowlOntology *onto, CowlAnyAxiom *axiom, bool imports)

Checks whether the ontology contains the specified axiom.

Parameters
  • onto – The ontology.

  • axiom – The axiom.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the ontology contains the axiom, false otherwise.

bool cowl_ontology_iterate_primitives(CowlOntology *onto, CowlPrimitiveFlags flags, CowlIterator *iter, bool imports)

Iterates over the primitives referenced by the specified ontology.

Parameters
  • onto – The ontology.

  • flags – Primitive flags.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_imports(CowlOntology *onto, CowlIterator *iter, bool imports)

Iterates over the imported ontologies.

Parameters
  • onto – The ontology.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_import_iris(CowlOntology *onto, CowlIterator *iter, bool imports)

Iterates over the import IRIs.

Parameters
  • onto – The ontology.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_axioms(CowlOntology *onto, CowlIterator *iter, bool imports)

Iterates over the axioms in the ontology.

Parameters
  • onto – The ontology.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_axioms_of_type(CowlOntology *onto, CowlAxiomType type, CowlIterator *iter, bool imports)

Iterates over the axioms of a certain type.

Parameters
  • onto – The ontology.

  • type – The axiom type.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_axioms_for_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive, CowlIterator *iter, bool imports)

Iterates over the axioms referencing the specified primitive.

Parameters
  • onto – The ontology.

  • primitive – The primitive.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_sub_classes(CowlOntology *onto, CowlClass *owl_class, CowlIterator *iter, bool imports)

Iterates over the subclasses of the specified class.

Parameters
  • onto – The ontology.

  • owl_class – The class.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_super_classes(CowlOntology *onto, CowlClass *owl_class, CowlIterator *iter, bool imports)

Iterates over the superclasses of the specified class.

Parameters
  • onto – The ontology.

  • owl_class – The class.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_eq_classes(CowlOntology *onto, CowlClass *owl_class, CowlIterator *iter, bool imports)

Iterates over the equivalent classes of the specified class.

Parameters
  • onto – The ontology.

  • owl_class – The class.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_disjoint_classes(CowlOntology *onto, CowlClass *owl_class, CowlIterator *iter, bool imports)

Iterates over the disjoint classes of the specified class.

Parameters
  • onto – The ontology.

  • owl_class – The class.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.

bool cowl_ontology_iterate_types(CowlOntology *onto, CowlAnyIndividual *ind, CowlIterator *iter, bool imports)

Iterates over the types of the specified individual.

Parameters
  • onto – The ontology.

  • ind – The individual.

  • iter – The iterator.

  • imports – If true, the query recurses over imported ontologies.

Returns

True if the iteration was completed, false if it was stopped.