Entities and Primitives

Entities represent the named terms of OWL ontologies, and are modeled by CowlEntity. The term primitive has no correspondence in the OWL 2 specification. It is used as a collective term for entities, anonymous individuals, and IRIs, which are modeled by CowlPrimitive. You can always safely cast CowlEntity to CowlPrimitive, while the opposite can only be done after checking that the primitive is an OWL entity (see CowlPrimitive::cowl_primitive_is_entity()).

struct CowlEntity : public CowlPrimitive

Represents an Entity in the OWL 2 specification.

Subclassed by CowlAnnotProp, CowlClass, CowlDataProp, CowlDatatype, CowlNamedInd, CowlObjProp

Public Functions

CowlEntityType cowl_entity_get_type(CowlAnyEntity *entity)

Gets the type of the entity.

Parameters

entity – The entity.

Returns

The type.

CowlIRI *cowl_entity_get_iri(CowlAnyEntity *entity)

Gets the IRI of the entity.

Parameters

entity – The entity.

Returns

The IRI.

bool cowl_entity_is_reserved(CowlAnyEntity *entity)

Checks whether the entity is reserved, i.e.

if its IRI is in the reserved vocabulary.

Parameters

entity – The entity.

Returns

True if the entity is reserved, false otherwise.

ulib_uint cowl_entity_get_id(CowlAnyEntity *entity)

Gets the increasing unique identifier associated to the specified entity.

Note

Only available if COWL_ENTITY_IDS is defined. Enabling this API ensures entities are tracked and given a numeric identifier for the lifetime of the executable, which can be a useful property to have in some applications. Bear in mind that this also means entities are never deallocated, which can affect memory usage.

Parameters

entity – The entity.

Returns

Unique identifier.

CowlAnyEntity *cowl_entity_with_id(ulib_uint id)

Returns the entity that has the specified identifier.

Note

Only available if COWL_ENTITY_IDS is defined.

Parameters

id – Unique identifier.

Returns

Entity with the specified identifier, or NULL if no entity has the specified identifier.

enum CowlEntityType

Represents the type of CowlEntity.

Values:

enumerator COWL_ET_CLASS

CowlClass - class.

enumerator COWL_ET_OBJ_PROP

CowlObjProp - object property.

enumerator COWL_ET_DATA_PROP

CowlDataProp - data property.

enumerator COWL_ET_ANNOT_PROP

CowlAnnotProp - annotation property.

enumerator COWL_ET_NAMED_IND

CowlNamedInd - named individual.

enumerator COWL_ET_DATATYPE

CowlDatatype - datatype.

enumerator COWL_ET_COUNT

Number of enum values.

enumerator COWL_ET_FIRST

First enum value.

struct CowlPrimitive : public CowlObject

Represents a primitive, a collective term for entities, anonymous individuals, and IRIs.

Subclassed by CowlAnonInd, CowlEntity, CowlIndividual

Public Functions

CowlPrimitiveType cowl_primitive_get_type(CowlAnyPrimitive *primitive)

Gets the type of the primitive.

Parameters

primitive – The primitive.

Returns

The type.

bool cowl_primitive_is_entity(CowlAnyPrimitive *primitive)

Checks whether the primitive is an entity.

Parameters

primitive – The primitive.

Returns

True if the primitive is an entity,

enum CowlPrimitiveType

Represents the type of CowlPrimitive.

Values:

enumerator COWL_PT_CLASS

CowlClass - class.

enumerator COWL_PT_OBJ_PROP

CowlObjProp - object property.

enumerator COWL_PT_DATA_PROP

CowlDataProp - data property.

enumerator COWL_PT_ANNOT_PROP

CowlAnnotProp - annotation property.

enumerator COWL_PT_NAMED_IND

CowlNamedInd - named individual.

enumerator COWL_PT_ANON_IND

CowlAnonInd - anonymous individual.

enumerator COWL_PT_DATATYPE

CowlDatatype - datatype.

enumerator COWL_PT_IRI

CowlIRI - IRI.

enumerator COWL_PT_COUNT

Number of enum values.

enumerator COWL_PT_FIRST

First enum value.