shapes-ISSUE-97 (sh:derivedValues): Proposal to define constraints using derived values [SHACL Spec]

shapes-ISSUE-97 (sh:derivedValues): Proposal to define constraints using derived values [SHACL Spec]

Raised by: Holger Knublauch
On product: SHACL Spec

Simon and I have worked on a proposal to support the common scenario of "derived properties". The values of these are computed from other values in the surrounding graph. Examples include 

- the area of a rectangle must be the product of width and height
- an uncle of a person is a male sibling of a parent
- the value of ex:addressCountry must be derived from following a path ex2:address/ex2:country

The proposal is described on a branch of the spec:

For those who know SPIN, this is comparable to magic properties, but the spec describes them entirely for validation purposes, not inferencing. However, other tools may use the definition of derivedValues for other purposes. For example, we have use cases where Shapes should describe a "view" on some other data structure, flattening triples from a complex structure into a simpler structure. Many of TopQuadrant's consulting and customer projects also heavily use derived values. We believe having a standard syntax to express such derived values will open the door to many new use cases, with relatively small implementation costs. In fact it took me just a couple of hours to add support for them to my API.

NB: this feature is marked as an Advanced Feature because it relies on SPARQL. However, it could be moved into the Core if we include a simple Path vocabulary that maps to SPARQL 1.1 Property Path expressions. Such a path vocab could be put into the Appendix. The architecture is sufficiently generic to support something like sh:path, or other languages such as shjs:script.

Received on Tuesday, 29 September 2015 07:09:03 UTC