Resolve
RDF Terms
Data based on @zazuko/vocabularies
Defined by
DASH Data Shapes Vocabulary
Click to Copy
dash:ScriptConstraint
Click to Copy
http://datashapes.org/dash#ScriptConstraint
Namespace
Recommended prefix
Copy 'PREFIX dash: <http://datashapes.org/dash#>'
lang:""
Script constraint
lang:""
The class of constraints that are based on Scripts. Depending on whether dash:onAllValues is set to true, these scripts can access the following pre-assigned variables:
- focusNode: the focus node of the constraint (a NamedNode)
- if dash:onAllValues is not true: value: the current value node (e.g. a JavaScript string for xsd:string literals, a number for numeric literals or true or false for xsd:boolean literals. All other literals become LiteralNodes, and non-literals become instances of NamedNode)
- if dash:onAllValues is true: values: an array of current value nodes, as above.
If the expression returns an array then each array member will be mapped to one validation result, following the mapping rules below.
For string results, a validation result will use the string as sh:resultMessage.
For boolean results, a validation result will be produced if the result is false (true means no violation).
For object results, a validation result will be produced using the value of the field "message" of the object as result message. If the field "value" has a value then this will become the sh:value in the violation.
Unless another sh:message has been directly returned, the sh:message of the dash:ScriptConstraint will be used, similar to sh:message at SPARQL Constraints. These sh:messages can access the values {$focusNode}, {$value} etc as template variables.