SPIN’s abiilty to support inferencing is best explained with a simple exanple. The following TopBraid Composer screenshot shows an example class Person with three SPIN rules to infer the values of the age, grandFather and grandMother properties.
As you can see above, SPIN rules are basically SPARQL CONSTRUCT queries that are attached to a given class. The system variable ?this is used to refer to the current instance of the class to query and infer instance values. The first rule in the example also uses a user-defined SPARQL function getCurrentYear() which is declared in the SPIN function framework using other SPARQL functions as part of the ontology. The other two example rules (with the yellow background) are instances of a user-defined SPIN template. In the following screenshot, the (blue) value for the age property has been automatically calculated by the TopSPIN inference engine.
TopBraid’s SPIN engine has an option to execute SPIN inferences incrementally. For example, if the user changes the value of birthYear, the value for age will be updated automatically.