Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make comments optional for new properties and resources (DEV-502) #158

Merged
merged 5 commits into from Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions knora/dsplib/models/resourceclass.py
Expand Up @@ -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 = {
Expand Down
4 changes: 0 additions & 4 deletions knora/dsplib/utils/onto_create_ontology.py
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
22 changes: 5 additions & 17 deletions testdata/test-onto.json
Expand Up @@ -31,15 +31,12 @@
"name": "a",
"labels": {
"en": "a_label with a\"post'rophes"
},
"comments": {
"en": "no comment"
}
},
{
"name": "b",
"labels": {
"en": "b_label with no comment"
"en": "b_label with a comment"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"no" was correct, wasn't it? This node doesn't have a comment.

},
"nodes": [
{
Expand All @@ -60,9 +57,6 @@
"name": "c",
"labels": {
"en": "c_label"
},
"comments": {
"en": "no comment"
}
}
]
Expand Down Expand Up @@ -95,9 +89,6 @@
"name": "notUsedNode_1",
"labels": {
"en": "nodeLabel_1"
},
"comments": {
"en": "no comment"
}
}
]
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -441,9 +432,6 @@
"labels": {
"en": "Another Test Thing"
},
"comments": {
"en": "Another thing for testing things."
},
"cardinalities": [
{
"propname": ":hasText",
Expand Down