Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: drop schema:value #206

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions meta/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ A type of [annotation](#annotation) which can be used to express a limit or targ
a cube:MeasureDimension ;
meta:annotation [
a meta:Limit ;
schema:value 95 ;
schema:maxValue 95 ;
schema:name "Target 2020" ;
meta:annotationContext [
sh:path ex:year ;
Expand All @@ -53,7 +53,7 @@ A type of [annotation](#annotation) which can be used to express a limit or targ

</aside>

`schema:minValue` and `schema:maxValue` can be used to express a range of limit values.
`schema:minValue` and `schema:maxValue` can be used together.

## Properties

Expand All @@ -65,7 +65,8 @@ To express that the dimension provides a specific _kind_ of data which is necess
<aside class='example'>

```turtle
@prefix meta: <https://cube.link/meta/>
@prefix schema: <http://schema.org/> .
@prefix meta: <https://cube.link/meta/> .

<dimension> meta:dataKind [ a schema:GeoCoordinates ].
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
meta:annotation
[
a meta:Limit ;
schema:value 97 ;
schema:maxValue 97 ;
schema:name "Target 2020+" ;
meta:annotationContext
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
meta:annotation
[
a meta:Limit ;
schema:value 95 ;
schema:minValue 95 ;
meta:annotationContext
[
sh:path <non-dimension> ;
Expand All @@ -59,7 +59,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
] ,
[
a meta:Limit ;
schema:value 95 ;
schema:maxValue 95 ;
meta:annotationContext
[
sh:path <station> ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _:report a sh:ValidationReport ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
sh:sourceShape [
sh:path _:b710 ;
sh:path _:b707 ;
sh:xone (
[
sh:class cube:KeyDimension ;
Expand All @@ -36,11 +36,11 @@ _:report a sh:ValidationReport ;
] ;
sh:focusNode _:b7 ;
sh:value _:b9 ;
sh:resultPath _:b710 ;
sh:resultPath _:b707 ;
] ;
sh:conforms false .

_:b710 rdf:first sh:path ;
_:b707 rdf:first sh:path ;
rdf:rest (
[
sh:inversePath sh:path ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ _:report a sh:ValidationReport ;
sh:result [
rdf:type sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
sh:sourceShape <https://cube.link/shape/standalone-constraint-constraint#AnnotationValue> ;
sh:sourceConstraintComponent sh:MinCountConstraintComponent ;
sh:sourceShape [
sh:path _:b690 ;
sh:minCount 1 ;
] ;
sh:focusNode _:b4 ;
sh:value _:b4 ;
sh:resultMessage "annotation must have exactly one schema:value or a combination of schema:minValue and schema:maxValue" ;
sh:resultPath _:b690 ;
sh:resultMessage "Less than 1 values" ;
] ;
sh:conforms false .

_:b690 sh:alternativePath (
schema:minValue
schema:maxValue
) .
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
meta:annotation
[
a meta:Limit ;
schema:value 97 ;
schema:maxValue 97 ;
schema:name "Mixed target" ;
meta:annotationContext
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
PREFIX ex: <http://example.org/>
PREFIX dcterms: <http://purl.org/dc/terms/>
@prefix relation: <https://cube.link/relation/> .
@prefix meta: <https://cube.link/meta/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix cube: <https://cube.link/> .
@prefix observation: <https://environment.ld.admin.ch/foen/nfi/observation/max_min_undefined> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix schema: <http://schema.org/> .
@base <https://example.org/> .

<cube> a cube:Cube ;
cube:observationConstraint <shape> ;
cube:observationSet <observationSet> .

<observationSet> cube:observation <observationA> .

<observationA> a cube:Observation ;
cube:observedBy <observer> ;
<measure> 4.9 ;
<year> <https://ld.admin.ch/time/year/2020> ;
.

<shape> a cube:Constraint ;
sh:targetClass cube:Observation ;
sh:closed true ;
sh:property
[
sh:path rdf:type ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:maxCount 1
] ;
sh:property
[
sh:path cube:observedBy ; ;
sh:nodeKind sh:IRI ;
sh:minCount 1 ;
sh:maxCount 1
] ;
sh:property
[
a cube:MeasureDimension ;
sh:datatype xsd:decimal ;
sh:path <measure> ;
schema:name "measure" ;
sh:minCount 1 ;
sh:maxCount 1 ;
meta:annotation
[
a meta:Limit ;
schema:name "Target 2020+" ;
schema:minValue 10 ;
schema:minValue 20 ;
meta:annotationContext
[
sh:path <year> ;
sh:minInclusive <https://ld.admin.ch/time/year/2020> ;
] ;
],
[
a meta:Limit ;
schema:name "Target 2025+" ;
schema:maxValue 10 ;
schema:maxValue 20 ;
meta:annotationContext
[
sh:path <year> ;
sh:minInclusive <https://ld.admin.ch/time/year/2025> ;
] ;
] ;
] ;
sh:property
[
a cube:KeyDimension ;
sh:path <year> ;
schema:name "year" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:nodeKind sh:IRI ;
] ;
sh:property
[
a cube:KeyDimension ;
sh:path <station> ;
schema:name "station" ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:nodeKind sh:IRI ;
] ;
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix schema: <http://schema.org/> .
@prefix cube: <https://cube.link/> .

_:report a sh:ValidationReport ;
sh:result [
rdf:type sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxCountConstraintComponent ;
sh:sourceShape [
sh:path schema:minValue ;
sh:maxCount 1 ;
] ;
sh:focusNode _:b4 ;
sh:resultPath schema:minValue ;
sh:resultMessage "More than 1 values" ;
], [
rdf:type sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MaxCountConstraintComponent ;
sh:sourceShape [
sh:path schema:maxValue ;
sh:maxCount 1 ;
] ;
sh:focusNode _:b6 ;
sh:resultPath schema:maxValue ;
sh:resultMessage "More than 1 values" ;
] ;
sh:conforms false .
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _:report a sh:ValidationReport ;
rdf:type sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MinCountConstraintComponent ;
sh:sourceShape _:b747 ;
sh:sourceShape _:b744 ;
sh:focusNode _:b6 ;
sh:resultPath rdf:rest ;
sh:resultMessage "list node needs exactly one rdf:rest" ;
Expand Down Expand Up @@ -41,7 +41,7 @@ _:report a sh:ValidationReport ;
rdf:type sh:ValidationResult ;
sh:resultSeverity sh:Violation ;
sh:sourceConstraintComponent sh:MinCountConstraintComponent ;
sh:sourceShape _:b747 ;
sh:sourceShape _:b744 ;
sh:focusNode _:b6 ;
sh:resultPath rdf:rest ;
sh:resultMessage "list node needs exactly one rdf:rest" ;
Expand All @@ -60,7 +60,7 @@ _:report a sh:ValidationReport ;
] ;
sh:conforms false .

_:b747 sh:path rdf:rest ;
_:b744 sh:path rdf:rest ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:message "list node needs exactly one rdf:rest" .
4 changes: 2 additions & 2 deletions test/standalone-constraint-constraint/valid.annotation.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
meta:annotation
[
a meta:Limit ;
schema:value 95 ;
schema:maxValue 95 ;
schema:name "Target 2020" ;
meta:annotationContext
[
Expand All @@ -60,7 +60,7 @@ PREFIX dcterms: <http://purl.org/dc/terms/>
] ,
[
a meta:Limit ;
schema:value 97 ;
schema:maxValue 97 ;
schema:name "Target 2025+" ;
meta:annotationContext
[
Expand Down
34 changes: 14 additions & 20 deletions validation/standalone-constraint-constraint.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -241,26 +241,20 @@
:AnnotationValue
a sh:NodeShape ;
sh:targetObjectsOf meta:annotation ;
sh:message "annotation must have exactly one schema:value or a combination of schema:minValue and schema:maxValue" ;
sh:xone
(
[
sh:property
[
sh:path schema:value ;
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
]
[
sh:property
[
sh:path [ sh:alternativePath ( schema:minValue schema:maxValue ) ] ;
sh:minCount 1 ;
sh:maxCount 2 ;
] ;
]
) ;
sh:message "annotation must have at most one min value and one max value" ;
sh:property
[
sh:path [ sh:alternativePath ( schema:minValue schema:maxValue ) ] ;
sh:minCount 1 ;
] ,
[
sh:path schema:minValue ;
sh:maxCount 1 ;
] ,
[
sh:path schema:maxValue ;
sh:maxCount 1 ;
] ;
.

:AnnotationContextDimensionType
Expand Down