From 656ccff0ff553b13b19242c9997220600e53a76f Mon Sep 17 00:00:00 2001 From: irinaschubert Date: Mon, 10 Jan 2022 09:51:42 +0100 Subject: [PATCH] chore: improve ontology schema and extend tests (DEV-313) (#140) * Remove invalid anything onto from test data * extend test for get command * add tests for gui element to ontology schema * add conditionals for gui_attributes to schema * Remove code smell * fix errors in schema * Refactor test_tools.py * Add documentation for subject attribute --- docs/dsp-tools-create-ontologies.md | 27 +- knora/dsplib/schemas/ontology.json | 427 +++++++++++- test/e2e/test_tools.py | 148 +++-- testdata/BUILD.bazel | 1 - testdata/anything-onto.json | 990 ---------------------------- testdata/test-onto.json | 21 + 6 files changed, 570 insertions(+), 1044 deletions(-) delete mode 100644 testdata/anything-onto.json diff --git a/docs/dsp-tools-create-ontologies.md b/docs/dsp-tools-create-ontologies.md index 28e15b587..b5ace7b95 100644 --- a/docs/dsp-tools-create-ontologies.md +++ b/docs/dsp-tools-create-ontologies.md @@ -83,6 +83,10 @@ The following fields are mandatory: - `object` - `gui_element` +The following fields are optional: + +- `subject` + A detailed description of `properties` can be found [below](#properties-object-in-detail). @@ -140,6 +144,15 @@ By convention, property names start with a lower case letter. Collection of `labels` for the property as strings with language tag (currently "en", "de", "fr" and "it" are supported). +### Subject + +(optional) + +`"subject": ""` + +The `subject` defines the resource class the property can be used on. It has to be provided as prefixed name of the +resource class (see [below](#referencing-ontologies) on how prefixed names are used). + ### Object / gui_element / gui_attributes - `object`: required @@ -636,13 +649,16 @@ Example of a `properties` object: { "properties": [ { - "name": "schulcode", + "name": "id", + "subject": ":School", "object": "TextValue", "super": [ "hasValue" ], "labels": { - "de": "Schulcode" + "en": "School ID", + "de": "ID der Schule" + "fr": "ID de l'école" }, "gui_element": "SimpleText", "gui_attributes": { @@ -651,13 +667,16 @@ Example of a `properties` object: } }, { - "name": "schulname", + "name": "name", + "subject": ":School", "object": "TextValue", "super": [ "hasValue" ], "labels": { - "de": "Name der Schule" + "en": "Name of the school", + "de": "Name der Schule", + "fr": "Nom de l'école" }, "gui_element": "SimpleText", "gui_attributes": { diff --git a/knora/dsplib/schemas/ontology.json b/knora/dsplib/schemas/ontology.json index df088c44d..aacea8f4b 100644 --- a/knora/dsplib/schemas/ontology.json +++ b/knora/dsplib/schemas/ontology.json @@ -326,8 +326,7 @@ "Slider", "Spinbox", "Textarea", - "Checkbox", - "Fileupload" + "Checkbox" ] }, "gui_attributes": { @@ -383,7 +382,429 @@ "labels", "gui_element" ], - "additionalProperties": false + "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "object": { + "const": "TextValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": [ "SimpleText", "Textarea", "Richtext" ] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "ColorValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "Colorpicker" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "DateValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "Date" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "TimeValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "TimeStamp" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "DecimalValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": ["Slider","SimpleText"] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "GeomValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": [ + "Geometry", + "SimpleText" + ] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "GeonameValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": + "Geonames" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "IntValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": [ + "Spinbox", + "SimpleText" + ] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "BooleanValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "Checkbox" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "UriValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "SimpleText" + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "IntervalValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": [ + "Interval", + "SimpleText" + ] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "const": "ListValue" + } + } + }, + "then": { + "properties": { + "gui_element": { + "enum": [ + "Radio", + "List" + ] + } + } + } + }, + { + "if": { + "properties": { + "object": { + "$ref": "#/definitions/prefixedname" + } + } + }, + "then": { + "properties": { + "gui_element": { + "const": "Searchbox" + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "SimpleText" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "maxlength": { + "type": "integer" + }, + "size": { + "type": "integer" + } + }, + "additionalProperties": false + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "Textarea" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "cols": { + "type": "integer" + }, + "rows": { + "type": "integer" + }, + "width": { + "type": "string", + "pattern": "^[0-9]*%?$" + }, + "wrap": { + "enum": [ + "soft", + "hard" + ] + } + }, + "additionalProperties": false + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "Colorpicker" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "ncolors": { + "type": "integer" + } + }, + "additionalProperties": false + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "Slider" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "max": { + "type": "number" + }, + "min": { + "type": "number" + } + }, + "additionalProperties": false + } + }, + "required": [ + "gui_attributes" + ] + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "Spinbox" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "max": { + "type": "number" + }, + "min": { + "type": "number" + } + }, + "additionalProperties": false + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "enum": ["Radio", "List"] + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "hlist": { + "type": "string" + } + }, + "additionalProperties": false + + } + }, + "required": [ + "gui_attributes" + ] + } + }, + { + "if": { + "properties": { + "gui_element": { + "const": "Searchbox" + } + } + }, + "then": { + "properties": { + "gui_attributes": { + "type": "object", + "properties": { + "numprops": { + "type": "integer" + } + }, + "additionalProperties": false + } + } + } + }, + { + "if": { + "properties": { + "gui_element": { + "enum": ["Richtext", "Date", "TimeStamp", "Geometry", "Geonames", "Checkbox", "Interval"] + } + } + }, + "then": { + "not": { + "required": [ + "gui_attributes" + ] + } + } + } + ] }, "cardinality": { "type": "object", diff --git a/test/e2e/test_tools.py b/test/e2e/test_tools.py index bfc305e17..a9fa76f10 100644 --- a/test/e2e/test_tools.py +++ b/test/e2e/test_tools.py @@ -1,7 +1,6 @@ """This test class tests the basic functionalities of dsp-tools""" import json import unittest -from typing import Any from knora.dsplib.utils import excel_to_json_lists from knora.dsplib.utils.excel_to_json_lists import list_excel2json @@ -17,6 +16,7 @@ class TestTools(unittest.TestCase): server = 'http://0.0.0.0:3333' user = 'root@example.com' + test_onto_file = 'testdata/test-onto.json' def setUp(self) -> None: """Is executed before each test""" @@ -29,62 +29,118 @@ def tearDown(self) -> None: excel_to_json_lists.cell_names = [] def test_get(self) -> None: - with open('testdata/anything-onto.json') as f: + with open(self.test_onto_file) as f: onto_json_str = f.read() - anything_onto = json.loads(onto_json_str) + test_onto = json.loads(onto_json_str) - get_ontology(project_identifier='anything', - outfile='_anything-onto.json', + get_ontology(project_identifier='tp', + outfile='_test-onto.json', server=self.server, user=self.user, password='test', verbose=False) - with open('_anything-onto.json') as f: + with open('_test-onto.json') as f: onto_json_str = f.read() - anything_onto_out = json.loads(onto_json_str) - - self.assertEqual(anything_onto['project']['shortcode'], anything_onto_out['project']['shortcode']) - self.assertEqual(anything_onto['project']['shortname'], anything_onto_out['project']['shortname']) - self.assertEqual(anything_onto['project']['longname'], anything_onto_out['project']['longname']) - - other_tree_list: Any = None - other_tree_list_out: Any = None - not_used_list: Any = None - not_used_list_out: Any = None - tree_list_root: Any = None - tree_list_root_out: Any = None - - for anything_list in anything_onto['project']['lists']: - list_name = anything_list.get('name') - if list_name == 'otherTreeList': - other_tree_list = anything_list - elif list_name == 'notUsedList': - not_used_list = anything_list - elif list_name == 'treelistroot': - tree_list_root = anything_list - - for anything_list in anything_onto_out['project']['lists']: - list_name = anything_list.get('name') - print(anything_list.get('name')) - if list_name == 'otherTreeList': - other_tree_list_out = anything_list - elif list_name == 'notUsedList': - not_used_list_out = anything_list - elif list_name == 'treelistroot': - tree_list_root_out = anything_list - - self.assertEqual(other_tree_list.get('labels'), other_tree_list_out.get('labels')) - self.assertEqual(other_tree_list.get('comments'), other_tree_list_out.get('comments')) - self.assertEqual(other_tree_list.get('nodes'), other_tree_list_out.get('nodes')) + test_onto_out = json.loads(onto_json_str) + + self.assertEqual(test_onto['project']['shortcode'], test_onto_out['project']['shortcode']) + self.assertEqual(test_onto['project']['shortname'], test_onto_out['project']['shortname']) + self.assertEqual(test_onto['project']['longname'], test_onto_out['project']['longname']) + self.assertEqual(test_onto['project']['descriptions'], test_onto_out['project']['descriptions']) + self.assertEqual(sorted(test_onto['project']['keywords']), sorted(test_onto_out['project']['keywords'])) + + groups_expected = test_onto['project']['groups'] + groups_received = test_onto_out['project']['groups'] + group_names_expected = [] + group_descriptions_expected = [] + group_selfjoin_expected = [] + group_status_expected = [] + groups_names_received = [] + group_descriptions_received = [] + group_selfjoin_received = [] + group_status_received = [] + for group in groups_expected: + group_names_expected.append(group["name"]) + group_descriptions_expected.append(group["descriptions"]["en"]) + group_selfjoin_expected.append(group["selfjoin"]) + group_status_expected.append(group["status"]) + for group in groups_received: + groups_names_received.append(group["name"]) + group_descriptions_received.append(group["descriptions"]["en"]) + group_selfjoin_received.append(group["selfjoin"]) + group_status_received.append(group["status"]) + self.assertEqual(sorted(group_names_expected), sorted(groups_names_received)) + self.assertEqual(sorted(group_descriptions_expected), sorted(group_descriptions_received)) + self.assertEqual(group_selfjoin_expected, group_selfjoin_received) + self.assertEqual(group_status_expected, group_status_received) + + users_expected = test_onto['project']['users'] + users_received = test_onto_out['project']['users'] + user_username_expected = [] + user_email_expected = [] + user_given_name_expected = [] + user_family_name_expected = [] + user_lang_expected = [] + user_username_received = [] + user_email_received = [] + user_given_name_received = [] + user_family_name_received = [] + user_lang_received = [] + for user in users_expected: + if user["username"] == "testerKnownUser": # ignore testerKnownUser as he is not part of the project + continue + user_username_expected.append(user["username"]) + user_email_expected.append(user["email"]) + user_given_name_expected.append(user["givenName"]) + user_family_name_expected.append(user["familyName"]) + user_lang_expected.append(user["lang"]) + for user in users_received: + user_username_received.append(user["username"]) + user_email_received.append(user["email"]) + user_given_name_received.append(user["givenName"]) + user_family_name_received.append(user["familyName"]) + user_lang_received.append(user["lang"]) + self.assertEqual(sorted(user_username_expected), sorted(user_username_received)) + self.assertEqual(sorted(user_email_expected), sorted(user_email_received)) + self.assertEqual(sorted(user_given_name_expected), sorted(user_given_name_received)) + self.assertEqual(sorted(user_family_name_expected), sorted(user_family_name_received)) + self.assertEqual(sorted(user_lang_expected), sorted(user_lang_received)) + + ontos_expected = test_onto['project']['ontologies'] + ontos_received = test_onto_out['project']['ontologies'] + onto_names_expected = [] + onto_labels_expected = [] + onto_names_received = [] + onto_labels_received = [] + for onto in ontos_expected: + onto_names_expected.append(onto["name"]) + onto_labels_expected.append(onto["label"]) + for onto in ontos_received: + onto_names_received.append(onto["name"]) + onto_labels_received.append(onto["label"]) + self.assertEqual(sorted(onto_names_expected), sorted(onto_names_received)) + self.assertEqual(sorted(onto_labels_expected), sorted(onto_labels_received)) + + lists = test_onto['project']['lists'] + test_list: dict[str, str] = next((l for l in lists if l['name'] == 'testlist'), {}) + not_used_list: dict[str, str] = next((l for l in lists if l['name'] == 'notUsedList'), {}) + excel_list: dict[str, str] = next((l for l in lists if l['name'] == 'my-list-from-excel'), {}) + + lists_out = test_onto_out['project']['lists'] + test_list_out: dict[str, str] = next((l for l in lists_out if l['name'] == 'testlist'), {}) + not_used_list_out: dict[str, str] = next((l for l in lists_out if l['name'] == 'notUsedList'), {}) + excel_list_out: dict[str, str] = next((l for l in lists_out if l['name'] == 'my-list-from-excel'), {}) + + self.assertEqual(test_list.get('labels'), test_list_out.get('labels')) + self.assertEqual(test_list.get('comments'), test_list_out.get('comments')) + self.assertEqual(test_list.get('nodes'), test_list_out.get('nodes')) self.assertEqual(not_used_list.get('labels'), not_used_list_out.get('labels')) self.assertEqual(not_used_list.get('comments'), not_used_list_out.get('comments')) self.assertEqual(not_used_list.get('nodes'), not_used_list_out.get('nodes')) - self.assertEqual(tree_list_root.get('labels'), tree_list_root_out.get('labels')) - self.assertEqual(tree_list_root.get('comments'), tree_list_root_out.get('comments')) - self.assertEqual(tree_list_root.get('nodes'), tree_list_root_out.get('nodes')) + self.assertEqual(excel_list.get('comments'), excel_list_out.get('comments')) def test_excel_to_json_list(self) -> None: list_excel2json(listname='my_test_list', @@ -100,10 +156,10 @@ def test_excel_to_json_properties(self) -> None: outfile='_properties-out.json') def test_validate_ontology(self) -> None: - validate_ontology('testdata/test-onto.json') + validate_ontology(self.test_onto_file) def test_create_ontology(self) -> None: - create_ontology(input_file='testdata/test-onto.json', + create_ontology(input_file=self.test_onto_file, lists_file='lists-out.json', server=self.server, user=self.user, diff --git a/testdata/BUILD.bazel b/testdata/BUILD.bazel index a7db91d28..1e8fa490e 100644 --- a/testdata/BUILD.bazel +++ b/testdata/BUILD.bazel @@ -8,7 +8,6 @@ filegroup( name = "testdata", visibility = ["//visibility:public"], srcs = [ - "anything-onto.json", "Resources.xlsx", "Properties.xlsx", "lists/description_en.xlsx", diff --git a/testdata/anything-onto.json b/testdata/anything-onto.json deleted file mode 100644 index 8cb2d07bb..000000000 --- a/testdata/anything-onto.json +++ /dev/null @@ -1,990 +0,0 @@ -{ - "prefixes": { - "anything": "http://0.0.0.0:3333/ontology/0001/anything/v2", - "minimal": "http://0.0.0.0:3333/ontology/0001/minimal/v2", - "something": "http://0.0.0.0:3333/ontology/0001/something/v2" - }, - "$schema": "https://raw.githubusercontent.com/dasch-swiss/dsp-tools/main/knora/dsplib/schemas/ontology.json", - "project": { - "shortcode": "0001", - "shortname": "anything", - "longname": "Anything Project", - "descriptions": "Anything Project", - "keywords": [ - "arbitrary test data", - "things" - ], - "lists": [ - { - "name": "otherTreeList", - "labels": { - "en": "Tree list root" - }, - "nodes": [ - { - "name": "Other Tree list node 01", - "labels": { - "en": "Other Tree list node 01" - } - }, - { - "name": "Other Tree list node 02", - "labels": { - "en": "Other Tree list node 02" - } - }, - { - "name": "Other Tree list node 03", - "labels": { - "en": "Other Tree list node 03" - }, - "nodes": [ - { - "name": "Other Tree list node 10", - "labels": { - "en": "Other Tree list node 10" - } - }, - { - "name": "Other Tree list node 11", - "labels": { - "en": "Other Tree list node 11" - } - } - ] - } - ] - }, - { - "name": "notUsedList", - "labels": { - "de": "unbenutzte Liste", - "en": "a list that is not used" - }, - "comments": { - "en": "a list that is not in used in ontology or data" - }, - "nodes": [ - { - "name": "node 1", - "labels": { - "en": "node 1" - }, - "nodes": [ - { - "name": "child of node 1", - "labels": { - "en": "child of node 1" - } - }, - { - "name": "List012", - "labels": { - "en": "List012" - } - }, - { - "name": "List013", - "labels": { - "en": "List013" - } - }, - { - "name": "List014", - "labels": { - "en": "List014" - }, - "nodes": [ - { - "name": "first child of node 014", - "labels": { - "en": "first child of node 014" - } - }, - { - "name": "second child of node 014", - "labels": { - "en": "second child of node 014" - } - } - ] - }, - { - "name": "List015", - "labels": { - "en": "List015" - } - } - ] - }, - { - "name": "node 2", - "labels": { - "en": "node 2" - } - }, - { - "name": "node 3", - "labels": { - "en": "node 3" - }, - "nodes": [ - { - "name": "child of node 3", - "labels": { - "en": "child of node 3" - } - } - ] - } - ] - }, - { - "name": "treelistroot", - "labels": { - "de": "Listenwurzel", - "en": "Tree list root" - }, - "comments": { - "en": "Anything Tree List" - }, - "nodes": [ - { - "name": "Tree list node 01", - "labels": { - "en": "Tree list node 01" - } - }, - { - "name": "Tree list node 02", - "labels": { - "de": "Baumlistenknoten 02", - "en": "Tree list node 02" - } - }, - { - "name": "Tree list node 03", - "labels": { - "en": "Tree list node 03" - }, - "nodes": [ - { - "name": "Tree list node 10", - "labels": { - "en": "Tree list node 10" - } - }, - { - "name": "Tree list node 11", - "labels": { - "en": "Tree list node 11" - } - } - ] - } - ] - } - ], - "ontologies": [ - { - "name": "anything", - "label": "The anything ontology", - "properties": [ - { - "name": "hasBlueThing", - "super": [ - ":hasOtherThing" - ], - "object": ":BlueThing", - "labels": "A blue thing", - "gui_element": "Searchbox" - }, - { - "name": "hasBoolean", - "super": [ - "hasValue" - ], - "object": "BooleanValue", - "labels": "Boolean value", - "gui_element": "Checkbox" - }, - { - "name": "hasColor", - "super": [ - "hasValue" - ], - "object": "ColorValue", - "labels": "Color", - "gui_element": "Colorpicker" - }, - { - "name": "hasDate", - "super": [ - "hasValue" - ], - "object": "DateValue", - "labels": "Date", - "gui_element": "Date" - }, - { - "name": "hasDecimal", - "super": [ - "hasValue" - ], - "object": "DecimalValue", - "labels": "Decimal number", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - }, - { - "name": "hasDocumentTitle", - "super": [ - "hasValue" - ], - "object": "TextValue", - "labels": "document title", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - }, - { - "name": "hasGeometry", - "super": [ - "hasValue" - ], - "object": "GeomValue", - "labels": "Geometry", - "gui_element": "Geometry" - }, - { - "name": "hasGeoname", - "super": [ - "hasValue" - ], - "object": "GeonameValue", - "labels": "Geoname", - "gui_element": "Geonames" - }, - { - "name": "hasInteger", - "super": [ - "hasValue" - ], - "object": "IntValue", - "labels": "Integer", - "gui_element": "Spinbox", - "gui_attributes": { - "max": -1.0, - "min": 0.0 - } - }, - { - "name": "hasInterval", - "super": [ - "hasValue" - ], - "object": "IntervalValue", - "labels": "Time interval", - "gui_element": "Interval" - }, - { - "name": "hasListItem", - "super": [ - "hasValue" - ], - "object": "ListValue", - "labels": "List element", - "gui_element": "List", - "gui_attributes": { - "hlist": "treelistroot" - } - }, - { - "name": "hasOtherListItem", - "super": [ - "hasValue" - ], - "object": "ListValue", - "labels": "Other list element", - "gui_element": "List", - "gui_attributes": { - "hlist": "otherTreeList" - } - }, - { - "name": "hasOtherThing", - "super": [ - "hasLinkTo" - ], - "object": ":Thing", - "labels": "Another thing", - "gui_element": "Searchbox" - }, - { - "name": "hasPictureTitle", - "super": [ - "hasValue" - ], - "object": "TextValue", - "labels": "Title", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - }, - { - "name": "hasRichtext", - "super": [ - "hasValue" - ], - "object": "TextValue", - "labels": "Text", - "gui_element": "Richtext" - }, - { - "name": "hasText", - "super": [ - "hasValue" - ], - "object": "TextValue", - "labels": "Text", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - }, - { - "name": "hasThingDocument", - "super": [ - "hasRepresentation" - ], - "object": ":ThingDocument", - "labels": "document about a thing", - "gui_element": "Searchbox" - }, - { - "name": "hasThingPicture", - "super": [ - "hasRepresentation" - ], - "object": ":ThingPicture", - "labels": "Picture of a thing", - "gui_element": "Searchbox" - }, - { - "name": "hasTimeStamp", - "super": [ - "hasValue" - ], - "object": "TimeValue", - "labels": "Timestamp", - "gui_element": "TimeStamp" - }, - { - "name": "hasUri", - "super": [ - "hasValue" - ], - "object": "UriValue", - "labels": "URI", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - }, - { - "name": "isPartOfOtherThing", - "super": [ - "isPartOf" - ], - "object": ":Thing", - "labels": "is part of", - "gui_element": "Searchbox" - }, - { - "name": "thingHasRegion", - "super": [ - "hasLinkTo" - ], - "object": "Region", - "labels": "has region", - "gui_element": "Searchbox" - } - ], - "resources": [ - { - "name": "BlueThing", - "labels": "Blue thing", - "comments": "Diese Resource-Klasse beschreibt ein blaues Ding", - "super": ":Thing", - "cardinalities": [ - { - "propname": ":hasListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasRichtext", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasText", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasDate", - "cardinality": "0-n", - "gui_order": 3 - }, - { - "propname": ":hasInteger", - "cardinality": "0-n", - "gui_order": 4 - }, - { - "propname": ":hasDecimal", - "cardinality": "0-n", - "gui_order": 5 - }, - { - "propname": ":hasBoolean", - "cardinality": "0-1", - "gui_order": 6 - }, - { - "propname": ":hasUri", - "cardinality": "0-n", - "gui_order": 7 - }, - { - "propname": ":hasInterval", - "cardinality": "0-n", - "gui_order": 9 - }, - { - "propname": ":hasColor", - "cardinality": "0-n", - "gui_order": 10 - }, - { - "propname": ":hasGeometry", - "cardinality": "0-n", - "gui_order": 11 - }, - { - "propname": ":hasGeoname", - "cardinality": "0-n", - "gui_order": 12 - }, - { - "propname": ":hasThingDocument", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingDocumentValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPicture", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPictureValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasTimeStamp", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":isPartOfOtherThing", - "cardinality": "0-n", - "gui_order": 15 - }, - { - "propname": ":isPartOfOtherThingValue", - "cardinality": "0-n", - "gui_order": 15 - }, - { - "propname": ":hasBlueThingValue", - "cardinality": "0-n", - "gui_order": 16 - }, - { - "propname": ":hasBlueThing", - "cardinality": "0-n", - "gui_order": 63 - } - ] - }, - { - "name": "Thing", - "labels": "Thing", - "comments": "'The whole world is full of things, which means there's a real need for someone to go searching for them. And that's exactly what a thing-searcher does.' --Pippi Longstocking", - "super": "Resource", - "cardinalities": [ - { - "propname": ":hasListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherThing", - "cardinality": "0-n", - "gui_order": 1 - }, - { - "propname": ":hasOtherThingValue", - "cardinality": "0-n", - "gui_order": 1 - }, - { - "propname": ":hasRichtext", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasText", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasDate", - "cardinality": "0-n", - "gui_order": 3 - }, - { - "propname": ":hasInteger", - "cardinality": "0-n", - "gui_order": 4 - }, - { - "propname": ":hasDecimal", - "cardinality": "0-n", - "gui_order": 5 - }, - { - "propname": ":hasBoolean", - "cardinality": "0-1", - "gui_order": 6 - }, - { - "propname": ":hasUri", - "cardinality": "0-n", - "gui_order": 7 - }, - { - "propname": ":hasInterval", - "cardinality": "0-n", - "gui_order": 9 - }, - { - "propname": ":hasColor", - "cardinality": "0-n", - "gui_order": 10 - }, - { - "propname": ":hasGeometry", - "cardinality": "0-n", - "gui_order": 11 - }, - { - "propname": ":hasGeoname", - "cardinality": "0-n", - "gui_order": 12 - }, - { - "propname": ":hasThingDocument", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingDocumentValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPicture", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPictureValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasTimeStamp", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":isPartOfOtherThing", - "cardinality": "0-n", - "gui_order": 15 - }, - { - "propname": ":isPartOfOtherThingValue", - "cardinality": "0-n", - "gui_order": 15 - } - ] - }, - { - "name": "ThingDocument", - "labels": "Document", - "comments": "A document about a thing", - "super": "DocumentRepresentation", - "cardinalities": [ - { - "propname": ":hasDocumentTitle", - "cardinality": "0-n" - } - ] - }, - { - "name": "ThingPicture", - "labels": "Picture of a thing", - "comments": "Diese Resource-Klasse beschreibt ein Bild eines Dinges", - "super": "StillImageRepresentation", - "cardinalities": [ - { - "propname": ":hasPictureTitle", - "cardinality": "0-n" - } - ] - }, - { - "name": "ThingWithRegion", - "labels": "Thing with region", - "comments": "A thing with a region", - "super": "Resource", - "cardinalities": [ - { - "propname": ":thingHasRegion", - "cardinality": "0-n" - }, - { - "propname": ":thingHasRegionValue", - "cardinality": "0-n" - } - ] - }, - { - "name": "ThingWithRepresentation", - "labels": "Thing with representation", - "comments": "A thing with a representation", - "super": "Resource", - "cardinalities": [] - }, - { - "name": "ThingWithSeqnum", - "labels": "Thing with sequence number", - "comments": "Diese Resource-Klasse beschreibt ein Ding mit einer Sequenznummer", - "super": ":Thing", - "cardinalities": [ - { - "propname": ":hasListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherThing", - "cardinality": "0-n", - "gui_order": 1 - }, - { - "propname": ":hasOtherThingValue", - "cardinality": "0-n", - "gui_order": 1 - }, - { - "propname": ":hasRichtext", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasText", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": ":hasDate", - "cardinality": "0-n", - "gui_order": 3 - }, - { - "propname": ":hasInteger", - "cardinality": "0-n", - "gui_order": 4 - }, - { - "propname": ":hasDecimal", - "cardinality": "0-n", - "gui_order": 5 - }, - { - "propname": ":hasBoolean", - "cardinality": "0-1", - "gui_order": 6 - }, - { - "propname": ":hasUri", - "cardinality": "0-n", - "gui_order": 7 - }, - { - "propname": ":hasInterval", - "cardinality": "0-n", - "gui_order": 9 - }, - { - "propname": ":hasColor", - "cardinality": "0-n", - "gui_order": 10 - }, - { - "propname": ":hasGeometry", - "cardinality": "0-n", - "gui_order": 11 - }, - { - "propname": ":hasGeoname", - "cardinality": "0-n", - "gui_order": 12 - }, - { - "propname": ":hasThingDocument", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingDocumentValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPicture", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasThingPictureValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":hasTimeStamp", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": ":isPartOfOtherThing", - "cardinality": "0-n", - "gui_order": 15 - }, - { - "propname": ":isPartOfOtherThingValue", - "cardinality": "0-n", - "gui_order": 15 - } - ] - }, - { - "name": "TrivialThing", - "labels": "Trivial thing", - "comments": "Diese Resource-Klasse beschreibt ein unbedeutendes Ding", - "super": "Resource", - "cardinalities": [] - } - ] - }, - { - "name": "minimal", - "label": "A minimal ontology", - "properties": [ - { - "name": "hasName", - "super": [ - "hasValue" - ], - "object": "TextValue", - "labels": "has name", - "gui_element": "SimpleText", - "gui_attributes": { - "maxlength": "255", - "size": 80 - } - } - ], - "resources": [] - }, - { - "name": "something", - "label": "The something ontology", - "properties": [ - { - "name": "hasOtherSomething", - "super": [ - "anything:hasOtherThing" - ], - "object": ":Something", - "labels": "has other something", - "gui_element": "Searchbox" - } - ], - "resources": [ - { - "name": "Something", - "labels": "Something", - "comments": "A something is a thing.", - "super": "anything:Thing", - "cardinalities": [ - { - "propname": "anything:hasListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": "anything:hasOtherListItem", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherSomething", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": ":hasOtherSomethingValue", - "cardinality": "0-n", - "gui_order": 0 - }, - { - "propname": "anything:hasRichtext", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": "anything:hasText", - "cardinality": "0-n", - "gui_order": 2 - }, - { - "propname": "anything:hasDate", - "cardinality": "0-n", - "gui_order": 3 - }, - { - "propname": "anything:hasInteger", - "cardinality": "0-n", - "gui_order": 4 - }, - { - "propname": "anything:hasDecimal", - "cardinality": "0-n", - "gui_order": 5 - }, - { - "propname": "anything:hasBoolean", - "cardinality": "0-1", - "gui_order": 6 - }, - { - "propname": "anything:hasUri", - "cardinality": "0-n", - "gui_order": 7 - }, - { - "propname": "anything:hasInterval", - "cardinality": "0-n", - "gui_order": 9 - }, - { - "propname": "anything:hasColor", - "cardinality": "0-n", - "gui_order": 10 - }, - { - "propname": "anything:hasGeometry", - "cardinality": "0-n", - "gui_order": 11 - }, - { - "propname": "anything:hasGeoname", - "cardinality": "0-n", - "gui_order": 12 - }, - { - "propname": "anything:hasThingDocument", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": "anything:hasThingDocumentValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": "anything:hasThingPicture", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": "anything:hasThingPictureValue", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": "anything:hasTimeStamp", - "cardinality": "0-n", - "gui_order": 13 - }, - { - "propname": "anything:isPartOfOtherThing", - "cardinality": "0-n", - "gui_order": 15 - }, - { - "propname": "anything:isPartOfOtherThingValue", - "cardinality": "0-n", - "gui_order": 15 - } - ] - } - ] - } - ] - } -} diff --git a/testdata/test-onto.json b/testdata/test-onto.json index f8b6c4363..bc39975f1 100644 --- a/testdata/test-onto.json +++ b/testdata/test-onto.json @@ -80,6 +80,27 @@ "nodes": { "folder": "testdata/lists" } + }, + { + "name": "notUsedList", + "labels": { + "en": "Not used list" + }, + "comments": { + "en": "no comment", + "de": "kein Kommentar" + }, + "nodes": [ + { + "name": "notUsedNode_1", + "labels": { + "en": "nodeLabel_1" + }, + "comments": { + "en": "no comment" + } + } + ] } ], "groups": [