Querying and editing ontologies

The ontology object

Once a CowlOntology object has been read into memory, it can be queried and edited to retrieve, add, or remove axioms, annotations, and other constructs.

struct CowlOntology

Represents an Ontology in the OWL 2 specification.

Pseudo-extends: CowlObject

CowlOntology *cowl_ontology(void)

Creates a new ontology.

Note

You must release the returned object via cowl_release().

Returns:

Ontology, or NULL on error.

CowlOntology *cowl_ontology_from_path(UString path, cowl_ret *ret)

Reads an ontology from the specified file path.

Note

You must release the returned object via cowl_release().

Parameters:
  • path – File path.

  • ret[out] Return code.

Returns:

Ontology, or NULL on error.

CowlOntology *cowl_ontology_from_stream(UIStream *stream, cowl_ret *ret)

Reads an ontology from the specified input stream.

Note

You must release the returned object via cowl_release().

Parameters:
  • stream – Input stream.

  • ret[out] Return code.

Returns:

Ontology, or NULL on error.

cowl_ret cowl_ontology_to_path(CowlOntology *onto, UString path)

Writes the specified ontology to the given file path.

Parameters:
  • onto – The ontology.

  • path – File path.

Returns:

Return code.

cowl_ret cowl_ontology_to_stream(CowlOntology *onto, UOStream *stream)

Writes the specified ontology to the given output stream.

Parameters:
  • onto – The ontology.

  • stream – Output stream.

Returns:

Return code.

CowlPrefixMap *cowl_ontology_get_prefix_map(CowlOntology *onto)

Gets the prefix map of this ontology.

Parameters:
  • onto – The ontology.

Returns:

The prefix map, or NULL on error.

CowlIRI *cowl_ontology_get_iri(CowlOntology *onto)

Gets the IRI of the ontology.

Parameters:
  • onto – The ontology.

Returns:

The ontology IRI.

cowl_ret cowl_ontology_set_iri(CowlOntology *onto, CowlIRI *iri)

Sets the IRI of the ontology.

Parameters:
  • onto – The ontology.

  • iri – The IRI.

Returns:

Return code.

CowlIRI *cowl_ontology_get_version(CowlOntology *onto)

Gets the version of the ontology.

Parameters:
  • onto – The ontology.

Returns:

The version IRI.

cowl_ret cowl_ontology_set_version(CowlOntology *onto, CowlIRI *version)

Sets the version IRI of the ontology.

Parameters:
  • onto – The ontology.

  • version – The version IRI.

Returns:

Return code.

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.

bool cowl_ontology_remove_annot(CowlOntology *onto, CowlAnnotation *annot)

Removes an annotation from the ontology.

Parameters:
  • onto – The ontology.

  • annot – The annotation.

Returns:

True if the annotation was removed (it was found), false otherwise.

bool cowl_ontology_has_import(CowlOntology *onto, CowlIRI *import)

Checks if the given ontology has an import with the specified IRI.

Parameters:
  • onto – The ontology.

  • import – IRI of the imported ontology.

Returns:

True if the ontology has the specified import, false otherwise.

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.

bool cowl_ontology_remove_import(CowlOntology *onto, CowlIRI *import)

Removes an import from the ontology.

Parameters:
  • onto – The ontology.

  • import – IRI of the imported ontology.

Returns:

True if the import was removed (it was found), false otherwise.

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.

bool cowl_ontology_remove_axiom(CowlOntology *onto, CowlAnyAxiom *axiom)

Removes an axiom from the ontology.

Parameters:
  • onto – The ontology.

  • axiom – The axiom.

Returns:

True if the axiom was removed (it was found), false otherwise.

ulib_uint cowl_ontology_remove_axioms_matching(CowlOntology *onto, CowlAxiomFilter *filter)

Removes the axioms matching the provided filter function.

Note

The filter must not be used anymore after calling this function.

Parameters:
  • onto – The ontology.

  • filter – The filter.

Returns:

Number of removed axioms.

ulib_uint cowl_ontology_axiom_count(CowlOntology *onto)

Gets the number of axioms in the ontology.

Parameters:
  • onto – The ontology.

