SPIN Inferencing

TopBraid Composer includes a SPIN inference engine called TopSPIN. TopSPIN can be used to infer new triples by running spin:rules over all instances in an RDF model. For any new rdf:type triples added as a result of a rule firing, the engine will also run all spin:constructors on the new instance(s). Please review the SPIN specification for technical details on how inferencing works.

As an example, the kennedys.SPIN model, delivered with TopBraid Composer installations (Project Explorer > TopBraid > Examples), defines a SPIN rule to compute the age of all instances of the class Person. The rule is defined on the spin:rule property of the class Person. To infer an age property for instances of Person, Run Inferences (with inferencing configured for TopSPIN).

TopSPIN can be configured and combined with other inference engines in the Inference > Configure Inferencing... menu item. The configuration options are whether incremental inferencing is activated and whether the engine shall do a single pass or iterate.

Incremental Inferencing

Incremental inferencing means that rules will be executed after each editing step in TopBraid Composer. For example, if you have a rule that derives age from dateOfBirth using a spin:rule, and you type in a new value for dateOfBirth, the system will automatically adjust the value for age at the current instance. Even with incremental inferencing turned on, TopBraid does not run inferences when you open a model. You need to manually trigger the first round of inferences using the inferences button.

In the current implementation of TopSPIN, incremental inferencing has been (intentionally) limited: The system will run all rules over the instances that were affected by an edit, and those rules will only be executed once, i.e. no iterative inferencing.

Single-Pass versus iterative inferencing

By default, the TopSPIN engine will iterate over all rules until no further inferences have been added in one iteration. This will make sure that interactions between rules are handled correctly. However, in many cases rules do not have interactions between them. In those cases you may want to switch to single-pass mode, in which all rules are visited only once.

Warning: If you have a rule that creates new blank nodes (with _:... as their identifier) in the CONSTRUCT clause, then the system will never stop iterating. You therefore must activate single-pass inferencing for those cases.

Explanations

After SPIN inferences have been executed, you can select each triple in the Inferences View and use the Explain ("light-bulb") button in the upper right corner of the Inferences view to get an explanation window. This window will display the rule that has inferred the triple.

SPIN Imports and OWL 2 RL inferencing

It is possible to run SPIN inferencing without formally importing SPIN files. This is explained on the Ontology Profile page.

Debugging and Profiling

In order to measure and optimize the performance of certain rules, you will find the SPIN Statistics View helpful.