Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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**
Expand Down
143 changes: 115 additions & 28 deletions src/shapes/Shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
<http://example.com/CountRightOperandShape> 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 [
Expand All @@ -1112,7 +1112,37 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:node <http://example.com/IntegerShape> ;
sh:minInclusive 0
]) .

<http://example.com/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
]) .

<http://example.com/DateTimeRightOperandShape> a sh:NodeShape ;
Expand All @@ -1127,11 +1157,16 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:or ([
sh:datatype xsd:date
] [
sh:datatype xsd:dateTime
])
sh:node <http://example.com/DateTimeShape>
]) .

<http://example.com/DateTimeShape> a sh:NodeShape ;
sh:or ([
sh:datatype xsd:date
] [
sh:datatype xsd:dateTime
] [
sh:datatype xsd:dateTimeStamp
]) .

<http://example.com/DelayPeriodRightOperandShape> a sh:NodeShape ;
Expand All @@ -1146,7 +1181,16 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:node <http://example.com/DurationShape>
]) .

<http://example.com/DurationShape> a sh:NodeShape ;
sh:or ([
sh:datatype xsd:duration
] [
sh:datatype xsd:dayTimeDuration
] [
sh:datatype xsd:yearMonthDuration
]) .

<http://example.com/DeliveryChannelRightOperandShape> a sh:NodeShape ;
Expand All @@ -1164,12 +1208,35 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
]) .

<http://example.com/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
]) .

<http://example.com/IriOrStringListShape> a sh:NodeShape ;
sh:property [
sh:path ([
Expand All @@ -1178,7 +1245,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
])
] ;
sh:node <http://example.com/RdfListShape> .
Expand All @@ -1195,7 +1262,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:datatype xsd:duration
sh:node <http://example.com/DurationShape>
]) .

<http://example.com/EventRightOperandShape> a sh:NodeShape ;
Expand All @@ -1213,7 +1280,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
])
]) .

Expand All @@ -1232,7 +1299,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1253,7 +1320,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1272,7 +1339,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
] [
sh:path odrl:rightOperand ;
sh:or ([
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/StringListShape>
])
Expand All @@ -1283,7 +1350,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:path ([
sh:zeroOrMorePath rdf:rest
] rdf:first) ;
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] ;
sh:node <http://example.com/RdfListShape> .

Expand All @@ -1300,7 +1367,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
] [
sh:path odrl:rightOperand ;
sh:or ([
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/StringListShape>
])
Expand All @@ -1318,7 +1385,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:datatype xsd:duration
sh:node <http://example.com/DurationShape>
]) .

<http://example.com/PayAmountRightOperandShape> a sh:NodeShape ;
Expand All @@ -1333,7 +1400,14 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:node <http://example.com/DecimalShape>
]) .

<http://example.com/DecimalShape> a sh:NodeShape ;
sh:or ([
sh:datatype xsd:decimal
] [
sh:node <http://example.com/IntegerShape>
]) .

<http://example.com/PercentageRightOperandShape> a sh:NodeShape ;
Expand All @@ -1348,7 +1422,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:datatype xsd:decimal ;
sh:node <http://example.com/DecimalShape> ;
sh:minInclusive 0 ;
sh:maxInclusive 100
]) .
Expand All @@ -1368,7 +1442,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1389,7 +1463,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1410,7 +1484,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1419,18 +1493,31 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
<http://example.com/SpatialRightOperandShape> 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 [
sh:path odrl:leftOperand ;
sh:hasValue odrl:spatial
]
] [
sh:nodeKind sh:IRI ;
sh:path odrl:rightOperand
sh:path odrl:rightOperand ;
sh:or ([
sh:nodeKind sh:IRI
] [
sh:node <http://example.com/IriListShape>
])
]) .

<http://example.com/IriListShape> a sh:NodeShape ;
sh:property [
sh:nodeKind sh:IRI ;
sh:path ([
sh:zeroOrMorePath rdf:rest
] rdf:first)
] ;
sh:node <http://example.com/RdfListShape> .

<http://example.com/SystemDeviceRightOperandShape> a sh:NodeShape ;
sh:targetClass odrl:Constraint ;
sh:targetSubjectsOf odrl:leftOperand ;
Expand All @@ -1446,7 +1533,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
sh:or ([
sh:nodeKind sh:IRI
] [
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/IriOrStringListShape>
])
Expand All @@ -1464,7 +1551,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:datatype xsd:duration
sh:node <http://example.com/DurationShape>
]) .

<http://example.com/UnitOfCountRightOperandShape> a sh:NodeShape ;
Expand All @@ -1479,7 +1566,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
]
] [
sh:path odrl:rightOperand ;
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
]) .

<http://example.com/VersionRightOperandShape> a sh:NodeShape ;
Expand All @@ -1495,7 +1582,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
] [
sh:path odrl:rightOperand ;
sh:or ([
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/StringListShape>
])
Expand All @@ -1514,7 +1601,7 @@ export const SHAPES: string = `@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
] [
sh:path odrl:rightOperand ;
sh:or ([
sh:datatype xsd:string
sh:node <http://example.com/StringShape>
] [
sh:node <http://example.com/StringListShape>
])
Expand Down
Loading
Loading