Returns:

Number of axioms.

ulib_uint cowl_ontology_import_count(CowlOntology *onto)

Gets the number of imported ontologies.

Parameters:
  • onto – The ontology.

Returns:

Number of imports.

ulib_uint cowl_ontology_axiom_count_for_type(CowlOntology *onto, CowlAxiomType type)

Gets the number of axioms of the specified type.

Parameters:
  • onto – The ontology.

  • type – The axiom type.

Returns:

Number of axioms.

ulib_uint cowl_ontology_axiom_count_for_types(CowlOntology *onto, CowlAxiomFlags types)

Gets the number of axioms of the specified types.

Parameters:
  • onto – The ontology.

  • types – The axiom types.

Returns:

Number of axioms.

ulib_uint cowl_ontology_axiom_count_for_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive)

Gets the number of axioms referencing the specified primitive.

Parameters:
  • onto – The ontology.

  • primitive – The primitive.

Returns:

Number of axioms.

ulib_uint cowl_ontology_primitive_count(CowlOntology *onto, CowlPrimitiveFlags flags)

Gets the number of primitives.

Parameters:
  • onto – The ontology.

  • flags – Primitive flags.

Returns:

Number of primitives.

bool cowl_ontology_has_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive)

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

Parameters:
  • onto – The ontology.

  • primitive – The primitive.

Returns:

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

bool cowl_ontology_has_axiom(CowlOntology *onto, CowlAnyAxiom *axiom)

Checks whether the ontology contains the specified axiom.

Parameters:
  • onto – The ontology.

  • axiom – The axiom.

Returns:

True if the ontology contains the axiom, false otherwise.

cowl_ret cowl_ontology_iterate_annot(CowlOntology *onto, CowlIterator *iter)

Iterates over the annotations of the ontology.

Parameters:
  • onto – The ontology.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_imports(CowlOntology *onto, CowlIterator *iter)

Iterates over the import IRIs.

Parameters:
  • onto – The ontology.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_primitives(CowlOntology *onto, CowlPrimitiveFlags flags, CowlIterator *iter)

Iterates over the primitives referenced by the specified ontology.

Parameters:
  • onto – The ontology.

  • flags – Primitive flags.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_axioms(CowlOntology *onto, CowlIterator *iter)

Iterates over the axioms in the ontology.

Parameters:
  • onto – The ontology.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_axioms_of_type(CowlOntology *onto, CowlAxiomType type, CowlIterator *iter)

Iterates over the axioms of a certain type.

Parameters:
  • onto – The ontology.

  • type – The axiom type.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_axioms_of_types(CowlOntology *onto, CowlAxiomFlags types, CowlIterator *iter)

Iterates over the axiom of some types.

Parameters:
  • onto – The ontology.

  • types – The axiom types.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_axioms_for_primitive(CowlOntology *onto, CowlAnyPrimitive *primitive, CowlIterator *iter)

Iterates over the axioms referencing the specified primitive.

Parameters:
  • onto – The ontology.

  • primitive – The primitive.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_axioms_matching(CowlOntology *onto, CowlAxiomFilter *filter, CowlIterator *iter)

Iterates over the axioms matching the specified filter.

Note

The filter must not be used anymore after calling this function.

Parameters:
  • onto – The ontology.

  • filter – The filter.

  • iter – The iterator.

Returns:

Return code.

Iterates over the constructs that are related to the specified primitive by some axiom.

Parameters:
  • onto – The ontology.

  • primitive – The primitive.

  • types – The axiom types.

  • position – Position of the related constructs.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_sub_classes(CowlOntology *onto, CowlClass *cls, CowlIterator *iter)

Iterates over the subclasses of the specified class.

Parameters:
  • onto – The ontology.

  • cls – The class.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_super_classes(CowlOntology *onto, CowlClass *cls, CowlIterator *iter)

Iterates over the superclasses of the specified class.

Parameters:
  • onto – The ontology.

  • cls – The class.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_eq_classes(CowlOntology *onto, CowlClass *cls, CowlIterator *iter)

Iterates over the equivalent classes of the specified class.

