Skip to content

Commit 8671be4

Browse files
authored
Merge pull request #221 from OpenSemanticLab/fix/category-template-selection
fix: select category templates from the schema allOf like the wiki
2 parents dce6069 + 799bc07 commit 8671be4

13 files changed

Lines changed: 3814 additions & 55 deletions

‎src/osw/core.py‎

Lines changed: 276 additions & 46 deletions
Large diffs are not rendered by default.

‎tests/fixtures/category_template_selection/after-form-editor-save.json‎

Lines changed: 568 additions & 0 deletions
Large diffs are not rendered by default.

‎tests/fixtures/category_template_selection/before-form-editor-save.json‎

Lines changed: 586 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"label": [
3+
{
4+
"text": "Category (Class)",
5+
"lang": "en"
6+
}
7+
],
8+
"uuid": "89aafe6d-ae5a-4f29-97ff-df7736d4cab6",
9+
"description": [
10+
{
11+
"text": "Meta-Category for Categories",
12+
"lang": "en"
13+
}
14+
],
15+
"name": "CategoryClass",
16+
"type": [
17+
"Category:Category"
18+
]
19+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"@context": [
3+
{
4+
"exact_ontology_match***": {
5+
"@id": "owl:equivalentClass",
6+
"@type": "@id"
7+
},
8+
"subclass_of": {
9+
"@id": "rdfs:subClassOf",
10+
"@type": "@id"
11+
},
12+
"subclass_of*": {
13+
"@id": "Property:SubClassOf",
14+
"@type": "@id"
15+
},
16+
"version": "owl:versionInfo",
17+
"version*": "Property:HasVersion",
18+
"utf8_icon": "Property:HasUtf8Icon"
19+
},
20+
"/wiki/Category:OSWffe74f291d354037b318c422591c5023?action=raw&slot=jsonschema"
21+
],
22+
"allOf": [
23+
{
24+
"$ref": "/wiki/Category:OSWffe74f291d354037b318c422591c5023?action=raw&slot=jsonschema"
25+
}
26+
],
27+
"uuid": "89aafe6d-ae5a-4f29-97ff-df7736d4cab6",
28+
"type": "object",
29+
"title": "Category",
30+
"title*": {
31+
"de": "Kategorie (Klasse)",
32+
"en": "Category (Class)"
33+
},
34+
"required": [
35+
"subclass_of",
36+
"type"
37+
],
38+
"defaultProperties": [
39+
"version"
40+
],
41+
"properties": {
42+
"type": {
43+
"items": {
44+
"subclassof_range": "Category:Category",
45+
"format": "autocomplete",
46+
"options": {
47+
"autocomplete": {
48+
"$comment": "All categories here since subclassof_range is limited by depth 5",
49+
"query": "[[:Category:%2B]]"
50+
}
51+
}
52+
},
53+
"default": [
54+
"Category:Category"
55+
],
56+
"options": {
57+
"hidden": true
58+
}
59+
},
60+
"version": {
61+
"title": "Version",
62+
"title*": {
63+
"de": "Version"
64+
},
65+
"description": "Human-readable version string (e.g. 1.0.1) following https://semver.org/",
66+
"description*": {
67+
"de": "Für Menschen lesbare Versionszeichenfolge (z.B. 1.0.1) gemäß https://semver.org/"
68+
},
69+
"type": "string",
70+
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
71+
"propertyOrder": -1010,
72+
"default": "0.1.0"
73+
},
74+
"subclass_of": {
75+
"title": "Supercategories",
76+
"title*": {
77+
"de": "Überkategorien"
78+
},
79+
"type": "array",
80+
"propertyOrder": -1009,
81+
"items": {
82+
"title": "Category",
83+
"title*": {
84+
"de": "Kategorie"
85+
},
86+
"type": "string",
87+
"format": "autocomplete",
88+
"subclassof_range": "Category:Entity"
89+
},
90+
"default": [
91+
"Category:Entity"
92+
],
93+
"options": {
94+
"hidden": false
95+
}
96+
},
97+
"utf8_icon": {
98+
"type": "array",
99+
"title": "UTF8-Icons",
100+
"title*": {
101+
"de": "UTF8-Symbole"
102+
},
103+
"description": "see https://www.unicode.org/cldr/charts/latest/annotations/romance.html",
104+
"description*": {
105+
"de": "siehe https://www.unicode.org/cldr/charts/latest/annotations/germanic.html"
106+
},
107+
"items": {
108+
"type": "string",
109+
"title": "UTF8-Icon",
110+
"minLength": 1,
111+
"maxLength": 2
112+
}
113+
}
114+
}
115+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"@context": [
3+
{{#each subclass_of}}
4+
"/wiki/{{{.}}}?action=raw\u0026slot=jsonschema"{{#unless @last}},{{/unless}}
5+
{{/each}}
6+
],
7+
"allOf": [
8+
{{#if subclass_of}}{{#each subclass_of}}
9+
{"$ref": "/wiki/{{{.}}}?action=raw\u0026slot=jsonschema"}{{#unless @last}},{{/unless}}
10+
{{/each}}{{else}}
11+
{}
12+
{{/if}}
13+
],
14+
"type": "object",
15+
"uuid": "{{{uuid}}}",
16+
{{#if version}}"x-oold-version": "{{{version}}}",{{/if}}
17+
"title": "{{{name}}}",
18+
"title*": {
19+
{{#each label}}
20+
"{{{lang}}}": "{{{text}}}"{{#unless @last}},{{/unless}}
21+
{{/each}}
22+
},
23+
"description": "{{{description.[0].text}}}",
24+
"description*": {
25+
{{#each description}}
26+
"{{{lang}}}": "{{{text}}}"{{#unless @last}},{{/unless}}
27+
{{/each}}
28+
},
29+
"required": [
30+
"type"
31+
],
32+
"properties": {
33+
"type": {
34+
"default": ["{{{_page_title}}}"]
35+
}
36+
}
37+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"subclass_of": [
3+
"Category:Entity"
4+
],
5+
"type": [
6+
"Category:Category"
7+
],
8+
"uuid": "ffe74f29-1d35-4037-b318-c422591c5023",
9+
"label": [
10+
{
11+
"text": "Characteristic Type",
12+
"lang": "en"
13+
},
14+
{
15+
"text": "Charakteristik-Typ",
16+
"lang": "de"
17+
}
18+
],
19+
"description": [
20+
{
21+
"text": "A set of properties intended to be used in other characteristic types or classes",
22+
"lang": "en"
23+
},
24+
{
25+
"text": "Ein Satz von Eigenschaften zur Nutzung in anderen Charakteristik-Typen oder Klassen",
26+
"lang": "de"
27+
}
28+
],
29+
"name": "CharacteristicType"
30+
}

0 commit comments

Comments
 (0)