Reasoning Capabilities

Ontologenius comes with a set of built-in reasoner plugins that automatically infer new knowledge from the ontology at run time. Understanding what each reasoner does (and where its boundaries lie) is key to designing ontologies that take full advantage of the system.

All reasoners are implemented as pluginlib plugins, meaning they can be loaded, activated, and deactivated dynamically without restarting the node. You can also write your own reasoner plugin by inheriting from ontologenius::ReasonerInterface. Refer to the Reasoners configuration page for how to select and configure them.

Reasoning Execution Model

Each reasoner can implement one or more of the following reasoning hooks:

Hook When it runs Typical use
postReason() After every ontology modification batch (insert, delete, …) Propagate consequences of a change as soon as it occurs
preReason() Before a query is answered Ensure the knowledge is up to date before replying. Can be used to call external processes to create "computables".
periodicReason() At a regular frequency (~100 Hz) Expensive background inference that does not need to be instantaneous
postBranchingReason() After a commit or checkout operation Ensure the ontology closure is correct after versioning operations

All inferred facts are tagged as inferred and carry an explanation (a chain of triplets that justify the inference) which can be retrieved through the API.

Reasoners at a Glance

Plugin name OWL / SWRL feature Hook On by default
ontologenius::ReasonerAnonymous OWL class expressions & equivalentClass post yes
ontologenius::ReasonerChain owl:propertyChainAxiom post yes
ontologenius::ReasonerInverseOf owl:inverseOf post yes
ontologenius::ReasonerSymmetric owl:SymmetricProperty post yes
ontologenius::ReasonerTransitivity owl:TransitiveProperty post yes
ontologenius::ReasonerRangeDomain rdfs:range / rdfs:domain post yes
ontologenius::ReasonerRule SWRL rules post yes
ontologenius::ReasonerDictionary Label normalization post yes
ontologenius::ReasonerGeneralize Property generalization (non-standard) periodic no

OWL Class Expressions (ReasonerAnonymous)

This is the most feature-rich built-in reasoner. It evaluates OWL equivalentClass axioms defined in the ontology and classifies individuals accordingly: when an individual satisfies the class expression associated with a named class, that individual is automatically asserted as a member of that class.

Supported OWL constructors

  • owl:intersectionOf : individual must satisfy all member expressions (logical AND)
  • owl:unionOf : individual must satisfy at least one member expression (logical OR)
  • owl:complementOf : individual must not satisfy the expression (logical NOT)
  • owl:oneOf : individual must be one of the enumerated individuals
  • owl:someValuesFrom : individual has at least one relation of the given property to an individual of the given class
  • owl:allValuesFrom : all values of the given property are of the given class (requires CWA, see below)
  • owl:hasValue : individual has a specific value for the given property
  • owl:minCardinality : individual has at least n values for the given property
  • owl:maxCardinality : individual has at most n values for the given property (requires CWA)
  • owl:cardinality : individual has exactly n values for the given property (requires CWA)

These constructors can be freely nested to form complex class expressions.

owl:subClassOf expressions with class expressions are also fully supported, following standard OWL semantics: since C ⊑ E means every member of C must satisfy E (but not the converse), they do not classify individuals into the class by evaluating the expression. However, when an individual is asserted as a member of the class by any other means, all proved facts deterministically implied by the expression (class memberships and property relations) are automatically applied to that individual, just as for owl:equivalentClass.

Parameter

Name Type Default Description
standard_mode bool false When set to true, disables the evaluation of allValuesFrom, maxCardinality, and cardinality constraints. This makes the reasoner purely Open-World Assumption (OWA) compliant, at the cost of losing those constraint types.

Limitations

• Only individuals can be classified; class-level subsumption (classifying a class as a subclass of another based on anonymous expressions) is not performed.

owl:allValuesFrom, owl:maxCardinality, and owl:cardinality implicitly rely on a Closed-World Assumption (CWA): they assume that relations not present in the ontology simply do not exist. Use standard_mode if your ontology follows strict OWA.

