Skip to content

Commit 657a3b4

Browse files
KerstenBreuersbilgemephenor
authored
make datapacks naviagatable without schemapacks (GSI-724) (#35)
* rootClass and rootResource in DataPack Spec (#40) * targetClass and targetResources in Relations * updated examples --------- Co-authored-by: sbilge <[email protected]> Co-authored-by: Thomas Zajac <[email protected]> Co-authored-by: sbilge <[email protected]>
1 parent e05e66a commit 657a3b4

File tree

80 files changed

+883
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+883
-460
lines changed

.pyproject_generation/pyproject_custom.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[project]
33
name = "schemapack"
4-
version = "2.0.0-alpha.5"
4+
version = "2.0.0"
55
description = "Make your JSON Schemas sociable and create linked data model."
66
dependencies = [
77
"pydantic >=2, <3",

Dockerfile.debian

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ USER appuser
4545
# set environment
4646
ENV PYTHONUNBUFFERED=1
4747
# Please adapt to package name:
48-
ENTRYPOINT ["my-microservice"]
48+
ENTRYPOINT ["schemapack"]

examples/datapack/invalid/all_mandatory/MissingMandatoryOriginError.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ resources:
77
content: {}
88
relations:
99
b:
10-
- b1
10+
targetClass: B
11+
targetResources:
12+
- b1
1113
B:
1214
b1:
1315
content: {}

examples/datapack/invalid/all_mandatory/MissingMandatoryTargetError.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ resources:
66
a1:
77
content: {}
88
relations:
9-
b: [] # <-
9+
b:
10+
targetClass: B
11+
targetResources: [] # <-
1012
B: {}

examples/datapack/invalid/all_mandatory_non_multiple_target/MissingMandatoryOriginError.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ resources:
66
a1:
77
content: {}
88
relations:
9-
b: b1
9+
b:
10+
targetClass: B
11+
targetResources: b1
1012
B:
1113
b1:
1214
content: {}

examples/datapack/invalid/all_mandatory_non_multiple_target/MissingMandatoryTargetError.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ resources:
66
a1:
77
content: {}
88
relations:
9-
b: null # <-
9+
b:
10+
targetClass: B
11+
targetResources: null # <-
1012
B: {}

examples/datapack/invalid/complex_cardinality/CardinalityOverlapError.one_to_many.datapack.yaml

+26-10
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,37 @@ resources:
66
content: {}
77
relations:
88
many_to_many:
9-
- b1
10-
- b2
9+
targetClass: B
10+
targetResources:
11+
- b1
12+
- b2
1113
one_to_many:
12-
- b1
13-
- b2
14-
many_to_one: b1
15-
one_to_one: b1
14+
targetClass: B
15+
targetResources:
16+
- b1
17+
- b2
18+
many_to_one:
19+
targetClass: B
20+
targetResources: b1
21+
one_to_one:
22+
targetClass: B
23+
targetResources: b1
1624
a2:
1725
content: {}
1826
relations:
19-
many_to_many: []
27+
many_to_many:
28+
targetClass: B
29+
targetResources: []
2030
one_to_many:
21-
- b1 # overlapping with a1.relations.one_to_many
22-
many_to_one: b1
23-
one_to_one: b2
31+
targetClass: B
32+
targetResources:
33+
- b1 # overlapping with a1.relations.one_to_many
34+
many_to_one:
35+
targetClass: B
36+
targetResources: b1
37+
one_to_one:
38+
targetClass: B
39+
targetResources: b2
2440
B:
2541
b1:
2642
content: {}

examples/datapack/invalid/complex_cardinality/CardinalityOverlapError.one_to_one.datapack.yaml

+26-10
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,36 @@ resources:
66
content: {}
77
relations:
88
many_to_many:
9-
- b1
10-
- b2
9+
targetClass: B
10+
targetResources:
11+
- b1
12+
- b2
1113
one_to_many:
12-
- b1
13-
- b2
14-
many_to_one: b1
15-
one_to_one: b1
14+
targetClass: B
15+
targetResources:
16+
- b1
17+
- b2
18+
many_to_one:
19+
targetClass: B
20+
targetResources: b1
21+
one_to_one:
22+
targetClass: B
23+
targetResources: b1
1624
a2:
1725
content: {}
1826
relations:
19-
many_to_many: []
20-
one_to_many: []
21-
many_to_one: b1
22-
one_to_one: b1 # overlapping with a1.relations.one_to_one
27+
many_to_many:
28+
targetClass: B
29+
targetResources: []
30+
one_to_many:
31+
targetClass: B
32+
targetResources: []
33+
many_to_one:
34+
targetClass: B
35+
targetResources: b1
36+
one_to_one:
37+
targetClass: B
38+
targetResources: b1 # overlapping with a1.relations.one_to_one
2339
B:
2440
b1:
2541
content: {}

examples/datapack/invalid/complex_cardinality/CardinalityPluralityError.many_to_many.datapack.yaml

+13-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@ resources:
66
a1:
77
content: {}
88
relations:
9-
many_to_many: b1 # <-
9+
many_to_many:
10+
targetClass: B
11+
targetResources: b1 # <-
1012
one_to_many:
11-
- b1
12-
- b2
13-
many_to_one: b1
14-
one_to_one: b1
13+
targetClass: B
14+
targetResources:
15+
- b1
16+
- b2
17+
many_to_one:
18+
targetClass: B
19+
targetResources: b1
20+
one_to_one:
21+
targetClass: B
22+
targetResources: b1
1523
B:
1624
b1:
1725
content: {}

examples/datapack/invalid/complex_cardinality/CardinalityPluralityError.many_to_one.datapack.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ resources:
77
content: {}
88
relations:
99
many_to_many:
10-
- b1
11-
- b2
10+
targetClass: B
11+
targetResources:
12+
- b1
13+
- b2
1214
one_to_many:
13-
- b1
14-
- b2
15+
targetClass: B
16+
targetResources:
17+
- b1
18+
- b2
1519
many_to_one:
16-
- b1 # <-
17-
one_to_one: b1
20+
targetClass: B
21+
targetResources:
22+
- b1 # <-
23+
one_to_one:
24+
targetClass: B
25+
targetResources: b1
1826
B:
1927
b1:
2028
content: {}

examples/datapack/invalid/complex_cardinality/CardinalityPluralityError.one_to_many.datapack.yaml

+13-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ resources:
77
content: {}
88
relations:
99
many_to_many:
10-
- b1
11-
- b2
12-
one_to_many: b1 # <-
13-
many_to_one: b1
14-
one_to_one: b1
10+
targetClass: B
11+
targetResources:
12+
- b1
13+
- b2
14+
one_to_many:
15+
targetClass: B
16+
targetResources: b1 # <-
17+
many_to_one:
18+
targetClass: B
19+
targetResources: b1
20+
one_to_one:
21+
targetClass: B
22+
targetResources: b1
1523
B:
1624
b1:
1725
content: {}

examples/datapack/invalid/complex_cardinality/CardinalityPluralityError.one_to_one.datapack.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ resources:
77
content: {}
88
relations:
99
many_to_many:
10-
- b1
11-
- b2
10+
targetClass: B
11+
targetResources:
12+
- b1
13+
- b2
1214
one_to_many:
13-
- b1
14-
- b2
15-
many_to_one: b1
15+
targetClass: B
16+
targetResources:
17+
- b1
18+
- b2
19+
many_to_one:
20+
targetClass: B
21+
targetResources: b1
1622
one_to_one:
17-
- b1 # <-
23+
targetClass: B
24+
targetResources:
25+
- b1 # <-
1826
B:
1927
b1:
2028
content: {}

examples/datapack/invalid/self_relation/UnexpectedRootResourceError.datapack.yaml examples/datapack/invalid/self_relation/UnexpectedRootDefinitionError.datapack.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ resources:
66
content: {}
77
relations:
88
some_relation:
9-
- b
9+
targetClass: SomeClass
10+
targetResources:
11+
- b
1012
b:
1113
content: {}
1214
relations:
1315
some_relation:
14-
- a
16+
targetClass: SomeClass
17+
targetResources:
18+
- a
19+
rootClass: SomeClass
1520
rootResource: a # <-

examples/datapack/invalid/self_relation_rooted/UnkownRootResourceError.datapack.yaml examples/datapack/invalid/self_relation_rooted/DataPackSpecError.UnkownRootResourceError.datapack.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ resources:
66
content: {}
77
relations:
88
some_relation:
9-
- b
9+
targetClass: SomeClass
10+
targetResources:
11+
- b
1012
b:
1113
content: {}
1214
relations:
1315
some_relation:
14-
- a
16+
targetClass: SomeClass
17+
targetResources:
18+
- a
19+
rootClass: SomeClass
1520
rootResource: non_existing_resource

examples/datapack/invalid/self_relation_rooted/ExpectedRootResourceError.datapack.yaml examples/datapack/invalid/self_relation_rooted/ExpectedRootDefinitionError.datapack.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ resources:
66
content: {}
77
relations:
88
some_relation:
9-
- b
9+
targetClass: SomeClass
10+
targetResources:
11+
- b
1012
b:
1113
content: {}
1214
relations:
1315
some_relation:
14-
- a
16+
targetClass: SomeClass
17+
targetResources:
18+
- a

examples/datapack/invalid/simple_relations/ContentValidationError.missing_property.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ resources:
1414
dac_contact: [email protected]
1515
relations:
1616
files:
17-
- example_file_a
17+
targetClass: File
18+
targetResources:
19+
- example_file_a

examples/datapack/invalid/simple_relations/ContentValidationError.unkown_property.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ resources:
1515
non_existing_property: "non_existing_value" # <-
1616
relations:
1717
files:
18-
- example_file_a
18+
targetClass: File
19+
targetResources:
20+
- example_file_a

examples/datapack/invalid/simple_relations/ContentValidationError.wrong_type.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ resources:
1414
dac_contact: [email protected]
1515
relations:
1616
files:
17-
- example_file_a
17+
targetClass: File
18+
targetResources:
19+
- example_file_a

examples/datapack/invalid/simple_relations/DataPackSpecError.DuplicateTargetIdError.datapack.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ resources:
1414
dac_contact: [email protected]
1515
relations:
1616
files:
17-
- example_file_a
18-
- example_file_a # <-
17+
targetClass: File
18+
targetResources:
19+
- example_file_a
20+
- example_file_a # <-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Every target class defined in the relations must be present in the datapack
2+
datapack: 0.3.0
3+
resources:
4+
Dataset:
5+
example_dataset:
6+
content:
7+
dac_contact: [email protected]
8+
relations:
9+
files:
10+
targetClass: File # <-
11+
targetResources: []

examples/datapack/invalid/simple_relations/TargetIdNotFoundError.datapack.yaml examples/datapack/invalid/simple_relations/DataPackSpecError.TargetIdNotFoundError.datapack.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ resources:
88
dac_contact: [email protected]
99
relations:
1010
files:
11-
- not_existing_file # <-
11+
targetClass: File
12+
targetResources:
13+
- not_existing_file # <-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Using a root class that is not in datapack classes
2+
datapack: 0.3.0
3+
resources:
4+
SomeClass:
5+
a:
6+
content: {}
7+
relations:
8+
some_relation:
9+
targetClass: SomeClass
10+
targetResources:
11+
- b
12+
b:
13+
content: {}
14+
relations:
15+
some_relation:
16+
targetClass: SomeClass
17+
targetResources:
18+
- a
19+
rootClass: SomeOtherClass # <-
20+
rootResource: a

0 commit comments

Comments
 (0)