diff --git a/docs/Requirements.md b/docs/Requirements.md
index 1829c39..69b6b57 100644
--- a/docs/Requirements.md
+++ b/docs/Requirements.md
@@ -56,12 +56,14 @@ The extraction of these requirements is based on the [ODRL 2.2 information model
- R44: Each element of a LogicalConstraint must be a valid Constraint - Violation - [Wiki V19](https://www.w3.org/2016/poe/wiki/Validation#V19._The_values_of_every_logical_constraint_must_be_constraints)
### Constraint operator compatibility
+Each XSD datatype also includes its subtypes (e.g. xsd:integer is an xsd:decimal), see https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes.
+
- R45: odrl:absolutePosition is only compatible with eq, gt, gteq, lt, lteq, neq - Violation - **New**
- R46: odrl:absoluteSpatialPosition is only compatible with comparison operators - Violation - **New**
- R47: odrl:absoluteTemporalPosition is only compatible with comparison operators - Violation - **New**
- R48: odrl:absoluteSize is only compatible with comparison operators - Violation - **New**
- R49: odrl:count is only compatible with comparison operators - Violation - **New**
-- R50: The rightOperand for odrl:count must be an xsd:integer - Violation - **New**
+- R50: The rightOperand for odrl:count must be an xsd:integer, not negative - Violation - **New**
- R51: odrl:dateTime is only compatible with comparison operators - Violation - **New**
- R52: The rightOperand for odrl:dateTime must be xsd:date or xsd:dateTime - Violation - **New**
- R53: odrl:delayPeriod is only compatible with eq, gt, gteq - Violation - **New**
@@ -98,7 +100,7 @@ The extraction of these requirements is based on the [ODRL 2.2 information model
- R84: odrl:relativeSize is only compatible with comparison operators - Violation - **New**
- R85: odrl:resolution is only compatible with comparison operators - Violation - **New**
- R86: odrl:spatial is only compatible with eq, neq, isAnyOf, isNoneOf - Violation - **New**
-- R87: The rightOperand for odrl:spatial must be an IRI - Violation - **New**
+- R87: The rightOperand for odrl:spatial must be an IRI or a list of IRIs - Violation - **New**
- R88: odrl:spatialCoordinates is only compatible with eq, neq - Violation - **New**
- R89: odrl:systemDevice is only compatible with eq, neq, isAnyOf, isNoneOf - Violation - **New**
- R90: The rightOperand for odrl:systemDevice must be an IRI or a string - Warning - **New**
diff --git a/src/shapes/Shapes.ts b/src/shapes/Shapes.ts
index e8e2405..e1d8b32 100644
--- a/src/shapes/Shapes.ts
+++ b/src/shapes/Shapes.ts
@@ -1103,7 +1103,7 @@ export const SHAPES: string = `@prefix odrl: .
a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
sh:targetSubjectsOf odrl:leftOperand ;
- sh:message "The rightOperand of odrl:count must be an xsd:integer." ;
+ sh:message "The rightOperand of odrl:count must be an xsd:integer, not negative." ;
sh:severity sh:Violation ;
sh:or ([
sh:not [
@@ -1112,7 +1112,37 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
+ sh:node ;
+ sh:minInclusive 0
+ ]) .
+
+ a sh:NodeShape ;
+ sh:or ([
sh:datatype xsd:integer
+ ] [
+ sh:datatype xsd:long
+ ] [
+ sh:datatype xsd:int
+ ] [
+ sh:datatype xsd:short
+ ] [
+ sh:datatype xsd:byte
+ ] [
+ sh:datatype xsd:nonNegativeInteger
+ ] [
+ sh:datatype xsd:positiveInteger
+ ] [
+ sh:datatype xsd:unsignedLong
+ ] [
+ sh:datatype xsd:unsignedInt
+ ] [
+ sh:datatype xsd:unsignedShort
+ ] [
+ sh:datatype xsd:unsignedByte
+ ] [
+ sh:datatype xsd:nonPositiveInteger
+ ] [
+ sh:datatype xsd:negativeInteger
]) .
a sh:NodeShape ;
@@ -1127,11 +1157,16 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:or ([
- sh:datatype xsd:date
- ] [
- sh:datatype xsd:dateTime
- ])
+ sh:node
+ ]) .
+
+ a sh:NodeShape ;
+ sh:or ([
+ sh:datatype xsd:date
+ ] [
+ sh:datatype xsd:dateTime
+ ] [
+ sh:datatype xsd:dateTimeStamp
]) .
a sh:NodeShape ;
@@ -1146,7 +1181,16 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
+ sh:node
+ ]) .
+
+ a sh:NodeShape ;
+ sh:or ([
sh:datatype xsd:duration
+ ] [
+ sh:datatype xsd:dayTimeDuration
+ ] [
+ sh:datatype xsd:yearMonthDuration
]) .
a sh:NodeShape ;
@@ -1164,12 +1208,35 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
]) .
+ a sh:NodeShape ;
+ sh:or ([
+ sh:datatype xsd:string
+ ] [
+ sh:datatype xsd:normalizedString
+ ] [
+ sh:datatype xsd:token
+ ] [
+ sh:datatype xsd:language
+ ] [
+ sh:datatype xsd:Name
+ ] [
+ sh:datatype xsd:NCName
+ ] [
+ sh:datatype xsd:ENTITY
+ ] [
+ sh:datatype xsd:ID
+ ] [
+ sh:datatype xsd:IDREF
+ ] [
+ sh:datatype xsd:NMTOKEN
+ ]) .
+
a sh:NodeShape ;
sh:property [
sh:path ([
@@ -1178,7 +1245,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
])
] ;
sh:node .
@@ -1195,7 +1262,7 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:datatype xsd:duration
+ sh:node
]) .
a sh:NodeShape ;
@@ -1213,7 +1280,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
])
]) .
@@ -1232,7 +1299,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1253,7 +1320,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1272,7 +1339,7 @@ export const SHAPES: string = `@prefix odrl: .
] [
sh:path odrl:rightOperand ;
sh:or ([
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1283,7 +1350,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:path ([
sh:zeroOrMorePath rdf:rest
] rdf:first) ;
- sh:datatype xsd:string
+ sh:node
] ;
sh:node .
@@ -1300,7 +1367,7 @@ export const SHAPES: string = `@prefix odrl: .
] [
sh:path odrl:rightOperand ;
sh:or ([
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1318,7 +1385,7 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:datatype xsd:duration
+ sh:node
]) .
a sh:NodeShape ;
@@ -1333,7 +1400,14 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
+ sh:node
+ ]) .
+
+ a sh:NodeShape ;
+ sh:or ([
sh:datatype xsd:decimal
+ ] [
+ sh:node
]) .
a sh:NodeShape ;
@@ -1348,7 +1422,7 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:datatype xsd:decimal ;
+ sh:node ;
sh:minInclusive 0 ;
sh:maxInclusive 100
]) .
@@ -1368,7 +1442,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1389,7 +1463,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1410,7 +1484,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1419,7 +1493,7 @@ export const SHAPES: string = `@prefix odrl: .
a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
sh:targetSubjectsOf odrl:leftOperand ;
- sh:message "The rightOperand of odrl:spatial must be an IRI." ;
+ sh:message "The rightOperand of odrl:spatial must be an IRI or a list of IRIs." ;
sh:severity sh:Violation ;
sh:or ([
sh:not [
@@ -1427,10 +1501,23 @@ export const SHAPES: string = `@prefix odrl: .
sh:hasValue odrl:spatial
]
] [
- sh:nodeKind sh:IRI ;
- sh:path odrl:rightOperand
+ sh:path odrl:rightOperand ;
+ sh:or ([
+ sh:nodeKind sh:IRI
+ ] [
+ sh:node
+ ])
]) .
+ a sh:NodeShape ;
+ sh:property [
+ sh:nodeKind sh:IRI ;
+ sh:path ([
+ sh:zeroOrMorePath rdf:rest
+ ] rdf:first)
+ ] ;
+ sh:node .
+
a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
sh:targetSubjectsOf odrl:leftOperand ;
@@ -1446,7 +1533,7 @@ export const SHAPES: string = `@prefix odrl: .
sh:or ([
sh:nodeKind sh:IRI
] [
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1464,7 +1551,7 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:datatype xsd:duration
+ sh:node
]) .
a sh:NodeShape ;
@@ -1479,7 +1566,7 @@ export const SHAPES: string = `@prefix odrl: .
]
] [
sh:path odrl:rightOperand ;
- sh:datatype xsd:string
+ sh:node
]) .
a sh:NodeShape ;
@@ -1495,7 +1582,7 @@ export const SHAPES: string = `@prefix odrl: .
] [
sh:path odrl:rightOperand ;
sh:or ([
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
@@ -1514,7 +1601,7 @@ export const SHAPES: string = `@prefix odrl: .
] [
sh:path odrl:rightOperand ;
sh:or ([
- sh:datatype xsd:string
+ sh:node
] [
sh:node
])
diff --git a/src/shapes/modules/08-odrl-constraint-right-operands.ttl b/src/shapes/modules/08-odrl-constraint-right-operands.ttl
index 46c4793..2c9211a 100644
--- a/src/shapes/modules/08-odrl-constraint-right-operands.ttl
+++ b/src/shapes/modules/08-odrl-constraint-right-operands.ttl
@@ -2,7 +2,7 @@
# RightOperand datatype per leftOperand
#################################################
-# R50: the rightOperand of odrl:count must be an xsd:integer
+# R50: the rightOperand of odrl:count must be an xsd:integer, not negative
:CountRightOperandShape a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
@@ -10,9 +10,9 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:count ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:integer ]
+ [ sh:path odrl:rightOperand ; sh:node :IntegerShape ; sh:minInclusive 0 ]
) ;
- sh:message "The rightOperand of odrl:count must be an xsd:integer." .
+ sh:message "The rightOperand of odrl:count must be an xsd:integer, not negative." .
# R52: the rightOperand of odrl:dateTime must be an xsd:date or xsd:dateTime
@@ -23,7 +23,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:dateTime ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:date ] [ sh:datatype xsd:dateTime ] ) ]
+ [ sh:path odrl:rightOperand ; sh:node :DateTimeShape ]
) ;
sh:message "The rightOperand of odrl:dateTime must be an xsd:date or xsd:dateTime." .
@@ -36,7 +36,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:delayPeriod ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:delayPeriod must be an xsd:duration." .
@@ -49,7 +49,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:deliveryChannel ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:deliveryChannel should be an IRI, a string, or a list of these." .
@@ -62,7 +62,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:elapsedTime ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:elapsedTime must be an xsd:duration." .
@@ -75,7 +75,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:event ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] ) ]
) ;
sh:message "The rightOperand of odrl:event should be an IRI or a string." .
@@ -88,7 +88,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:fileFormat ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:fileFormat should be an IRI, a string, or a list of these." .
@@ -101,7 +101,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:industry ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:industry should be an IRI, a string, or a list of these." .
@@ -114,7 +114,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:language ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:language should be a string or a list of strings." .
@@ -127,7 +127,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:media ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:media should be a string or a list of strings." .
@@ -140,7 +140,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:meteredTime ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:meteredTime must be an xsd:duration." .
@@ -153,7 +153,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:payAmount ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:decimal ]
+ [ sh:path odrl:rightOperand ; sh:node :DecimalShape ]
) ;
sh:message "The rightOperand of odrl:payAmount must be an xsd:decimal." .
@@ -166,7 +166,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:percentage ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 100 ]
+ [ sh:path odrl:rightOperand ; sh:node :DecimalShape ; sh:minInclusive 0 ; sh:maxInclusive 100 ]
) ;
sh:message "The rightOperand of odrl:percentage must be an xsd:decimal from 0 to 100." .
@@ -179,7 +179,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:product ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:product should be an IRI, a string, or a list of these." .
@@ -192,7 +192,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:purpose ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:purpose should be an IRI, a string, or a list of these." .
@@ -205,12 +205,12 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:recipient ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:recipient should be an IRI, a string, or a list of these." .
-# R87: the rightOperand of odrl:spatial must be an IRI
+# R87: the rightOperand of odrl:spatial must be an IRI or a list of IRIs
:SpatialRightOperandShape a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
@@ -218,9 +218,9 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:spatial ] ]
- [ sh:path odrl:rightOperand ; sh:nodeKind sh:IRI ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :IriListShape ] ) ]
) ;
- sh:message "The rightOperand of odrl:spatial must be an IRI." .
+ sh:message "The rightOperand of odrl:spatial must be an IRI or a list of IRIs." .
# R90: the rightOperand of odrl:systemDevice must be an IRI or a string
@@ -231,7 +231,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:systemDevice ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:systemDevice should be an IRI, a string, or a list of these." .
@@ -244,7 +244,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:timeInterval ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:timeInterval must be an xsd:duration." .
@@ -257,7 +257,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:unitOfCount ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:string ]
+ [ sh:path odrl:rightOperand ; sh:node :StringShape ]
) ;
sh:message "The rightOperand of odrl:unitOfCount should be a string." .
@@ -270,7 +270,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:version ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:version should be a string or a list of strings." .
@@ -283,7 +283,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:virtualLocation ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:virtualLocation should be a string or a list of strings." .
@@ -294,7 +294,15 @@
sh:node :RdfListShape ;
sh:property [
sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
- sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] ) ;
+ sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] ) ;
+ ] .
+
+# An RDF list whose members are IRIs
+:IriListShape a sh:NodeShape ;
+ sh:node :RdfListShape ;
+ sh:property [
+ sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
+ sh:nodeKind sh:IRI ;
] .
# An RDF list whose members are strings
@@ -302,5 +310,63 @@
sh:node :RdfListShape ;
sh:property [
sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
- sh:datatype xsd:string ;
- ] .
\ No newline at end of file
+ sh:node :StringShape ;
+ ] .
+
+# Subtypes: https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes
+
+# xsd:decimal and subtypes
+:DecimalShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:decimal ]
+ [ sh:node :IntegerShape ]
+ ) .
+
+# xsd:integer and subtypes
+:IntegerShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:integer ]
+ [ sh:datatype xsd:long ]
+ [ sh:datatype xsd:int ]
+ [ sh:datatype xsd:short ]
+ [ sh:datatype xsd:byte ]
+ [ sh:datatype xsd:nonNegativeInteger ]
+ [ sh:datatype xsd:positiveInteger ]
+ [ sh:datatype xsd:unsignedLong ]
+ [ sh:datatype xsd:unsignedInt ]
+ [ sh:datatype xsd:unsignedShort ]
+ [ sh:datatype xsd:unsignedByte ]
+ [ sh:datatype xsd:nonPositiveInteger ]
+ [ sh:datatype xsd:negativeInteger ]
+ ) .
+
+# xsd:date, xsd:dateTime and subtypes
+:DateTimeShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:date ]
+ [ sh:datatype xsd:dateTime ]
+ [ sh:datatype xsd:dateTimeStamp ]
+ ) .
+
+# xsd:duration and subtypes
+:DurationShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:duration ]
+ [ sh:datatype xsd:dayTimeDuration ]
+ [ sh:datatype xsd:yearMonthDuration ]
+ ) .
+
+# xsd:string and subtypes
+:StringShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:string ]
+ [ sh:datatype xsd:normalizedString ]
+ [ sh:datatype xsd:token ]
+ [ sh:datatype xsd:language ]
+ [ sh:datatype xsd:Name ]
+ [ sh:datatype xsd:NCName ]
+ [ sh:datatype xsd:ENTITY ]
+ [ sh:datatype xsd:ID ]
+ [ sh:datatype xsd:IDREF ]
+ [ sh:datatype xsd:NMTOKEN ]
+ ) .
diff --git a/src/shapes/odrl-shapes.ttl b/src/shapes/odrl-shapes.ttl
index 71475fc..129c0fb 100644
--- a/src/shapes/odrl-shapes.ttl
+++ b/src/shapes/odrl-shapes.ttl
@@ -1299,7 +1299,7 @@
# RightOperand datatype per leftOperand
#################################################
-# R50: the rightOperand of odrl:count must be an xsd:integer
+# R50: the rightOperand of odrl:count must be an xsd:integer, not negative
:CountRightOperandShape a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
@@ -1307,9 +1307,9 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:count ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:integer ]
+ [ sh:path odrl:rightOperand ; sh:node :IntegerShape ; sh:minInclusive 0 ]
) ;
- sh:message "The rightOperand of odrl:count must be an xsd:integer." .
+ sh:message "The rightOperand of odrl:count must be an xsd:integer, not negative." .
# R52: the rightOperand of odrl:dateTime must be an xsd:date or xsd:dateTime
@@ -1320,7 +1320,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:dateTime ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:date ] [ sh:datatype xsd:dateTime ] ) ]
+ [ sh:path odrl:rightOperand ; sh:node :DateTimeShape ]
) ;
sh:message "The rightOperand of odrl:dateTime must be an xsd:date or xsd:dateTime." .
@@ -1333,7 +1333,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:delayPeriod ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:delayPeriod must be an xsd:duration." .
@@ -1346,7 +1346,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:deliveryChannel ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:deliveryChannel should be an IRI, a string, or a list of these." .
@@ -1359,7 +1359,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:elapsedTime ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:elapsedTime must be an xsd:duration." .
@@ -1372,7 +1372,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:event ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] ) ]
) ;
sh:message "The rightOperand of odrl:event should be an IRI or a string." .
@@ -1385,7 +1385,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:fileFormat ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:fileFormat should be an IRI, a string, or a list of these." .
@@ -1398,7 +1398,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:industry ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:industry should be an IRI, a string, or a list of these." .
@@ -1411,7 +1411,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:language ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:language should be a string or a list of strings." .
@@ -1424,7 +1424,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:media ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:media should be a string or a list of strings." .
@@ -1437,7 +1437,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:meteredTime ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:meteredTime must be an xsd:duration." .
@@ -1450,7 +1450,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:payAmount ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:decimal ]
+ [ sh:path odrl:rightOperand ; sh:node :DecimalShape ]
) ;
sh:message "The rightOperand of odrl:payAmount must be an xsd:decimal." .
@@ -1463,7 +1463,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:percentage ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 100 ]
+ [ sh:path odrl:rightOperand ; sh:node :DecimalShape ; sh:minInclusive 0 ; sh:maxInclusive 100 ]
) ;
sh:message "The rightOperand of odrl:percentage must be an xsd:decimal from 0 to 100." .
@@ -1476,7 +1476,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:product ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:product should be an IRI, a string, or a list of these." .
@@ -1489,7 +1489,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:purpose ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:purpose should be an IRI, a string, or a list of these." .
@@ -1502,12 +1502,12 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:recipient ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:recipient should be an IRI, a string, or a list of these." .
-# R87: the rightOperand of odrl:spatial must be an IRI
+# R87: the rightOperand of odrl:spatial must be an IRI or a list of IRIs
:SpatialRightOperandShape a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
@@ -1515,9 +1515,9 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:spatial ] ]
- [ sh:path odrl:rightOperand ; sh:nodeKind sh:IRI ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :IriListShape ] ) ]
) ;
- sh:message "The rightOperand of odrl:spatial must be an IRI." .
+ sh:message "The rightOperand of odrl:spatial must be an IRI or a list of IRIs." .
# R90: the rightOperand of odrl:systemDevice must be an IRI or a string
@@ -1528,7 +1528,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:systemDevice ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] [ sh:node :IriOrStringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] [ sh:node :IriOrStringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:systemDevice should be an IRI, a string, or a list of these." .
@@ -1541,7 +1541,7 @@
sh:severity sh:Violation ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:timeInterval ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:duration ]
+ [ sh:path odrl:rightOperand ; sh:node :DurationShape ]
) ;
sh:message "The rightOperand of odrl:timeInterval must be an xsd:duration." .
@@ -1554,7 +1554,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:unitOfCount ] ]
- [ sh:path odrl:rightOperand ; sh:datatype xsd:string ]
+ [ sh:path odrl:rightOperand ; sh:node :StringShape ]
) ;
sh:message "The rightOperand of odrl:unitOfCount should be a string." .
@@ -1567,7 +1567,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:version ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:version should be a string or a list of strings." .
@@ -1580,7 +1580,7 @@
sh:severity sh:Warning ;
sh:or (
[ sh:not [ sh:path odrl:leftOperand ; sh:hasValue odrl:virtualLocation ] ]
- [ sh:path odrl:rightOperand ; sh:or ( [ sh:datatype xsd:string ] [ sh:node :StringListShape ] ) ]
+ [ sh:path odrl:rightOperand ; sh:or ( [ sh:node :StringShape ] [ sh:node :StringListShape ] ) ]
) ;
sh:message "The rightOperand of odrl:virtualLocation should be a string or a list of strings." .
@@ -1591,7 +1591,15 @@
sh:node :RdfListShape ;
sh:property [
sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
- sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype xsd:string ] ) ;
+ sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node :StringShape ] ) ;
+ ] .
+
+# An RDF list whose members are IRIs
+:IriListShape a sh:NodeShape ;
+ sh:node :RdfListShape ;
+ sh:property [
+ sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
+ sh:nodeKind sh:IRI ;
] .
# An RDF list whose members are strings
@@ -1599,5 +1607,63 @@
sh:node :RdfListShape ;
sh:property [
sh:path ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) ;
- sh:datatype xsd:string ;
+ sh:node :StringShape ;
] .
+
+# Subtypes: https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes
+
+# xsd:decimal and subtypes
+:DecimalShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:decimal ]
+ [ sh:node :IntegerShape ]
+ ) .
+
+# xsd:integer and subtypes
+:IntegerShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:integer ]
+ [ sh:datatype xsd:long ]
+ [ sh:datatype xsd:int ]
+ [ sh:datatype xsd:short ]
+ [ sh:datatype xsd:byte ]
+ [ sh:datatype xsd:nonNegativeInteger ]
+ [ sh:datatype xsd:positiveInteger ]
+ [ sh:datatype xsd:unsignedLong ]
+ [ sh:datatype xsd:unsignedInt ]
+ [ sh:datatype xsd:unsignedShort ]
+ [ sh:datatype xsd:unsignedByte ]
+ [ sh:datatype xsd:nonPositiveInteger ]
+ [ sh:datatype xsd:negativeInteger ]
+ ) .
+
+# xsd:date, xsd:dateTime and subtypes
+:DateTimeShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:date ]
+ [ sh:datatype xsd:dateTime ]
+ [ sh:datatype xsd:dateTimeStamp ]
+ ) .
+
+# xsd:duration and subtypes
+:DurationShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:duration ]
+ [ sh:datatype xsd:dayTimeDuration ]
+ [ sh:datatype xsd:yearMonthDuration ]
+ ) .
+
+# xsd:string and subtypes
+:StringShape a sh:NodeShape ;
+ sh:or (
+ [ sh:datatype xsd:string ]
+ [ sh:datatype xsd:normalizedString ]
+ [ sh:datatype xsd:token ]
+ [ sh:datatype xsd:language ]
+ [ sh:datatype xsd:Name ]
+ [ sh:datatype xsd:NCName ]
+ [ sh:datatype xsd:ENTITY ]
+ [ sh:datatype xsd:ID ]
+ [ sh:datatype xsd:IDREF ]
+ [ sh:datatype xsd:NMTOKEN ]
+ ) .
diff --git a/test/unit/ConstraintShapes.test.ts b/test/unit/ConstraintShapes.test.ts
index d920fd7..aa9a3d7 100644
--- a/test/unit/ConstraintShapes.test.ts
+++ b/test/unit/ConstraintShapes.test.ts
@@ -8,7 +8,7 @@ const MESSAGES = {
R47: 'odrl:absoluteTemporalPosition is only compatible with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
R48: 'odrl:absoluteSize is only compatible with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
R49: 'odrl:count is only compatible with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
- R50: 'The rightOperand of odrl:count must be an xsd:integer.',
+ R50: 'The rightOperand of odrl:count must be an xsd:integer, not negative.',
R51: 'odrl:dateTime must only be used with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
R52: 'The rightOperand of odrl:dateTime must be an xsd:date or xsd:dateTime.',
R53: 'odrl:delayPeriod must only be used with odrl:eq, odrl:gt or odrl:gteq.',
@@ -45,7 +45,7 @@ const MESSAGES = {
R84: 'odrl:relativeSize must only be used with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
R85: 'odrl:resolution must only be used with comparison operators odrl:eq, odrl:gt, odrl:gteq, odrl:lt, odrl:lteq or odrl:neq.',
R86: 'odrl:spatial must only be used with odrl:eq, odrl:neq, odrl:isAnyOf or odrl:isNoneOf.',
- R87: 'The rightOperand of odrl:spatial must be an IRI.',
+ R87: 'The rightOperand of odrl:spatial must be an IRI or a list of IRIs.',
R88: 'odrl:spatialCoordinates must only be used with odrl:eq or odrl:neq.',
R89: 'odrl:systemDevice must only be used with odrl:eq, odrl:neq, odrl:isAnyOf or odrl:isNoneOf.',
R90: 'The rightOperand of odrl:systemDevice should be an IRI, a string, or a list of these.',
@@ -147,9 +147,14 @@ describe('The constraint rightOperand shapes', () => {
// [requirement, leftOperand, rightOperand]
test.each([
[ 'R50', 'odrl:count', '"5"^^xsd:integer' ],
+ [ 'R50', 'odrl:count', '"5"^^xsd:nonNegativeInteger' ],
+ [ 'R50', 'odrl:count', '"1"^^xsd:positiveInteger' ],
+ [ 'R50', 'odrl:count', '"0"^^xsd:integer' ],
[ 'R52', 'odrl:dateTime', '"2026-12-31"^^xsd:date' ],
[ 'R52', 'odrl:dateTime', '"2026-12-31T10:00:00Z"^^xsd:dateTime' ],
+ [ 'R52', 'odrl:dateTime', '"2026-12-31T10:00:00Z"^^xsd:dateTimeStamp' ],
[ 'R54', 'odrl:delayPeriod', '"PT60M"^^xsd:duration' ],
+ [ 'R54', 'odrl:delayPeriod', '"PT60M"^^xsd:dayTimeDuration' ],
[ 'R56', 'odrl:deliveryChannel', ':mobile' ],
[ 'R56', 'odrl:deliveryChannel', '"mobile"' ],
[ 'R56', 'odrl:deliveryChannel', '( :mobile "web" )' ],
@@ -164,15 +169,23 @@ describe('The constraint rightOperand shapes', () => {
[ 'R64', 'odrl:industry', '"financial"' ],
[ 'R64', 'odrl:industry', '( :publishing "financial" )' ],
[ 'R66', 'odrl:language', '"en"' ],
+ [ 'R66', 'odrl:language', '"en"^^xsd:language' ],
[ 'R66', 'odrl:language', '( "en" "es" )' ],
[ 'R68', 'odrl:media', '"print"' ],
[ 'R68', 'odrl:media', '( "electronic" "print" )' ],
[ 'R70', 'odrl:meteredTime', '"PT60M"^^xsd:duration' ],
[ 'R72', 'odrl:payAmount', '"10.50"^^xsd:decimal' ],
[ 'R72', 'odrl:payAmount', '10.5' ],
+ [ 'R72', 'odrl:payAmount', '10' ],
+ [ 'R72', 'odrl:payAmount', '0' ],
+ [ 'R72', 'odrl:payAmount', '"10"^^xsd:nonNegativeInteger' ],
+ [ 'R72', 'odrl:payAmount', '-10' ],
[ 'R74', 'odrl:percentage', '"50"^^xsd:decimal' ],
[ 'R74', 'odrl:percentage', '"0.0"^^xsd:decimal' ],
[ 'R74', 'odrl:percentage', '"100.0"^^xsd:decimal' ],
+ [ 'R74', 'odrl:percentage', '50' ],
+ [ 'R74', 'odrl:percentage', '100' ],
+ [ 'R74', 'odrl:percentage', '"50"^^xsd:unsignedByte' ],
[ 'R76', 'odrl:product', ':magazine' ],
[ 'R76', 'odrl:product', '"magazine"' ],
[ 'R76', 'odrl:product', '( :magazine "newspaper" )' ],
@@ -183,10 +196,12 @@ describe('The constraint rightOperand shapes', () => {
[ 'R80', 'odrl:recipient', '"Bob"' ],
[ 'R80', 'odrl:recipient', '( :alice "Bob" )' ],
[ 'R87', 'odrl:spatial', '' ],
+ [ 'R87', 'odrl:spatial', '( )' ],
[ 'R90', 'odrl:systemDevice', ':laptop42' ],
[ 'R90', 'odrl:systemDevice', '"device-1234"' ],
[ 'R90', 'odrl:systemDevice', '( :laptop42 "device-1234" )' ],
[ 'R92', 'odrl:timeInterval', '"P7D"^^xsd:duration' ],
+ [ 'R92', 'odrl:timeInterval', '"P1M"^^xsd:yearMonthDuration' ],
[ 'R94', 'odrl:unitOfCount', '"perUser"' ],
[ 'R96', 'odrl:version', '"2.0"' ],
[ 'R96', 'odrl:version', '( "1.0" "2.0" )' ],
@@ -200,6 +215,7 @@ describe('The constraint rightOperand shapes', () => {
const wrongCases: [keyof typeof MESSAGES, string, string, Severity][] = [
[ 'R50', 'odrl:count', '"five"', 'Violation' ],
[ 'R50', 'odrl:count', '"5.5"^^xsd:decimal', 'Violation' ],
+ [ 'R50', 'odrl:count', '"-5"^^xsd:negativeInteger', 'Violation' ],
[ 'R52', 'odrl:dateTime', '"tomorrow"', 'Violation' ],
[ 'R52', 'odrl:dateTime', '"5"^^xsd:integer', 'Violation' ],
[ 'R52', 'odrl:dateTime', '"2026-13-45"^^xsd:date', 'Violation' ],
@@ -223,9 +239,13 @@ describe('The constraint rightOperand shapes', () => {
[ 'R70', 'odrl:meteredTime', '"60"^^xsd:integer', 'Violation' ],
[ 'R72', 'odrl:payAmount', '"10 EUR"', 'Violation' ],
[ 'R72', 'odrl:payAmount', '"abc"^^xsd:decimal', 'Violation' ],
+ [ 'R72', 'odrl:payAmount', '"10.5"^^xsd:double', 'Violation' ],
[ 'R74', 'odrl:percentage', '"100.5"^^xsd:decimal', 'Violation' ],
[ 'R74', 'odrl:percentage', '"-1"^^xsd:decimal', 'Violation' ],
[ 'R74', 'odrl:percentage', '"50%"', 'Violation' ],
+ [ 'R74', 'odrl:percentage', '150', 'Violation' ],
+ [ 'R74', 'odrl:percentage', '-1', 'Violation' ],
+ [ 'R74', 'odrl:percentage', '"50"^^xsd:double', 'Violation' ],
[ 'R76', 'odrl:product', '"5"^^xsd:integer', 'Warning' ],
[ 'R76', 'odrl:product', '( :magazine "5"^^xsd:integer )', 'Warning' ],
[ 'R78', 'odrl:purpose', '"5"^^xsd:integer', 'Warning' ],
@@ -233,8 +253,7 @@ describe('The constraint rightOperand shapes', () => {
[ 'R80', 'odrl:recipient', '"5"^^xsd:integer', 'Warning' ],
[ 'R80', 'odrl:recipient', '( :alice "5"^^xsd:integer )', 'Warning' ],
[ 'R87', 'odrl:spatial', '"ES"', 'Violation' ],
- // Lists are blank nodes, so they are not allowed either (to be discussed for isAnyOf/isNoneOf).
- [ 'R87', 'odrl:spatial', '( )', 'Violation' ],
+ [ 'R87', 'odrl:spatial', '( "France" )', 'Violation' ],
[ 'R90', 'odrl:systemDevice', '"5"^^xsd:integer', 'Warning' ],
[ 'R90', 'odrl:systemDevice', '( :laptop42 "5"^^xsd:integer )', 'Warning' ],
[ 'R92', 'odrl:timeInterval', '"weekly"', 'Violation' ],