From e0254be372e90b2d0813128db34b1561f99405b2 Mon Sep 17 00:00:00 2001 From: Gregor Bachmann <91829513+gNahcab@users.noreply.github.com> Date: Tue, 3 May 2022 11:31:11 +0200 Subject: [PATCH] chore: update lists.json (DEV-851) (#190) * -delete old lists.json and old lists-only.json - and add new lists.json * -delete lists-only.json -update lists.json * update lists.json * replace "lists-only.json" by "lists.json" * change name "lists.json" to "lists-only.json" * make mandatory: lists must contain "nodes" and at least one node --- MANIFEST.in | 1 - knora/dsp_tools.py | 2 +- knora/dsplib/schemas/lists-only.json | 11 ++- knora/dsplib/schemas/lists.json | 132 --------------------------- knora/dsplib/schemas/ontology.json | 4 +- 5 files changed, 12 insertions(+), 138 deletions(-) delete mode 100644 knora/dsplib/schemas/lists.json diff --git a/MANIFEST.in b/MANIFEST.in index 0b584a039..ceded8fc5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,5 @@ include README.md include knora/dsplib/schemas/ontology.json -include knora/dsplib/schemas/lists.json include knora/dsplib/schemas/lists-only.json include knora/dsplib/schemas/resources-only.json include knora/dsplib/schemas/properties-only.json diff --git a/knora/dsp_tools.py b/knora/dsp_tools.py index ee4dd407d..a24ed3f0e 100644 --- a/knora/dsp_tools.py +++ b/knora/dsp_tools.py @@ -58,7 +58,7 @@ def program(user_args: list[str]) -> None: parser_create.add_argument('-V', '--validate', action='store_true', help='Do only validation of JSON, no upload of the ' 'ontology') - parser_create.add_argument('-L', '--listfile', type=str, default='lists.json', + parser_create.add_argument('-L', '--listfile', type=str, default='lists-only.json', help='Name of list node informationfile') parser_create.add_argument('-l', '--lists', action='store_true', help='Upload only the list(s)') parser_create.add_argument('-v', '--verbose', action='store_true', help=verbose_text) diff --git a/knora/dsplib/schemas/lists-only.json b/knora/dsplib/schemas/lists-only.json index 8ed6bc9c6..c6904d351 100644 --- a/knora/dsplib/schemas/lists-only.json +++ b/knora/dsplib/schemas/lists-only.json @@ -1,10 +1,10 @@ { "$schema": "https://json-schema.org/draft-07/schema", - "$id": "https://dasch.swiss/schema/list-only.json", + "$id": "https://dasch.swiss/schema/lists.json", "title": "JSON schema for DSP lists", "description": "JSON schema for the lists section used in DSP ontologies", "definitions": { - "label": { + "langstring": { "type": "object", "patternProperties": { "^(en|de|fr|it)": { @@ -13,6 +13,9 @@ }, "additionalProperties": false }, + "label": { + "$ref": "#/definitions/langstring" + }, "comment": { "type": "object", "patternProperties": { @@ -35,6 +38,7 @@ "$ref": "#/definitions/comment" }, "nodes": { + "minItems": 1, "oneOf": [ { "type": "array", @@ -124,7 +128,8 @@ }, "required": [ "name", - "nodes" + "nodes", + "labels" ], "additionalProperties": false } diff --git a/knora/dsplib/schemas/lists.json b/knora/dsplib/schemas/lists.json deleted file mode 100644 index 47ade9f21..000000000 --- a/knora/dsplib/schemas/lists.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft-07/schema", - "$id": "https://dasch.swiss/schema/lists.json", - "title": "JSON schema for DSP lists", - "description": "JSON schema for lists used in DSP ontologies", - "definitions": { - "langstring": { - "type": "object", - "patternProperties": { - "^(en|de|fr|it)": { - "type": "string" - } - }, - "additionalProperties": false - }, - "label": { - "$ref": "#/definitions/langstring" - }, - "description": { - "$ref": "#/definitions/langstring" - }, - "comment": { - "$ref": "#/definitions/langstring" - }, - "excelfileref": { - "type": "object", - "properties": { - "file": { - "type": "string" - }, - "worksheet": { - "type": "string" - }, - "startrow": { - "type": "integer" - }, - "startcol": { - "type": "integer" - } - }, - "required": [ - "file", - "worksheet" - ] - }, - "excelfolderref": { - "type": "object", - "properties": { - "folder": { - "type": "string" - } - }, - "required": [ - "folder" - ] - }, - "node": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "labels": { - "$ref": "#/definitions/label" - }, - "comments": { - "$ref": "#/definitions/comment" - }, - "nodes": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/definitions/node" - } - }, - { - "type": "object", - "$ref": "#/definitions/excelfileref" - }, - { - "type": "object", - "$ref": "#/definitions/excelfolderref" - } - ] - } - }, - "required": [ - "name", - "labels" - ], - "additionalProperties": false - } - }, - "type": "object", - "properties": { - "project": { - "type": "object", - "properties": { - "shortcode": { - "type": "string", - "pattern": "^[0-9A-F]{4}$" - }, - "lists": { - "type": "array", - "items": { - "$ref": "#/definitions/node" - } - } - }, - "required": [ - "shortcode", - "lists" - ], - "additionalProperties": false - }, - "prefixes": { - "type": "object", - "patternProperties": { - "^[-\\w]+$": { - "format": "uri" - } - }, - "additionalProperties": false - } - }, - "required": [ - "prefixes", - "project" - ], - "additionalProperties": false -} diff --git a/knora/dsplib/schemas/ontology.json b/knora/dsplib/schemas/ontology.json index ad91e4d5a..f05ce54fa 100644 --- a/knora/dsplib/schemas/ontology.json +++ b/knora/dsplib/schemas/ontology.json @@ -183,6 +183,7 @@ "$ref": "#/definitions/comment" }, "nodes": { + "minItems": 1, "oneOf": [ { "type": "array", @@ -1207,7 +1208,8 @@ "$ref": "#/definitions/comment" }, "required": [ - "comments" + "comments", + "nodes" ] } },