Parameters:
  • onto – The ontology.

  • cls – The class.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_disjoint_classes(CowlOntology *onto, CowlClass *cls, CowlIterator *iter)

Iterates over the disjoint classes of the specified class.

Parameters:
  • onto – The ontology.

  • cls – The class.

  • iter – The iterator.

Returns:

Return code.

cowl_ret cowl_ontology_iterate_types(CowlOntology *onto, CowlAnyIndividual *ind, CowlIterator *iter)

Iterates over the types of the specified individual.

Parameters:
  • onto – The ontology.

  • ind – The individual.

  • iter – The iterator.

Returns:

Return code.

Querying ontologies

The base mechanism for querying a CowlOntology and other constructs is invoking their iterator member functions, which generally accept CowlIterator instances.

CowlIterator is a wrapper around a function that is called for every element matched by the query. By providing a generic context pointer, you can plug any custom data structure (loggers, collections, etc.), which allows for arbitrarily complex programmatic queries. Iteration can be stopped at any time, enabling early termination for queries such as finding the first construct that matches some condition.

struct CowlIterator
#include “cowl_iterator.h”

Wrapper around a function that gets called for every element matched by a query.

The context provided while creating the iterator is passed to the for_each function each time it is called.

The iterator function returns a cowl_ret that can be used to control iteration: by returning COWL_OK iteration proceeds to the next element, while returning COWL_STOP causes it to halt.

Public Members

void *ctx

The iterator context, can be anything.

cowl_ret (*for_each)(void *ctx, CowlAny *object)

Function called by the iterator for every element.

struct CowlFilter
#include “cowl_iterator.h”

Wrapper around a function called to filter objects according to user-defined criteria.

See also

CowlIterator

Public Members

void *ctx

Context, can be anything.

bool (*filter)(void *ctx, CowlAny *object)

Filter function.

cowl_ret cowl_iterator_call(CowlIterator const *iter, CowlAny *object)

Call the iterator on a single object.

Parameters:
  • iter – The iterator.

  • object – The object.

Returns:

Return value of the iterator function.

CowlIterator cowl_iterator_vec(UVec_CowlObjectPtr *vec, bool retain)

Initializes an iterator that stores objects in the specified vector.

Parameters:
  • vec[out] Vector.

  • retain – If true, elements added to the vector are retained.

Returns:

Initialized iterator.

CowlIterator cowl_iterator_set(UHash_CowlObjectPtr *set, bool retain)

Initializes an iterator that stores objects in the specified set.

Parameters:
  • set[out] Set.

  • retain – If true, elements added to the set are retained.

Returns:

Initialized iterator.

CowlIterator cowl_iterator_count(ulib_uint *count)

Initializes an iterator that counts the objects it iterates on.

Parameters:
  • count[out] Object count.

Returns:

Initialized iterator.

CowlIterator cowl_iterator_contains(CowlAny *object)

Initializes an iterator that checks if any of the objects it iterates on is equal to the specified object.

Note

The iterator returns COWL_STOP if the object is found.

Parameters:
  • object – The object to look for.

Returns:

Initialized iterator.

CowlIterator cowl_iterator_retain(void)

Initializes an iterator that retains all objects it iterates on.

Returns:

Initialized iterator.

CowlIterator cowl_iterator_release(void)

Initializes an iterator that releases all objects it iterates on.

Returns:

Initialized iterator.

typedef UBit_N CowlAxiomFlags

Flags to control iteration over axioms.

COWL_AF_NONE

Iterate over no axioms.

COWL_AF_ALL

Iterate over all axioms.

COWL_AF_DECL

Iterate over declaration axioms (CowlDeclAxiom).

COWL_AF_SUB_CLASS

Iterate over subclass axioms (CowlSubClsAxiom).

COWL_AF_EQUIV_CLASSES

Iterate over equivalent classes axioms (CowlNAryClsAxiom).

COWL_AF_DISJ_CLASSES

Iterate over disjoint classes axioms (CowlNAryClsAxiom).

COWL_AF_DISJ_UNION

Iterate over disjoint union axioms (CowlDisjUnionAxiom).

