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: add romansh (DEV-867) #193

Merged
merged 7 commits into from Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from 6 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
12 changes: 6 additions & 6 deletions docs/dsp-tools-create-ontologies.md
Expand Up @@ -141,16 +141,16 @@ By convention, property names start with a lower case letter.

`"labels": {"<language>": "<string>", ...}`

Collection of `labels` for the property as strings with language tag (currently "en", "de", "fr"
and "it" are supported).
Collection of `labels` for the property as strings with language tag (currently "en", "de", "fr", "it",
and "rm" are supported).

### Comments

(optional)

`"comments": { "<lang>": "<comment>", "<lang>": "<comment>", ... }`

Comments with language tags. Currently, "de", "en", "fr" and "it" are supported. The `comments` element is optional.
Comments with language tags. Currently, "de", "en", "fr", "it", and "rm" are supported. The `comments` element is optional.

### Super

Expand Down Expand Up @@ -780,8 +780,8 @@ By convention, resource names start with a upper case letter.

`"labels": {"<language>": "<string>", ...}`

Collection of `labels` for the resource as strings with language tag (currently "en", "de", "fr"
and "it" are supported).
Collection of `labels` for the resource as strings with language tag (currently "en", "de", "fr", "it",
and "rm" are supported).

### Super

Expand Down Expand Up @@ -844,7 +844,7 @@ resource can have as well as how many times the relation is established.

`"comments": { "<lang>": "<comment>", "<lang>": "<comment>", ... }`

Comments with language tags. Currently, "de", "en", "fr" and "it" are supported. The `comments` element is optional.
Comments with language tags. Currently, "de", "en", "fr", "it", and "rm" are supported. The `comments` element is optional.

Example for a resource definition:

Expand Down
8 changes: 4 additions & 4 deletions docs/dsp-tools-create.md
Expand Up @@ -167,7 +167,7 @@ The longname is a string that provides the full name of the project.

`"descriptions": {"<lang>": "<string>", ...}`

The description is represented as a collection of strings with language tags (currently "en", "de", "fr" and "it" are
The description is represented as a collection of strings with language tags (currently "en", "de", "fr", "it", and "rm" are
supported). It is the description of the project.

### Keywords
Expand Down Expand Up @@ -201,9 +201,9 @@ A node of a list may have the following elements:

- _name_: Name of the node as string. It is mandatory and has to be unique within the list.
- _labels_: Label with language tags in the form `{ "<lang>": "<label>", "<lang>": "<label>", ... }`. The `labels`
element is mandatory. It needs to specify at least one language. Currently, "de", "en", "fr" and "it" are supported.
element is mandatory. It needs to specify at least one language. Currently, "de", "en", "fr", "it", and "rm" are supported.
- _comments_: Comment with language tags in the form `{ "<lang>": "<comment>", "<lang>": "<comment>", ... }`.
Currently, "de", "en", "fr" and "it" are supported. The `comments` element is mandatory for the root node of the list.
Currently, "de", "en", "fr", "it", and "rm" are supported. The `comments` element is mandatory for the root node of the list.
For all other nodes, it is optional. If not used, the element should be omitted.
- _nodes_: Array of sub-nodes. The `nodes` element is optional and can be omitted in case of a flat list.

Expand Down Expand Up @@ -360,7 +360,7 @@ A group definition has the following elements:

- _name_: name of the group, mandatory
- _descriptions_: description of the group with language tags in the form `"descriptions": {"<lang>": "<string>", ...}` (
currently "en", "de", "fr" and "it" are supported), mandatory
currently "en", "de", "fr", "it", and "rm" are supported), mandatory
- _selfjoin_: true if users are allowed to join the group themselves, false if an administrator has to add the users,
optional
- _status_: true if the group is active, false if the group is inactive, optional
Expand Down
2 changes: 1 addition & 1 deletion knora/dsplib/models/group.py
Expand Up @@ -54,7 +54,7 @@ class Group(Model):
Name of the group

descriptions : LangString
Group descriptions in a given language (Languages.EN, Languages.DE, Languages.FR, Languages.IT).
Group descriptions in a given language (Languages.EN, Languages.DE, Languages.FR, Languages.IT, Languages.RM).

project : str | project
either the IRI of a project [get only, cannot be modified after creation of instance]
Expand Down
5 changes: 5 additions & 0 deletions knora/dsplib/models/langstring.py
Expand Up @@ -10,6 +10,7 @@ class Languages(Enum):
DE = 'de'
FR = 'fr'
IT = 'it'
RM = 'rm'


