78 
 
There are two shapes in this file, one for the Employee class and one for the Customer class. So, we 
want to expand only the Person class in the Class hierarchy view. We will start with the Employee class 
so select that class which should result in all the instances of Employee being displayed in the view 
below it.  
For the SHACL Editor we want the bottom view in the middle to take up as much screen real estate as 
possible. So, to start we can delete the two views on the far right side of the tab by clicking on the X at the 
top of each tab.  
Then drag the SHACL Editor view over to the left just enough so you can see the Employee and 
Customer classes and their instances. Your UI should look similar to figure 11.1.   
To begin examine the code in the SHACL Editor view. Note that at the beginning there are a list of 
namespaces, similar to the namespace prefixes in the SPARQL editor. After the prefixes there is the first 
actual shape which is the EmployeeShape. This shape constrains values of properties on instances of 
Employee. The sh:targetClass identifies the class that this shape is for. Beneath that are various nodes (as 
in nodes in a graph, SHACL is also represented as triples) that constrain various properties that apply to 
the Employee class. The first node constrains the cardinality of the ssn property to be exactly one 
(minCount 1 and maxCount1). The next also applies to ssn and constrains the data further than just 
saying it must be a string. It must be a string that matches the pattern: "^\\d{3}-\\d{2}-\\d{4}$" This is a 
regex expression that means the pattern must be 3 digits (numeric characters from 0-9), followed by a 
dash, followed by 2 digits, followed by a dash, followed by 4 digits.  
The next 2 nodes deal with the hasPhone data property. This property must have at least one value 
(although possibly more) and must also conform to a similar pattern of 3 digits followed by a dash 
followed by 3 digits followed by a dash followed by 4 digits. Of course, actual phone numbers can be 
more complex and varied but this is just a simple example.