Knowledge base¶
-
struct
TmeKB¶ Models a knowledge base.
- Warning
Unless otherwise stated, TmeSemDesc instances returned by the KB must not be mutated unless they have been copied beforehand (via e.g. tme_sem_desc_copy()), since they generally directly reference its internal data structures.
Loading
-
void
tme_kb_load_individuals(TmeKB *kb, TmeAxiomProvider const *provider, TmeABoxEntryType type)¶ Loads all the individuals obtained from an axiom provider.
- Parameters
kb: KB instance.provider: Axiom provider.type: Type of the loaded individuals.
-
void
tme_kb_load_individual(TmeKB *kb, TmeEntityPtr individual, TmeSemDesc *desc, TmeABoxEntryType type)¶ Loads an individual into the ABox.
- Parameters
kb: KB instance.individual: Individual identifier.desc: Semantic description of the specified individual.type: Type of the loaded individual.
-
void
tme_kb_unload_individual(TmeKB *kb, TmeEntityPtr individual)¶ Unloads the specified individual from the ABox.
- Parameters
kb: KB instance.individual: Individual to unload.
-
void
tme_kb_unload_individuals(TmeKB *kb, TmeABoxEntryType type, Vector_TmeEntityPtr *unloaded)¶ Unloads all the individuals of a certain type.
- Parameters
kb: KB instance.type: Type of the individuals to unload.[out] unloaded: Unloaded individuals.
-
void
tme_kb_tell_individual_type(TmeKB *kb, TmeEntityPtr individual, TmeABoxEntryType type)¶ Sets the type of the specified individual.
- Parameters
kb: KB instance.individual: Individual whose type should be set.type: Type of the individual.
Querying
-
tme_uint_t
tme_kb_get_tbox_size(TmeKB *kb)¶ Returns the number of concepts in the TBox.
- Return
Number of concepts in the TBox.
- Parameters
kb: KB instance.
-
tme_uint_t
tme_kb_get_abox_size(TmeKB *kb)¶ Returns the number of individuals in the ABox.
- Return
Number of individuals in the ABox.
- Parameters
kb: KB instance.
-
tme_uint_t
tme_kb_get_individuals_count(TmeKB *kb, TmeABoxEntryType type)¶ Returns the number of individuals of the specified type.
- Return
Number of individuals of the specified type.
- Parameters
kb: KB instance.type: Individual type.
-
void
tme_kb_get_concepts(TmeKB *kb, Vector_TmeEntityPtr *concepts)¶ Returns all the concepts in the TBox.
- Parameters
kb: KB instance.[out] concepts: TBox concepts.
-
void
tme_kb_get_individuals(TmeKB *kb, Vector_TmeEntityPtr *individuals)¶ Returns all the individuals in the ABox.
- Parameters
kb: KB instance.[out] individuals: ABox individuals.
-
void
tme_kb_get_individuals_type(TmeKB *kb, Vector_TmeEntityPtr *resources, Vector_TmeEntityPtr *requests)¶ Returns all the individuals in the ABox, split in resources and requests.
- Parameters
kb: KB instance.[out] resources: Resource individuals.[out] requests: Request individuals.
-
void
tme_kb_get_tbox(TmeKB *kb, UHash_TmeEntityTable *tbox)¶ Returns the TBox concepts and their normalized descriptions.
- Parameters
kb: KB instance.[out] tbox: TBox concepts and their normalized descriptions.
-
void
tme_kb_get_abox(TmeKB *kb, UHash_TmeEntityTable *abox)¶ Returns the ABox individuals and their normalized descriptions.
- Parameters
kb: KB instance.abox: ABox individuals and their normalized descriptions.
-
void
tme_kb_get_abox_type(TmeKB *kb, UHash_TmeEntityTable *resources, UHash_TmeEntityTable *requests)¶ Returns the ABox split in resources and requests.
- Parameters
kb: KB instance.[out] resources: Resource individuals and their normalized descriptions.[out] requests: Request individuals and their normalized descriptions.
-
TmeVocabulary
tme_kb_get_vocabulary(TmeKB *kb)¶ Returns the vocabulary.
- Return
Vocabulary instance.
- Parameters
kb: KB instance.
-
TmeSemDesc *
tme_kb_normalized_concept(TmeKB *kb, TmeEntityPtr concept)¶ Returns the unfolded and normalized semantic description of the specified concept.
- Return
Normalized description.
- Parameters
kb: KB instance.concept: Concept whose description should be retrieved.
-
TmeSemDesc *
tme_kb_normalized_individual(TmeKB *kb, TmeEntityPtr individual)¶ Returns the unfolded and normalized semantic description of the specified individual.
- Return
Normalized description.
- Parameters
kb: KB instance.individual: Individual whose description should be retrieved.
-
bool
tme_kb_sem_desc_normalize(TmeKB *kb, TmeSemDesc *desc)¶ Performs the unfolding and CNF normalization of the specified description.
- Return
True if the description is satisfiable, false otherwise.
- Parameters
kb: KB instance.desc: Semantic description to normalize.
-
void
tme_kb_sem_desc_fold(TmeKB *kb, TmeSemDesc *desc)¶ Folds the specified description.
- Parameters
kb: KB instance.desc: Semantic description to fold.
Iteration
-
void
tme_kb_iterate_tbox(TmeKB *kb, TmeTBoxIterator *iter)¶ Iterates over the TBox.
- Parameters
kb: KB instance.iter: TBox iterator.
-
void
tme_kb_iterate_abox(TmeKB *kb, TmeABoxIterator *iter)¶ Iterates over the ABox.
- Parameters
kb: KB instance.iter: ABox iterator.
-
void
tme_kb_iterate_individuals_type(TmeKB *kb, TmeABoxEntryType type, TmeABoxIterator *iter)¶ Iterates over all the individuals of the specified type.
- Parameters
kb: KB instance.type: Individual type.iter: ABox iterator.
-
void
tme_kb_iterate_concept_ptrs(TmeKB *kb, TmeKBConceptIterator *iter)¶ Iterates over all the concepts in the TBox, ignoring their descriptions.
- Parameters
kb: KB instance.iter: Concept iterator.
-
void
tme_kb_iterate_individual_ptrs(TmeKB *kb, TmeKBIndividualIterator *iter)¶ Iterates over all the individuals in the ABox, ignoring their descriptions.
- Parameters
kb: KB instance.iter: Individual iterator.
-
void
tme_kb_iterate_individual_ptrs_type(TmeKB *kb, TmeABoxEntryType type, TmeKBIndividualIterator *iter)¶ Iterates over all the individuals of the specified type, ignoring their description.
- Parameters
kb: KB instance.type: Individual type.iter: Individual iterator.
ABox entries¶
-
typedef uint8_t
TmeABoxEntryType¶ Represents the type of an individual with regards to semantic matchmaking tasks.
In this context, an individual can be either a resource, a request, or both.
-
TME_AET_NONE¶ Neither a resource nor a request.
-
TME_AET_RESOURCE¶ Resource.
-
TME_AET_REQUEST¶ Request.
-
TME_AET_ANY¶ Both resource and request at the same time.