LangStringParam = Optional[Union[dict[Union[Languages, str], str], str]]
Expand Down Expand Up @@ -224,6 +225,8 @@ def fromJsonLdObj(cls, obj: Optional[Union[list[dict[str, str]], str]]) -> 'Lang
lstrs[Languages.FR] = o.get('@value')
elif lang == 'it':
lstrs[Languages.IT] = o.get('@value')
elif lang == 'rm':
lstrs[Languages.RM] = o.get('@value')
else:
if o.get('@value') is not None:
return cls(o.get('@value'))
Expand All @@ -250,6 +253,8 @@ def fromJsonObj(cls, obj: Optional[Any]) -> 'LangString':
lstrs[Languages.FR] = o.get('value')
elif lang == 'it':
lstrs[Languages.IT] = o.get('value')
elif lang == 'rm':
lstrs[Languages.RM] = o.get('value')
else:
if o.get('value') is not None:
return cls(o.get('value'))
Expand Down
4 changes: 2 additions & 2 deletions knora/dsplib/schemas/lists-only.json
Expand Up @@ -7,7 +7,7 @@
"langstring": {
"type": "object",
"patternProperties": {
"^(en|de|fr|it)": {
"^(en|de|fr|it|rm)$": {
"type": "string"
}
},
Expand All @@ -19,7 +19,7 @@
"comment": {
"type": "object",
"patternProperties": {
"^(en|de|fr|it)": {
"^(en|de|fr|it|rm)$": {
"type": "string"
}
},
Expand Down
4 changes: 2 additions & 2 deletions knora/dsplib/schemas/ontology.json
Expand Up @@ -7,7 +7,7 @@
"langstring": {
"type": "object",
"patternProperties": {
"^(en|de|fr|it)": {
"^(en|de|fr|it|rm)$": {
"type": "string"
}
},
Expand Down Expand Up @@ -126,7 +126,7 @@
},
"lang": {
"type": "string",
"pattern": "^(en|de|fr|it)"
"pattern": "^(en|de|fr|it|rm)$"
},
"groups": {
"type": "array",
Expand Down
2 changes: 1 addition & 1 deletion knora/dsplib/schemas/properties-only.json
Expand Up @@ -7,7 +7,7 @@
"langstring": {
"type": "object",
"patternProperties": {
"^(en|de|fr|it)": {
"^(en|de|fr|it|rm)$": {
"type": "string"
}
},
Expand Down
2 changes: 1 addition & 1 deletion knora/dsplib/schemas/resources-only.json
Expand Up @@ -7,7 +7,7 @@
"langstring": {
"type": "object",
"patternProperties": {
"^(en|de|fr|it)": {
"^(en|de|fr|it|rm)$": {
"type": "string"
}
},
Expand Down
27 changes: 18 additions & 9 deletions testdata/test-onto.json
Expand Up @@ -11,7 +11,8 @@
"longname": "test project",
"descriptions": {
"en": "A systematic test project",
"de": "Ein systematisches Testprojekt"
"de": "Ein systematisches Testprojekt",
"rm": "Rumantsch descripziun"
},
"keywords": [
"test",
Expand All @@ -21,17 +22,20 @@
{
"name": "testlist",
"labels": {
"en": "Testlist"
"en": "Testlist",
"rm": "Glista test in Rumantsch"
},
"comments": {
"en": "no comment",
"de": "kein Kommentar"
"de": "kein Kommentar",
"rm": "nagin commentar in Rumantsch"
},
"nodes": [
{
"name": "a",
"labels": {
"en": "a_label with a\"post'rophes"
"en": "a_label with a\"post'rophes",
"rm": "Rumantsch"
}
},
{
Expand Down Expand Up @@ -100,7 +104,8 @@
"name": "testgroupEditors",
"descriptions": {
"en": "Test group editors",
"de": "Testgruppe Editors"
"de": "Testgruppe Editors",
"rm": "squadra test 'Editors' in Rumantsch"
},
"selfjoin": false,
"status": true
Expand Down Expand Up @@ -176,7 +181,8 @@
],
"object": "TextValue",
"labels": {
"en": "Text"
"en": "Text",
"rm": "hasTextChild2 in Rumantsch"
},
"gui_element": "SimpleText"
},
Expand Down Expand Up @@ -204,7 +210,8 @@
},
"comments": {
"en": "properties can optionally have comments",
"de": "Properties können Kommentare haben"
"de": "Properties können Kommentare haben",
"rm": "Property with a Rumantsch comment"
},
"gui_element": "SimpleText",
"gui_attributes": {
Expand Down Expand Up @@ -391,7 +398,8 @@
"externalOnto:thing"
],
"labels": {
"en": "TestThing"
"en": "TestThing",
"rm": "TestThing in Rumantsch"
},
"cardinalities": [
{
Expand Down Expand Up @@ -520,7 +528,8 @@
"en": "A Compound Thing"
},
"comments": {
"en": "A thing for testing compound things."
"en": "A thing for testing compound things.",
"rm": "Rumantsch comment of resource 'CompoundThing'"
},
"cardinalities": [
{
Expand Down