Reasoner¶
-
struct
TmeReasoner
¶ The main reasoner structure, exposing standard and non-standard inference tasks.
Non-standard matchmaking services are detailed in “Ruta et al., WIAS 2011”: http://sisinflab.poliba.it/publications/2011/RDS11
Lifecycle
-
TmeReasoner *
tme_reasoner_alloc
(TmeAxiomProvider *provider)¶ Allocates a new reasoner instance.
The axiom provider instance is queried in order to populate the internal data structures.
- Return
Reasoner instance.
- Parameters
provider
: Axiom provider instance.
-
void
tme_reasoner_free
(TmeReasoner *reasoner)¶ Deallocates the reasoner instance.
- Parameters
reasoner
: Reasoner instance to deallocate.
Getters
-
TmeKB *
tme_reasoner_get_kb
(TmeReasoner *reasoner)¶ Retrieves the KB instance loaded into the reasoner.
- Return
KB loaded into the reasoner.
- Parameters
reasoner
: Reasoner instance.
Ontology reasoning
-
void
tme_reasoner_classify
(TmeReasoner *reasoner)¶ Classifies the ontology loaded into the reasoner.
- Parameters
reasoner
: Reasoner instance.
-
bool
tme_reasoner_is_classified
(TmeReasoner *reasoner)¶ Checks whether the ontology has been classified.
- Return
True if the ontology has been classified, false otherwise.
- Parameters
reasoner
: Reasoner instance.
-
bool
tme_reasoner_is_coherent
(TmeReasoner *reasoner)¶ Checks whether the ontology is coherent.
- Return
True if the ontology is coherent, false otherwise.
- See
Moguillansky et al., IBERAMIA 2010 https://cs.uns.edu.ar/~mom/publications/iberamia2010.pdf
- Parameters
reasoner
: Reasoner instance.
Standard reasoning
-
bool
tme_reasoner_individual_is_consistent
(TmeReasoner *reasoner, TmeEntityPtr individual)¶ Checks whether the specified individual is consistent with respect to the TBox.
- Return
True if the individual is consistent, false otherwise.
- Parameters
reasoner
: Reasoner instance.individual
: Individual whose consistency should be checked.
-
bool
tme_reasoner_individual_subsumes
(TmeReasoner *reasoner, TmeEntityPtr subsumer, TmeEntityPtr subsumed)¶ Determines if a subsumption relation holds between the specified individuals.
If the relation holds between two semantic profiles (that is, if one is more general than the other), they are referred to as “subsumer” and “subsumed”. The profiles are individuals previously loaded into the reasoner, either because they were present in the root ontology, or because they were loaded using tme_kb_load_individual() or similar functions.
If the subsumption relation holds, two conclusions can be drawn:
The subsumer is more general than the subsumed, hence the former (usually a requested semantic profile) is satisfied by the latter (usually a supplied resource) in every aspect.
The two elements involved in the relation are compatible.
If the relation does not hold, tme_reasoner_individual_abduce() may be used to compute what should be hypothesized in the subsumed individual in order to completely satisfy the subsumer individual.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
reasoner
: Reasoner instance.subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_reasoner_individual_is_instance
(TmeReasoner *reasoner, TmeEntityPtr individual, TmeEntityPtr concept)¶ Checks whether the specified individual is an instance of a certain class.
- Return
True if the individual is an instance of the class, false otherwise.
- Note
This is currently incomplete, since the reasoner does not process the ABox.
- Parameters
reasoner
: Reasoner instance.individual
: Individual.concept
: Class.
-
bool
tme_reasoner_concept_is_satisfiable
(TmeReasoner *reasoner, TmeEntityPtr concept)¶ Determines if the specified concept is satisfiable with respect to the TBox.
- Return
True if the concept is satisfiable, false otherwise.
- Parameters
reasoner
: Reasoner instance.concept
: Concept whose satisfiability should be verified.
-
bool
tme_reasoner_concept_subsumes
(TmeReasoner *reasoner, TmeEntityPtr subsumer, TmeEntityPtr subsumed)¶ Determines if a subsumption relation holds between the specified concepts.
- Return
True if the subsumption relation holds, false otherwise.
- See
- Parameters
reasoner
: Reasoner instance.subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_reasoner_sem_desc_is_satisfiable
(TmeReasoner *reasoner, TmeSemDesc const *desc)¶ Determines if the specified semantic description is satisfiable with respect to the TBox.
- Return
True if the concept is satisfiable, false otherwise.
- Note
The semantic description must be in normal form.
- Parameters
reasoner
: Reasoner instance.desc
: Semantic description whose satisfiability should be verified.
-
bool
tme_reasoner_sem_desc_subsumes
(TmeReasoner *reasoner, TmeSemDesc const *subsumer, TmeSemDesc const *subsumed)¶ Determines if a subsumption relation holds between the specified semantic descriptions.
- Return
True if the subsumption relation holds, false otherwise.
- See
- Note
Subsumer and subsumed must be in normal form.
- Parameters
reasoner
: Reasoner instance.subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
TmeSemDesc *
tme_reasoner_concept_intersect
(TmeReasoner *reasoner, TmeEntityPtr first, TmeEntityPtr second)¶ Intersects the semantic descriptions of the specified concepts.
- Return
Result of the intersection service.
- See
- Parameters
reasoner
: Reasoner instance.first
: First concept.second
: Second concept.
-
TmeSemDesc *
tme_reasoner_individual_intersect
(TmeReasoner *reasoner, TmeEntityPtr first, TmeEntityPtr second)¶ Intersects the semantic descriptions of the specified individuals.
- Return
Result of the intersection service.
- See
- Parameters
reasoner
: Reasoner instance.first
: First individual.second
: Second individual.
-
TmeSemDesc *
tme_reasoner_sem_desc_intersect
(TmeReasoner *reasoner, TmeSemDesc const *first, TmeSemDesc const *second)¶ Intersects the specified semantic descriptions.
- Return
Result of the intersection service.
- Note
The semantic descriptions must be in normal form.
- Note
The returned description is in normal form.
- Note
You are responsible for freeing the intersection result by calling tme_sem_desc_free().
- Parameters
reasoner
: Reasoner instance.first
: First description.second
: Second description.
-
void
tme_reasoner_iterate_equivalents
(TmeReasoner *reasoner, TmeEntityPtr concept, TmeTaxonomyIterator *iter)¶ Iterates over the inferred equivalents of the specified concept.
- Parameters
reasoner
: Reasoner instance.concept
: Concept whose equivalents should be iterated.iter
: Taxonomy iterator.
-
void
tme_reasoner_iterate_subsumers
(TmeReasoner *reasoner, TmeEntityPtr concept, bool recursive, TmeTaxonomyIterator *iter)¶ Iterates over the inferred subsumers of the specified concept.
- Parameters
reasoner
: Reasoner instance.concept
: Concept whose subsumers should be iterated.recursive
: If true, subsumers are recursively iterated up to the top concept. Otherwise, only the direct subsumers are iterated.iter
: Taxonomy iterator.
-
void
tme_reasoner_iterate_subsumed
(TmeReasoner *reasoner, TmeEntityPtr concept, bool recursive, TmeTaxonomyIterator *iter)¶ Iterates over the inferred subsumees of the specified concept.
- Parameters
reasoner
: Reasoner instance.concept
: Concept whose subsumees should be iterated.recursive
: If true, subsumees are recursively iterated down to the bottom concept. Otherwise, only the direct subsumees are iterated.iter
: Taxonomy iterator.
Non-standard reasoning
-
bool
tme_reasoner_individual_is_compatible
(TmeReasoner *reasoner, TmeEntityPtr resource, TmeEntityPtr request)¶ Determines if a supplied resource and a requested semantic profile are compatible.
That is, whether the semantic description of the resource does not contain any information in conflict with the request. Resource and request are individuals previously loaded into the reasoner using tme_kb_load_individual() or similar functions.
If the compatibility relation between the two individuals holds, then they don’t contain any conflicting part. If the relation does not hold, contraction may be used to compute the conflicting part.
- Return
True if the compatibility relation holds, false otherwise.
- Parameters
reasoner
: Reasoner instance.resource
: Resource against which the request is checked for compatibility.request
: Request against which the resource is checked for compatibility.
-
bool
tme_reasoner_sem_desc_is_compatible
(TmeReasoner *reasoner, TmeSemDesc const *resource, TmeSemDesc const *request)¶ Determines if a supplied resource and a requested semantic profile are compatible.
- Return
True if the compatibility relation holds, false otherwise.
- See
- Note
Resource and request must be in normal form.
- Parameters
reasoner
: Reasoner instance.resource
: Resource against which the request is checked for compatibility.request
: Request against which the resource is checked for compatibility.
-
TmeAbduction
tme_reasoner_individual_abduce
(TmeReasoner *reasoner, TmeEntityPtr resource, TmeEntityPtr request)¶ Performs the Concept Abduction non-standard matchmaking task.
Concept Abduction compares a requested semantic profile with a supplied resource. Resource and request are individuals previously loaded into the reasoner using tme_kb_load_individual() or similar functions.
- Return
Result of the abduction inference service.
- Note
You are responsible for freeing the abduction result by calling tme_abduction_deinit().
- See
Ruta et al., WIAS 2011 (Section 4, Chapter 2) (http://sisinflab.poliba.it/publications/2011/RDS11)
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeAbduction
tme_reasoner_sem_desc_abduce
(TmeReasoner *reasoner, TmeSemDesc const *resource, TmeSemDesc const *request)¶ Performs the Concept Abduction non-standard matchmaking task.
- Return
Result of the abduction inference service.
- Note
Resource and request must be in normal form.
- See
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeBonus
tme_reasoner_individual_bonus
(TmeReasoner *reasoner, TmeEntityPtr resource, TmeEntityPtr request)¶ Performs the Concept Bonus non-standard matchmaking task.
Concept Bonus compares a requested semantic profile with a supplied resource. Resource and request are individuals previously loaded into the reasoner using tme_kb_load_individual() or similar functions.
- Return
Result of the bonus inference service.
- Note
You are responsible for freeing the bonus result by calling tme_bonus_deinit().
- See
Scioscia et al., SRLGIPD18 (http://sisinflab.poliba.it/publications/2018/SRLGIPD18)
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeBonus
tme_reasoner_sem_desc_bonus
(TmeReasoner *reasoner, TmeSemDesc const *resource, TmeSemDesc const *request)¶ Performs the Concept Bonus non-standard matchmaking task.
- Return
Result of the bonus inference service.
- Note
Resource and request must be in normal form.
- See
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeContraction
tme_reasoner_individual_contract
(TmeReasoner *reasoner, TmeEntityPtr resource, TmeEntityPtr request)¶ Performs the Concept Contraction non-standard matchmaking task.
Concept Contraction compares a requested semantic profile with a supplied resource. Resource and request are individuals previously loaded into the reasoner using tme_kb_load_individual() or similar functions.
- Return
Result of the contraction inference service.
- Note
You are responsible for freeing the contraction result by calling tme_contraction_deinit().
- See
Ruta et al., WIAS 2011 (Section 4, Chapter 2) (http://sisinflab.poliba.it/publications/2011/RDS11)
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeContraction
tme_reasoner_sem_desc_contract
(TmeReasoner *reasoner, TmeSemDesc const *resource, TmeSemDesc const *request)¶ Performs the Concept Contraction non-standard matchmaking task.
- Return
Result of the contraction inference service.
- Note
Resource and request must be in normal form.
- See
- Parameters
reasoner
: Reasoner instance.resource
: Resource.request
: Request.
-
TmeComposition
tme_reasoner_individual_covering
(TmeReasoner *reasoner, TmeEntityPtr request)¶ Performs the Concept Covering non-standard matchmaking task.
Concept Covering compares a requested semantic profile with available resources. Request is an OWL individual previously loaded into the reasoner using tme_kb_load_individual() or similar functions.
- Return
Result of the covering inference service.
- Note
You are responsible for freeing the covering result by calling tme_composition_deinit().
- See
Di Noia et al., Concept Covering (http://sisinflab.poliba.it/publications/2004/DDD04a)
- Parameters
reasoner
: Reasoner instance.request
: Request.
-
TmeComposition
tme_reasoner_sem_desc_covering
(TmeReasoner *reasoner, TmeSemDesc const *request)¶ Performs the Concept Covering non-standard matchmaking task.
- Return
Result of the covering inference service.
- Note
The request must be in normal form.
- See
- Parameters
reasoner
: Reasoner instance.request
: Request.
-
TmeSemDesc *
tme_reasoner_individual_difference
(TmeReasoner *reasoner, TmeEntityPtr lhs, TmeEntityPtr rhs)¶ Computes the Concept Difference between the specified individuals.
- Return
Result of the difference service.
- Note
You are responsible for freeing the difference result by calling tme_sem_desc_free().
- Parameters
reasoner
: Reasoner instance.lhs
: LHS of the difference.rhs
: RHS of the difference.
-
TmeSemDesc *
tme_reasoner_sem_desc_difference
(TmeReasoner *reasoner, TmeSemDesc const *lhs, TmeSemDesc const *rhs)¶ Computes the Concept Difference between the specified semantic descriptions.
- Return
Result of the difference service.
- Note
The semantic descriptions must be in normal form.
- See
- Parameters
reasoner
: Reasoner instance.lhs
: LHS of the difference.rhs
: RHS of the difference.
-
double
tme_reasoner_individual_max_penalty
(TmeReasoner *reasoner, TmeEntityPtr individual)¶ Computes the maximum penalty associated with the specified individual.
- Return
Maximum penalty.
- Parameters
reasoner
: Reasoner instance.individual
: Individual.
-
double
tme_reasoner_sem_desc_max_penalty
(TmeReasoner *reasoner, TmeSemDesc const *desc)¶ Computes the maximum penalty associated with the specified semantic description.
- Return
Maximum penalty.
- Parameters
reasoner
: Reasoner instance.desc
: Semantic description.
Normalization
-
bool
tme_sem_desc_normalize
(TmeSemDesc *desc, TmeEntityPtr bottom)¶ Performs the CNF normalization of the specified semantic description.
The description is normalized in-place.
- Return
True if the description is satisfiable, false otherwise.
- Note
The description must have been unfolded beforehand.
- Parameters
desc
: Unfolded semantic description to normalize.bottom
: Entity identifier of the bottom concept.
Subsumption
-
bool
tme_sem_desc_subsumes
(TmeSemDesc const *subsumer, TmeSemDesc const *subsumed, TmeEntityPtr bottom)¶ Determines if a subsumption relation holds between the specified semantic descriptions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.bottom
: Entity identifier of the bottom concept.
-
bool
tme_gt_role_subsumes
(TmeCardinalityRole subsumer, TmeCardinalityRole subsumed)¶ Determines if a subsumption relation holds between the specified minimum cardinality restrictions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_gt_role_subsumes_sem_desc
(TmeCardinalityRole subsumer, TmeSemDesc const *subsumed)¶ Determines if a subsumption relation holds between the specified minimum cardinality restriction and semantic description.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_lt_role_subsumes
(TmeCardinalityRole subsumer, TmeCardinalityRole subsumed)¶ Determines if a subsumption relation holds between the specified maximum cardinality restrictions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_lt_role_subsumes_sem_desc
(TmeCardinalityRole subsumer, TmeSemDesc const *subsumed)¶ Determines if a subsumption relation holds between the specified maximum cardinality restriction and semantic description.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
bool
tme_uv_role_subsumes
(TmeUniversalRole subsumer, TmeUniversalRole subsumed, TmeEntityPtr bottom)¶ Determines if a subsumption relation holds between the specified value restrictions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.bottom
: Entity identifier of the bottom concept.
-
bool
tme_uv_role_subsumes_sem_desc
(TmeUniversalRole subsumer, TmeSemDesc const *subsumed, TmeEntityPtr bottom)¶ Determines if a subsumption relation holds between the specified value restriction and semantic description.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.bottom
: Entity identifier of the bottom concept.
-
tme_gt_card_subsumes
(subsumer, subsumed)¶ Determines if a subsumption relation holds between the cardinalities of the specified minimum cardinality restrictions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
-
tme_lt_card_subsumes
(subsumer, subsumed)¶ Determines if a subsumption relation holds between the cardinalities of the specified maximum cardinality restrictions.
- Return
True if the subsumption relation holds, false otherwise.
- Parameters
subsumer
: Subsumer element in the subsumption relation.subsumed
: Subsumed element in the subsumption relation.
Satisfiability
-
bool
tme_sem_desc_is_satisfiable
(TmeSemDesc const *desc, TmeEntityPtr bottom)¶ Checks the satisfiability of the specified semantic description.
- Return
True if the semantic description is satisfiable, false otherwise.
- Parameters
desc
: Normalized semantic description.bottom
: Entity identifier of the bottom concept.
Public Functions
-
bool
tme_sem_desc_is_compatible
(TmeSemDesc const *resource, TmeSemDesc const *request, TmeEntityPtr bottom_concept)¶ Checks the compatibility between the specified resource and request.
- Return
True if the compatibility relation holds, false otherwise.
- See
- Parameters
resource
: Resource.request
: Request.bottom_concept
: Identifier of the bottom concept.
-
TmeAbduction
tme_sem_desc_abduce
(TmeSemDesc const *resource, TmeSemDesc const *request)¶ Computes the Concept Abduction between the specified resource and request.
- Return
Abduction result.
- See
- Parameters
resource
: Resource.request
: Request.
-
double
tme_sem_desc_abduction_max_penalty
(TmeSemDesc const *desc)¶ Computes the maximum penalty associated with the specified semantic description.
- Return
Maximum penalty.
- See
- Parameters
desc
: Semantic description.
-
TmeBonus
tme_sem_desc_bonus
(TmeSemDesc const *resource, TmeSemDesc const *request, TmeReasoner *reasoner)¶ Computes the Concept Bonus between the specified resource and request.
- Return
Bonus result.
- See
- Parameters
resource
: Resource.request
: Request.reasoner
: Reasoner instance.
-
TmeContraction
tme_sem_desc_contract
(TmeSemDesc const *resource, TmeSemDesc const *request, TmeReasoner *reasoner)¶ Computes the Concept Contraction between the specified resource and request.
- Return
Contraction result.
- See
- Parameters
resource
: Resource.request
: Request.reasoner
: Reasoner instance.
-
TmeComposition
tme_sem_desc_cover
(TmeSemDesc const *request, TmeKB *kb)¶ Computes the Concept Covering for the specified request.
- Return
Covering result.
- See
- Parameters
request
: Request.kb
: KB instance.
-
TmeSemDesc *
tme_sem_desc_difference
(TmeSemDesc const *lhs, TmeSemDesc const *rhs, TmeReasoner *reasoner)¶ Computes the Concept Difference between the specified semantic descriptions.
- Return
Result of the difference service.
- See
- Parameters
lhs
: LHS of the difference.rhs
: RHS of the difference.reasoner
: Reasoner instance.
-
TmeReasoner *