• Disjoint class axioms (owl:disjointWith) are used as a guard to prevent contradictory classification, but they do not trigger inferences themselves.

Property Chains (ReasonerChain)

Implements owl:propertyChainAxiom inference. When a sequence of object properties connects two individuals, and that sequence matches a declared chain axiom, the corresponding composed property is asserted directly between the two endpoints. Chain can be of any size.

Example: if hasParent o hasSibling → hasUncle is declared and Alice hasParent Bob, and Bob hasSibling Charlie, then Alice hasUncle Charlie is inferred.

Limitations

• Only applies to object properties between named individuals.

• The composed property is added incrementally: each postReason pass can extend chains that were created by a previous pass. This means that chains of chains may take more than one reasoning cycle to fully materialise after a single ontology update.

Inverse Properties (ReasonerInverseOf)

Implements owl:inverseOf inference. Whenever an object property relation is asserted between two individuals, the reasoner automatically adds the inverse relation.

Example: if isPartOf owl:inverseOf hasPart is declared, asserting wheel isPartOf car will also infer car hasPart wheel.

Limitations

• Only applies to object properties between named individuals.

• When a property has no direct owl:inverseOf declaration but inherits one from a parent property, the reasoner walks up the hierarchy to find the lowest declared inverse. If the hierarchy is deep, the inverse used may be a more general property than expected.

Symmetric Properties (ReasonerSymmetric)

Implements owl:SymmetricProperty inference. For every relation asserted through a symmetric property, the reversed relation is automatically added.

Example: if isSiblingOf is declared as symmetric, asserting Alice isSiblingOf Bob will also infer Bob isSiblingOf Alice.

Limitations

• Only applies to object properties between named individuals.

• When a property is not directly declared as symmetric but has a symmetric ancestor in the property hierarchy, the reasoner walks up the hierarchy and applies the symmetric ancestor property, not the original property.

Transitive Properties (ReasonerTransitivity)

Implements owl:TransitiveProperty inference. Given a chain of relations through a transitive property, all shortcut relations are materialised.

Example: if isLocatedIn is transitive, and Paris isLocatedIn France and France isLocatedIn Europe, then Paris isLocatedIn Europe is inferred.

Limitations

• Only applies to object properties between named individuals.

• Just like property chains, transitive closure is computed incrementally: a chain that grows step by step may need several reasoning cycles after a single update.

• In a deeply nested transitivity graph, the number of inferred relations can grow quadratically with the chain length. Keep transitivity chains short when performance matters.

Range and Domain (ReasonerRangeDomain)

Implements rdfs:domain and rdfs:range inference. When an object or data property relation is asserted on an individual, the reasoner uses the property's declared domain and range to infer class memberships.

Example: if hasChild rdfs:domain Person and hasChild rdfs:range Person are declared, asserting Alice hasChild Bob will infer both Alice and Bob are instances of Person.

Domain and range inference also works for data properties: if a data property has a declared domain, assigning any literal value to an individual through that property will infer the individual's class membership.

Domain and range constraints are applied for the property and all its ancestor properties in the property hierarchy, using the most specific applicable constraint found.

Limitations

• Only class memberships of individuals are inferred. No cross-property inference is performed (e.g., inferring a new property from a domain/range violation).

• Range inference is only applied to object properties. Data property range (the datatype itself) is not used to infer individual classifications.

rdfs:domain / rdfs:range axioms that reference complex class expressions (anonymous classes) are not resolved by this reasoner alone, the ReasonerAnonymous reasoner handles those.

SWRL Rules (ReasonerRule)

Evaluates SWRL (Semantic Web Rule Language) rules embedded in the ontology. Rules consist of a body (antecedent) and a head (consequent). The reasoner finds all variable bindings that satisfy the body and applies the consequent for each solution.

