DataType Node
Last updated
Last updated
A DataType Node specifies the constraints for a literal value.
In the following the basic attributes that a DataType Node can have are listed:
Advanced constraints are introduced with this DS version. They can be used in DataType nodes for specific datatypes. Some of these constraints can have multiple entries; if that is the case, then an array is used to wrap the values.
SHACL reference: https://www.w3.org/TR/shacl/#core-components-range
These constraint components dictate a value range that the value of a literal value must have. The datatype for this value must be the same as the datatype of the constrained literal. Datatypes that are allowed to have these constraints are: Date, DateTime, Time, Number, Float, and Integer.
Example:
SHACL reference: https://www.w3.org/TR/shacl/#core-components-string
These constraint components are meant for literals having the datatype string (and their sub-datatypes in some cases).
Example of a DataType Node as range for schema:description
:
Example of a DataType Node as range for schema:telephone
:
SHACL reference: https://www.w3.org/TR/shacl/#core-components-property-pairs
These constraints are explained in Property.md since they are expressed on a property-level, and not on a data-type-level.
SHACL reference: https://www.w3.org/TR/shacl/#core-components-others
These constraints can be used on any data type.
Example:
Mapping Functions between XSD datatypes and schema.org datatypes:
(Other datatypes are ignored for now, since they are not used in practice)
key
required
value type
description
related error
sh:datatype
true
IRI
The XSD-IRI representing the datatype the value must have. Below are the mapping functions between schema.org datatypes and XSD datatypes
Non-conform range
sh:defaultValue
false
Literal
The standard value for this DataType (must be of the respective datatype). This is only a representational key-property (non-validating)
key
value type
description
related error
sh:minExclusive
same as constrained Data Type
The minimum exclusive value that the value must have
Non-conform sh:minExclusive
sh:minInclusive
same as constrained Data Type
The minimum inclusive value that the value must have
Non-conform sh:minInclusive
sh:maxExclusive
same as constrained Data Type
The maximum exclusive value that the value must have
Non-conform sh:maxExclusive
sh:maxInclusive
same as constrained Data Type
The maximum inclusive value that the value must have
Non-conform sh:maxInclusive
key
value type
description
related error
sh:maxLength
Integer
The maximum allowed string length of a literal (String or URL)
Non-conform sh:maxLength
sh:minLength
Integer
The minimum allowed string length of a literal (String or URL)
Non-conform sh:minLength
sh:pattern
[Regex]
A regular expression that the literal must match (String or URL)
Non-conform sh:pattern
sh:languageIn
[Language-Tag]
The literal must use a language tag given in the list of language tags (https://tools.ietf.org/html/bcp47) . Only for String values (in theory the exact datatype of the target literal is rdf:langString
, but due to our Schema.org <-> XSD mapping we use xsd:string
and allow a language tag for it)
Non-conform sh:languageIn
sh:uniqueLang
Boolean
The property sh:uniqueLang
can be set to true to specify that no pair of value nodes may use the same language tag. (Array of values must have unique language tags). Only for String values (in theory the exact datatype of the target literal is rdf:langString
, but due to our Schema.org <-> XSD mapping we use xsd:string
and allow a language tag for it)
Non-conform sh:uniqueLang
key
value type
description
related error
sh:in
same as constrained Data Type
Specifies the condition that each value node is a member of a provided SHACL list
Non-conform sh:in
sh:hasValue
same as constrained Data Type
Specifies the condition that at least one value node is equal to the given value
Non-conform sh:hasValue