Constraint Checking

Constraint checking can be activated using the corresponding tool bar button Display constraint violation warnings. If activated, TopBraid will run constraint checks on the currently selected resource, after each editing step.

Constraints must be expressed using SHACL or SPIN. This help page covers SPIN only. TopBraid's system ontology library contains pluggable SPIN libraries for common RDF Schema and OWL design patterns, in the files spinowl.ttl and spinrdfs.ttl. If your ontology imports these files, then OWL restrictions (cardinality constraints, allValuesFrom, hasValue and someValuesFrom) will be checked. Furthermore, rdfs:range will be verified. Note that OWL and RDFS have by definition different, "open-world" semantics. However, in many applications OWL restrictions are used in the closed world sense, under which they are used to enforce integrity constraints. SPIN implements those closed world semantics for pragmatic reasons.

In the following screenshot, constraint checking has been activated. The currently selected instance has two violations (of SPIN constraints). This is indicated by the yellow warning icon with a number on it, in the upper right corner of the form. Clicking on this icon shows a list of violations. If the violation can be associated to a specific property, then the property's widget will also display a (smaller) warning sign. The tool tip text of the latter provides a textual description of the warning.

A listing of all SPIN constraint violations in a model can be obtained by opening the Problems View. Refreshing the view will apply SPIN constraints to the model and display a warning for each violation.

SPIN 1.1 provides a mechanism to suggest automated fixes for constraint violations, using the spin:fix property. If a problem report is associated with fixes, then these will appear at the bottom of the drop down menu next to the property names on the forms.


If you want to process the constraint violations themselves, you can convert them to triples in two ways:

Debugging and Profiling

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