COWL_AF_SUB_OBJ_PROP

Iterate over object subproperty axioms (CowlSubObjPropAxiom).

COWL_AF_EQUIV_OBJ_PROP

Iterate over equivalent object properties axioms (CowlNAryObjPropAxiom).

COWL_AF_DISJ_OBJ_PROP

Iterate over disjoint object properties axioms (CowlNAryObjPropAxiom).

COWL_AF_INV_OBJ_PROP

Iterate over inverse object properties axioms (CowlInvObjPropAxiom).

COWL_AF_OBJ_PROP_DOMAIN

Iterate over object property domain axioms (CowlObjPropCharAxiom).

COWL_AF_OBJ_PROP_RANGE

Iterate over object property range axioms (CowlObjPropCharAxiom).

COWL_AF_FUNC_OBJ_PROP

Iterate over functional object property axioms (CowlObjPropCharAxiom).

COWL_AF_INV_FUNC_OBJ_PROP

Iterate over inverse functional object property axioms (CowlObjPropCharAxiom).

COWL_AF_REFL_OBJ_PROP

Iterate over reflexive object property axioms (CowlObjPropCharAxiom).

COWL_AF_IRREFL_OBJ_PROP

Iterate over irreflexive object property axioms (CowlObjPropCharAxiom).

COWL_AF_SYMM_OBJ_PROP

Iterate over symmetric object property axioms (CowlObjPropCharAxiom).

COWL_AF_ASYMM_OBJ_PROP

Iterate over asymmetric object property axioms (CowlObjPropCharAxiom).

COWL_AF_TRANS_OBJ_PROP

Iterate over transitive object property axioms (CowlObjPropCharAxiom).

COWL_AF_SUB_DATA_PROP

Iterate over data subproperty axioms (CowlSubDataPropAxiom).

COWL_AF_EQUIV_DATA_PROP

Iterate over equivalent data properties axioms (CowlNAryDataPropAxiom).

COWL_AF_DISJ_DATA_PROP

Iterate over disjoint data properties axioms (CowlNAryDataPropAxiom).

COWL_AF_DATA_PROP_DOMAIN

Iterate over data property domain axioms (CowlDataPropDomainAxiom).

COWL_AF_DATA_PROP_RANGE

Iterate over data property range axioms (CowlDataPropRangeAxiom).

COWL_AF_FUNC_DATA_PROP

Iterate over functional data property axioms (CowlFuncDataPropAxiom).

COWL_AF_DATATYPE_DEF

Iterate over datatype definition axioms (CowlDatatypeDefAxiom).

COWL_AF_HAS_KEY

Iterate over has key axioms (CowlHasKeyAxiom).

COWL_AF_SAME_IND

Iterate over same individual axioms (CowlNAryIndAxiom).

COWL_AF_DIFF_IND

Iterate over different individuals axioms (CowlNAryIndAxiom).

COWL_AF_CLASS_ASSERT

Iterate over class assertion axioms (CowlClsAssertAxiom).

COWL_AF_OBJ_PROP_ASSERT

Iterate over object property assertion axioms (CowlObjPropAssertAxiom).

COWL_AF_NEG_OBJ_PROP_ASSERT

Iterate over negative object property assertion axioms (CowlObjPropAssertAxiom).

COWL_AF_DATA_PROP_ASSERT

Iterate over data property assertion axioms (CowlDataPropAssertAxiom).

COWL_AF_NEG_DATA_PROP_ASSERT

Iterate over negative data property assertion axioms (CowlDataPropAssertAxiom).

COWL_AF_ANNOT_ASSERT

Iterate over annotation assertion axioms (CowlAnnotAssertAxiom).

COWL_AF_SUB_ANNOT_PROP

Iterate over annotation subproperty axioms (CowlSubAnnotPropAxiom).

COWL_AF_ANNOT_PROP_DOMAIN

Iterate over annotation property domain axioms (CowlAnnotPropDomainAxiom).

COWL_AF_ANNOT_PROP_RANGE

Iterate over annotation property range axioms (CowlAnnotPropRangeAxiom).

CowlAxiomFlags cowl_axiom_flags_from_type(CowlAxiomType type)