Three types of atoms are supported in both the body and the head:

  • Class atoms : ClassName(?x) tests or asserts individual class membership
  • Object property atoms : propName(?x, ?y) tests or asserts an object relation
  • Data property atoms dataPropName(?x, ?v) tests or asserts a data relation

The following built-in predicates are available for use in the rule body:

  • Numerical comparisons: swrlb:greaterThan, swrlb:greaterThanOrEqual, swrlb:lessThan, swrlb:lessThanOrEqual, swrlb:equal, swrlb:notEqual
  • String comparisons: swrlb:equal, swrlb:notEqual

Inference supports the full property hierarchy: a rule matching hasAnimal(?x, ?y) will also fire for relations asserted through any sub-property of hasAnimal.

Parameter

Name Type Default Description
standard_mode bool false Reserved for future use (mirrors the parameter of ReasonerAnonymous for consistency).

Limitations

• Rules operate on named individuals only. There is no support for blank nodes or variable-length paths in the rule body.

• Only a subset of SWRL built-ins is currently implemented: numerical and string equality/inequality and ordering. Built-ins such as swrlb:stringConcat, swrlb:matches, etc. are not supported.

• The rule head can assert class memberships, object relations, and data relations. It cannot retract facts, assert same-as, or fire actions outside the ontology.

• Rule evaluation is exhaustive over every stored rule on every postReason cycle. Rules with wide-ranging patterns (e.g., free variables ranging over all individuals) can become expensive at scale.

Dictionary Normalization (ReasonerDictionary)

This reasoner is not an OWL inference engine in the traditional sense, but it is a key component for natural-language-based querying. It automatically derives normalized alternative labels for every entity (classes, individuals, and properties) from their declared rdfs:label annotations.

The following transformations are applied:

  • CamelCase splitting : redApplered apple
  • Underscore splitting : red_applered apple
  • Lower-case variant : RedAppleredapple
  • Quote normalisation : replaces typographic quotes with standard ASCII quotes

Parameter

Name Type Default Description
use_id bool false When set to true, the entity's local IRI identifier is also registered as an English label when no rdfs:label is declared. Useful for ontologies that rely on meaningful identifiers rather than annotations.

Limitations

• Transformations are applied once per entity (flagged to avoid re-processing). Labels added after the first reasoning pass will not receive the normalized variants unless the flag is cleared.

• The splitting heuristics are based on character-level rules. They work well for standard CamelCase and snake_case identifiers but may produce unexpected splits on abbreviations or identifiers with mixed conventions.

Property Generalization (ReasonerGeneralize)

This is a non-standard, heuristic reasoner that is not active by default. It observes the property usage of individuals belonging to a class and infers class-level property assertions when enough individuals share the same pattern.

Concretely, it works as follows: for a given class, it collects all data and object property relations declared on the individuals and sub-classes of that class. If a property/value pair appears in at least min_count sub-members and in at least min_percent of them, the relation is promoted to the class level as an inferred fact.

This is useful for acquiring knowledge about typical class behaviour from instance-level data, analogous to a simple form of inductive learning.

Parameters

Name Type Default Description
min_count integer 2 Minimum number of sub-members that must exhibit the property/value pair for it to be generalised.
min_percent float [0–1] 0.75 Minimum proportion of sub-members (among those considered) that must exhibit the pair.

Limitations

• The reasoner should be considered as an example of custom reasoning process that can be created with Ontoogenius.

• This reasoner is not logically sound in the OWL sense: it performs statistical generalisation, not deductive inference. Inferred facts at the class level reflect a tendency, not a guarantee.

• It runs periodically (processing a small batch of classes per cycle) rather than reactively. New individuals or relations may take several seconds before the generalization is applied.

• Only direct sub-members (individuals and immediate sub-classes at depth 1) are considered. Deep inheritance trees are not fully taken into account.

• Object property generalisation groups relations by property only (not by the specific target individual), so the generalised fact records the most common target class, not a specific individual.