Skip to main content

VI. Restriction layer

The restriction layer works as a primitive yet powerful tool, used to specify contextual restrictions for a given a concept. It enables the dynamic modification of property values using simple if/then/else logic.

Accumulating a set of such simple rules can create an efficient way to enforce a particular behaviour specified at the ontology level. Through the use of the restriction layer, the ontology definition is expanded beyond the definition of the structure and data formats; it allows defining of programmable data structures.

{
"$type": "restriction",
"$version": "1.0",
"$schema": "A01564DBBCB04816A9BFE5FB50723EFD3BBE119E",
"$id": "DA4B9237BACCCDF19C0760CAB7AEC4A8359010B0",
"$author": "Andrei",
"$description": "Provide schema contextual restrictions",
"restrictions": [
{
"if": "!password || !name",
"then": "active=false",
"else": "active=false"
}
]
}

The restriction layer data model schema provides a robust yet expressive mechanism to add behaviours to concepts at the ontology definition level. From a structural perspective, the model aggregates a list of restrictions.

Restriction rules are flexible constructions that contain: a restriction predicate affecting the current concept (not a specific property as in the validation layer) and custom rules regarding what should happen for each predicate’s value. When the execution of a predicate returns a valid response, the then-function executes otherwise, the else-function.

The context of the restriction functions targets the connected concept; in other words, the effect of these functions is applied to the concept instances.

In a Nutshell

If you want to add any sort of restrictions over the concept, you can do it by adding the restriction layer to the concept.

OpenfabricAI Robot
OpenfabricAI FooterOpenfabricAI Footer