If you are creating or modifying ontologies with TopBraid EDG, you may wonder “What are property shapes and how are they different from properties?”. 

All data captured by EDG is stored in its graph database. Graph are formed by linking together simple fact or sentence statements. Each statement has 3 elements in it: subject, predicate and object – in this specific order. Since there are 3 elements in each statement it is called a triple. 

There are several standard text formats for writing these triples down. In the examples below, we will use the most popular text format called Turtle.

Subject and predicate in a triple statement are resources identified by their URIs such as country:CountryCode-US, enterprise:iso3166NumericCode or rdfs:label.  For readability, Turtle lets us use an abbreviated form of the URIs with prefix standing for the namespace. For example, rdfs: prefix is standing for http://www.w3.org/2000/01/rdf-schema

Objects in a triple statement can be URIs or literal values such as strings.

What is a Property?

A property is a resource that is used as a predicate in these statements. For example, in the following statement rdfs:label is a predicate and, thus, the property:

country:CountryCode-US rdfs:label “United States of America”@en.

And in the next statement, enterprise:iso3166NumericCode is the property.

country:CountryCode-US enterprise:iso3166NumericCode “840”.

What is a Property Shape Then?

A property shape is a special resource in an ontology that describes values of a given property. For example, the following 4 statements declare a property shape for the enterprise:iso3166NumericCode property and say that the property values must be strings no longer than 3 characters.

enterprise:Country-iso3166NumericCode a sh:PropertyShape.
enterprise:Country-iso3166NumericCode sh:path enterprise:iso3166NumericCode.
enterprise:Country-iso3166NumericCode sh:datatype xsd:string.
enterprise:Country-iso3166NumericCode sh:maxLength 3.

sh:path is used as a predicate in a statement that identifies a property we are talking about – enterprise:iso3166NumericCode. Identity of the property shape itself is enterprise:Country-iso3166NumericCode. If we wanted to say that the property values must be integers, we would use the following:

enterprise:Country-iso3166NumericCode a sh:PropertyShape.
enterprise:Country-iso3166NumericCode sh:path enterprise:iso3166NumericCode.
enterprise:Country-iso3166NumericCode sh:datatype xsd:integer.

Potentially, the same property can be used in different contexts. So, to say that the enterprise:Country-iso3166NumericCode property shape defines values for members of a class enterprise:Country, we use the following:

enterprise:Country a owl:Class.
enterprise:Country a sh:NodeSape.
enterprise:Country sh:property enterprise:Country-iso3166NumericCode.

The property shape enterprise:Country-iso3166NumericCode is used as an object in the third statement in the above text snippet. The class enterprise:Country is used as a subject and the predicate is sh:property. This says that the shape definition in enterprise:Country-iso3166NumericCode will be used for members of the class enterprise:Country.

Using Property Shapes in TopBraid EDG

When you click on a class in TopBraid EDG, you will see (and be able to access) associated property shapes in either of the two panels: in the Property Group panel and in the Form panel that displays class information. This is shown in the screenshot below.

If you click on any of the property shapes, you will see its information, including identity of a property which values it is describing.

When you click on the + button on the Form or on any of the Create new options in the Property Groups panel, you will be creating a new property shape. You do not need to create a property separately, the create dialog for a property shape will simply refer to the property. We do not need any definitions for the property other than a reference to its identity in the property shape. All other information can be provided in the shape itself. This includes a display name for the property, where it should be positioned on a form, etc.

Or, if a property is already pre-defined with, possibly, some information about it (such as its label), you can select it in the Create dialog.

Using Properties in TopBraid EDG

You will see properties as fields on forms when creating new data in TopBraid EDG. For example, the form for United States (shown below) has a field for the ISO numeric code.

When you upload data into TopBraid EDG or access it through APIs, you will be able to request and update values of the properties defined by the property shapes. This shown in the GraphQL screenshots below.

Advanced Property Shapes

So far we have described a simple scenario, but property shapes can get even more interesting!

As described in this blog, a property shape can refer to a specific predicate/property. It can also:

  • Refer to the use of a property in inverse direction. 
  • Be used to point to a value that is multiple hops away from a resource we are working with. 
  • Be backed by a calculation or some other action that generates a value for a property.

Let us know if you want to see a blog on the more advanced use of property shapes!