Returns a bitmask with a bit set for the specified axiom type.

Parameters:
  • type – Axiom type.

Returns:

Flags.

CowlAxiomFlags cowl_axiom_flags_add_type(CowlAxiomFlags flags, CowlAxiomType type)

Adds the specified type to the flags.

Parameters:
  • flags – Axiom flags.

  • type – Axiom type.

Returns:

Updated flags.

CowlAxiomFlags cowl_axiom_flags_remove_type(CowlAxiomFlags flags, CowlAxiomType type)

Removes the specified type from the flags.

Parameters:
  • flags – Axiom flags.

  • type – Axiom type.

Returns:

Updated flags.

bool cowl_axiom_flags_has_type(CowlAxiomFlags flags, CowlAxiomType type)

Checks whether the specified type is included in the flags.

Parameters:
  • flags – Axiom flags.

  • type – Axiom type.

Returns:

True if the type is included in the flags, false otherwise.

bool cowl_axiom_flags_has_all_types(CowlAxiomFlags flags)

Checks whether the flags match all axiom types.

Parameters:
  • flags – Axiom flags.

Returns:

True if the flags match all axiom types, false otherwise.

bool cowl_axiom_flags_has_no_types(CowlAxiomFlags flags)

Checks whether the flags match no axiom types.

Parameters:
  • flags – Axiom flags.

Returns:

True if the flags match no axiom types, false otherwise.

cowl_axiom_flags_foreach_type(flags, type)

Iterates over the flags, executing the specified code block for each axiom type.

Parameters:
  • flags – Axiom flags.

  • type – Name of the variable holding the axiom type.

struct CowlAxiomFilter

Axiom filter.

Public Members

CowlAxiomFlags types

Match axioms of the specified types.

UVec_CowlObjectPtr primitives

Match axioms referencing all the specified primitives.

CowlFilter closure

Match axioms based on the specified closure.

CowlAxiomFilter cowl_axiom_filter(CowlAxiomFlags types)

Returns a new axiom filter.

Parameters:
  • types – Axiom types.

Returns:

Axiom filter.

void cowl_axiom_filter_deinit(CowlAxiomFilter *filter)

De-initializes an axiom filter previously initialized via cowl_axiom_filter.

Parameters:
  • filter – Axiom filter.

void cowl_axiom_filter_add_type(CowlAxiomFilter *filter, CowlAxiomType type)

Adds the specified axiom type to the filter.

Parameters:
  • filter – Axiom filter.

  • type – Axiom type.

void cowl_axiom_filter_remove_type(CowlAxiomFilter *filter, CowlAxiomType type)

Removes the specified axiom type from the filter.

Parameters:
  • filter – Axiom filter.

  • type – Axiom type.

cowl_ret cowl_axiom_filter_add_primitive(CowlAxiomFilter *filter, CowlAnyPrimitive *primitive)

Adds the specified primitive to the filter.

Parameters:
  • filter – Axiom filter.

  • primitive – Primitive.

Returns:

Return code.

void cowl_axiom_filter_remove_primitive(CowlAxiomFilter *filter, CowlAnyPrimitive *primitive)

Removes the specified primitive from the filter.

Parameters:
  • filter – Axiom filter.

  • primitive – Primitive.

void cowl_axiom_filter_set_closure(CowlAxiomFilter *filter, CowlFilter closure)

Sets the filter closure.

Parameters:
  • filter – Axiom filter.

  • closure – Filter closure.

Editing ontologies

Ontologies can be edited by adding or removing axioms, annotations and other constructs, as allowed by the CowlOntology API. They can also be created from scratch via the cowl_ontology() constructor.

Access to the mappings between prefixed and full IRIs is pro is provided by a CowlPrefixMap instance, retrievable by calling cowl_ontology_get_prefix_map().

struct CowlPrefixMap

Holds the mapping between prefixes and namespaces.

Pseudo-extends: CowlObject

CowlPrefixMap *cowl_prefix_map(void)

Creates a new prefix map.

Note

You must release the returned object via cowl_release().

Returns:

Prefix map, or NULL on error.

