diff --git a/knora/dsplib/models/resourceclass.py b/knora/dsplib/models/resourceclass.py index 65d53c358..485af4674 100644 --- a/knora/dsplib/models/resourceclass.py +++ b/knora/dsplib/models/resourceclass.py @@ -700,8 +700,6 @@ def resolve_resref(resref: str): superclasses = [{"@id": "knora-api:Resource"}] else: superclasses = list(map(resolve_resref, self._superclasses)) - if self._comment is None or self._comment.isEmpty(): - self._comment = LangString({"en": "[no comment provided]"}) if self._label is None or self._label.isEmpty(): self._label = LangString("no label available") tmp = { @@ -712,11 +710,14 @@ def resolve_resref(resref: str): "@id": resid, "@type": "owl:Class", "rdfs:label": self._label.toJsonLdObj(), - "rdfs:comment": self._comment.toJsonLdObj(), "rdfs:subClassOf": superclasses }], "@context": self._context.toJsonObj(), } + if self._comment: + tmp["@graph"][0]["rdfs:comment"] = self._comment.toJsonLdObj() + print(tmp) + elif action == Actions.Update: tmp = { "@id": ontid, # self._ontology_id, diff --git a/knora/dsplib/utils/onto_create_ontology.py b/knora/dsplib/utils/onto_create_ontology.py index 786c9bfc0..63ab3f6af 100644 --- a/knora/dsplib/utils/onto_create_ontology.py +++ b/knora/dsplib/utils/onto_create_ontology.py @@ -426,8 +426,6 @@ def create_ontology(input_file: str, res_comment = res_class.get("comments") if res_comment: res_comment = LangString(res_comment) - else: - res_comment = LangString({"en": "[no comment provided]"}) # if no cardinalities are submitted, don't create the class if not res_class.get("cardinalities"): print(f"ERROR while trying to add cardinalities to class '{res_name}'. No cardinalities submitted. At" @@ -505,8 +503,6 @@ def create_ontology(input_file: str, prop_comment = prop_class.get("comments") if prop_comment: prop_comment = LangString(prop_comment) - else: - prop_comment = LangString({"en": "[no comment provided]"}) new_prop_class = None try: diff --git a/testdata/test-onto.json b/testdata/test-onto.json index bc39975f1..208524113 100644 --- a/testdata/test-onto.json +++ b/testdata/test-onto.json @@ -31,9 +31,6 @@ "name": "a", "labels": { "en": "a_label with a\"post'rophes" - }, - "comments": { - "en": "no comment" } }, { @@ -60,9 +57,6 @@ "name": "c", "labels": { "en": "c_label" - }, - "comments": { - "en": "no comment" } } ] @@ -95,9 +89,6 @@ "name": "notUsedNode_1", "labels": { "en": "nodeLabel_1" - }, - "comments": { - "en": "no comment" } } ] @@ -186,6 +177,10 @@ "labels": { "en": "Text" }, + "comments": { + "en": "properties can optionally have comments", + "de": "Properties können Kommentare haben" + }, "gui_element": "SimpleText", "gui_attributes": { "maxlength": 255, @@ -358,10 +353,6 @@ "labels": { "en": "TestThing" }, - "comments": { - "en": "A thing to test things", - "de": "Ein Ding um allerlei Dinge zu testen." - }, "cardinalities": [ { "propname": ":hasText", @@ -441,9 +432,6 @@ "labels": { "en": "Another Test Thing" }, - "comments": { - "en": "Another thing for testing things." - }, "cardinalities": [ { "propname": ":hasText",