class InferenceModel


Module soprano
Namespace Soprano::Inference
Class InferenceModel
Inherits Soprano::FilterModel
\class InferenceModel inferencemodel.h Soprano/Inference/InferenceModel

The Soprano Inference Model provides a simple forward chaining inference engine which uses the underlying parent model itself to store status information.

The InferenceModel does perfect inference which means that removing of statements is supported and results in a perfect update of the infered statements. There is only one exception: If a model contains two statements in different named graphs that both have the same subject, predicate, and object and trigger one rule then if one of these statements is removed the infered statements are removed, too, although the second statement would still make the infered one valid. This situation gets resolved once the same rule is triggered again by some other added statement or performInference gets called.

The inference is performed based on rules which are stored in Rule instances. Rules can be created manually or parsed using a RuleParser.

The inference engine works roughly as follows:

Whenever a new statement is added it is compared to each rule to check if it could trigger this rule. Then if it could trigger a rule this rule is applied to the whole model.

If a rule produces a new infered statement the following data is created:

  • named graph A containing the infered statements
  • the statements that triggered the rule are stored in named graph sil:InferenceMetadata as
  • source statements of A (sil:sourceStatement). The inference model supports two ways of storing source statements: plain and compressed (see setCompressedSourceStatements).

    Thus, when removing a statement it can easily be checked if this statement had been used to infer another one by querying all named graphs that have this statement as a source statement.

    Author Sebastian Trueg



    methods