CowlTable *cowl_prefix_map_get_table(CowlPrefixMap *map, bool reverse)

Gets the table that associates prefixes to namespaces.

Parameters:
  • map – The prefix map.

  • reverse – If true, the reversed map (namespaces to prefixes) is returned.

Returns:

Table, or NULL on error.

CowlString *cowl_prefix_map_get_ns(CowlPrefixMap *map, CowlString *prefix)

Returns the namespace associated with the specified prefix.

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

Returns:

Namespace associated with the prefix, or NULL if the prefix cannot be found.

CowlString *cowl_prefix_map_get_prefix(CowlPrefixMap *map, CowlString *ns)

Returns the prefix associated with the specified namespace.

Parameters:
  • map – The prefix map.

  • ns – The namespace.

Returns:

Prefix associated with the namespace, or NULL if the prefix cannot be found.

cowl_ret cowl_prefix_map_add(CowlPrefixMap *map, CowlString *prefix, CowlString *ns, bool overwrite)

Registers the specified prefix-namespace mapping.

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

  • ns – The namespace.

  • overwrite – If true, the new mapping overwrites the previous one.

Returns:

Return code.

cowl_ret cowl_prefix_map_add_raw(CowlPrefixMap *map, UString prefix, UString ns, bool overwrite)

Registers the specified prefix-namespace mapping.

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

  • ns – The namespace.

  • overwrite – If true, the new mapping overwrites the previous one.

Returns:

Return code.

cowl_ret cowl_prefix_map_remove_prefix(CowlPrefixMap *map, CowlString *prefix)

Unregisters the specified prefix.

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

Returns:

COWL_OK if the prefix was removed; COWL_NO if the prefix was not found; an error code on failure.

cowl_ret cowl_prefix_map_remove_prefix_raw(CowlPrefixMap *map, UString prefix)

Unregisters the specified prefix.

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

Returns:

COWL_OK if the prefix was removed; COWL_NO if the prefix was not found; an error code on failure.

cowl_ret cowl_prefix_map_remove_ns(CowlPrefixMap *map, CowlString *ns)

Unregisters the specified namespace.

Parameters:
  • map – The prefix map.

  • ns – The namespace.

Returns:

COWL_OK if at least one mapping was removed; COWL_NO if the namespace was not found; an error code on failure.

cowl_ret cowl_prefix_map_remove_ns_raw(CowlPrefixMap *map, UString ns)

Unregisters the specified namespace.

Parameters:
  • map – The prefix map.

  • ns – The namespace.

Returns:

COWL_OK if at least one mapping was removed; COWL_NO if the namespace was not found; an error code on failure.

cowl_ret cowl_prefix_map_merge(CowlPrefixMap *dst, CowlPrefixMap *src, bool overwrite)

Merges the contents of a prefix map in the current one.

Parameters:
  • dst – The destination prefix map.

  • src – The source prefix map.

  • overwrite – If true, conflicting prefixes are overwritten in the destination.

Returns:

COWL_OK if the destination map was modified; COWL_NO if the destination map was not modified; an error code on failure.

CowlIRI *cowl_prefix_map_get_iri(CowlPrefixMap *map, UString prefix, UString rem)

Retrieves the full IRI associated with the specified short IRI prefix and remainder.

Note

You must release the returned object via cowl_release().

Parameters:
  • map – The prefix map.

  • prefix – The prefix.

  • rem – The remainder.

Returns:

IRI instance, or NULL on error.

CowlIRI *cowl_prefix_map_parse_short_iri(CowlPrefixMap *map, UString short_iri)

Parses an IRI from the specified short IRI.

Note

You must release the returned object via cowl_release().

Parameters:
  • map – The prefix map.

  • short_iri – The short IRI.

Returns:

IRI instance, or NULL on error.

CowlIRI *cowl_prefix_map_parse_iri(CowlPrefixMap *map, UString str)

Parses an IRI from the specified string, which must be the representation of either a short or a full IRI.

Note

You must release the returned object via cowl_release().

Parameters:
  • map – The prefix map.

  • str – The IRI string.

Returns:

IRI instance, or NULL on error.