Create a local restriction

SHACL and OWL allow restrictions to be placed on how properties can be used by instances of a class. These are called local restrictions because they are stated on properties with respect to a particular class. This is in contrast to global OWL or RDFS statements (such as transitive or functional properties, domains and ranges) which are always in effect, irrespective of the class membership of the instance that uses the property.

In TopBraid Composer you can create local restrictions as you edit class definitions. SHACL constraints can be created using Create Property constraint... in the context menu behind the sh:property property on class forms (assuming the class is also a node shape, use the Enable SHACL constraints for this class button otherwise). OWL restrictions can be typed in using the Manchester OWL Syntax at rdfs:subClassOf or owl:equivalentClass. Composer also makes available a restriction dialog where you can select the type of restriction from a list.

Before you can create local restrictions:

Hint: If you have used Protege-OWL, you are probably familiar with such terms as Necessary and Necessary and Sufficient. Necessary is Protege's term for rdfs:subClassOf. Necessary and Sufficient is Protege's term for an owl:equivalentClass. The main thing to note here is that if you want to create multiple necessary and sufficient conditions in TopBraid Composer, then you need to combine them using an intersection class, i.e. chain them together with 'and'.

There are many ways to create a restriction, including:

  1. Click on the downfacing triangle next to either rdfs:subClassOf or owl:equivalentClass and select Add empty row, type in the restriction following the Syntax described below. Make sure to press enter or to press the 'OK' icon to the right of the entry line. By the way, you can also double-click on the rdfs:subClassOf property on the form to add an empty row.
  2. Click on the downfacing triangle next to either rdfs:subClassOf or owl:equivalentClass and select Create restriction...
  3. Drag a property you plan to restrict over the label of either the rdfs:subClassOf or owl:equivalentClass widgets on the form. This will open a Create restriction dialog with the property pre-selected.
  4. Right-Click on a property in the Domain View to open a Create restriction dialog

 

Example of Creating a Restriction using Method #1

Note in the screenshot below that the line expressing the restriction will have a red border around it until a restriction is completed using correct syntax. Auto-complete can be invoked pressing down Ctrl and Space.

In addition to the auto-complete feature Composer will provide a syntax help message. It is displayed on the left at the bottom of the Composer's screen:

After the restriction is entered, make sure to press Enter or to click on the Ok button next to the line you have been editing.

Using a Restriction Dialog (Methods #2-4)

This dialog can be invoked in many ways (see above).