From 2c17b9d82af92430fb109b8be685a865e0525d6a Mon Sep 17 00:00:00 2001 From: gNahcab <91829513+gNahcab@users.noreply.github.com> Date: Mon, 25 Apr 2022 18:13:36 +0200 Subject: [PATCH] chore: improve XML and JSON Schemas (DEV-449) (#180) * making element unique based on attribute name * In case of object:GeomValue, require hasGeometry as super * update schema-files * adapt test-data * update schema-files * adapt docs Co-authored-by: Vijeinath Tissaveerasingham Co-authored-by: Johannes Nussbaum Co-authored-by: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> --- docs/dsp-tools-create-ontologies.md | 6 +++--- knora/dsplib/schemas/data.xsd | 25 +++++++++++++++---------- knora/dsplib/schemas/ontology.json | 19 ++++++++++++++++++- testdata/test-onto.json | 2 +- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/docs/dsp-tools-create-ontologies.md b/docs/dsp-tools-create-ontologies.md index fd700e4c4..e8904f419 100644 --- a/docs/dsp-tools-create-ontologies.md +++ b/docs/dsp-tools-create-ontologies.md @@ -80,13 +80,13 @@ The following fields are mandatory: - `name` - `labels` +- `super` - `object` - `gui_element` The following fields are optional: - `comments` -- `super` (with the exception of `LinkValue` where `super` is mandatory) - `subject` - `gui_attributes` @@ -154,7 +154,7 @@ Comments with language tags. Currently, "de", "en", "fr" and "it" are supported. ### Super -(optional) +(required) `"super": ["", ", ...]` @@ -165,7 +165,7 @@ including the prefix of the external or internal ontology - has to be given. The following base properties are defined by DSP: -- `hasValue`: This is the most generic base and taken as default if `super` is omitted. +- `hasValue`: This is the most generic base. - `hasLinkTo`: This value represents a link to another resource. You have to indicate the "_object_" as a prefixed name that identifies the resource class this link points to (a ":" prepended to the name is sufficient if the resource is defined in the current ontology). diff --git a/knora/dsplib/schemas/data.xsd b/knora/dsplib/schemas/data.xsd index c854a4b2a..4e1c9850d 100644 --- a/knora/dsplib/schemas/data.xsd +++ b/knora/dsplib/schemas/data.xsd @@ -200,16 +200,16 @@ - + + - - - - - - + + + + + + - @@ -334,7 +334,7 @@ - + @@ -454,7 +454,12 @@ - + + + + + + diff --git a/knora/dsplib/schemas/ontology.json b/knora/dsplib/schemas/ontology.json index fbfce65cf..6fa08000b 100644 --- a/knora/dsplib/schemas/ontology.json +++ b/knora/dsplib/schemas/ontology.json @@ -379,6 +379,7 @@ }, "required": [ "name", + "super", "object", "labels", "gui_element" @@ -475,6 +476,22 @@ }, "then": { "properties": { + "super": { + "type": "array", + "items": { + "type": "string", + "oneOf": [ + { + "enum": [ + "hasGeometry" + ] + }, + { + "$ref": "#/definitions/prefixedname" + } + ] + } + }, "gui_element": { "enum": [ "Geometry", @@ -496,7 +513,7 @@ "properties": { "gui_element": { "const": - "Geonames" + "Geonames" } } } diff --git a/testdata/test-onto.json b/testdata/test-onto.json index 6c1aa2e6d..b197a159e 100644 --- a/testdata/test-onto.json +++ b/testdata/test-onto.json @@ -293,7 +293,7 @@ { "name": "hasGeometry", "super": [ - "hasValue" + "hasGeometry" ], "object": "GeomValue", "labels": {