Skip to content
Permalink
Browse files
chore(schemas): update schemas (DSP-1902) (#92)
* enforce schema reference to ontology

* update schema version and id

* update schema titles and descriptions

* correct typo

* restructure schemas

* test external xsd schema

* update schema reference

* update schema reference url in xml

* use uri-prop
  • Loading branch information
irinaschubert committed Sep 20, 2021
1 parent c46618f commit 16ba335c1e8bb687a53dd8e376d88a39f2f0aa44
Empty file.

Large diffs are not rendered by default.

@@ -1,8 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://knora.org/pyknora/ontology/knora-schema-list-only.json",
"title": "Knora JSON schema for lists only",
"description": "JSON schema for lists used in Knora ontologies",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://dasch.swiss/schema/knora-schema-list-only.json",
"title": "JSON schema for DSP lists",
"description": "JSON schema for the lists section used in DSP ontologies",
"definitions": {
"label": {
"type": "object",
@@ -1,9 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://knora.org/pyknora/ontology/knora-schema.json",
"title": "Knora JSON schema",
"description": "JSON Schema for Knora ontologies",

"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://dasch.swiss/schema/knora-schema.json",
"title": "JSON schema for DSP lists",
"description": "JSON schema for lists used in DSP ontologies",
"definitions": {
"label": {
"type": "object",
@@ -74,17 +73,25 @@
}
}
},
"required": ["shortcode", "lists"],
"required": [
"shortcode",
"lists"
],
"additionalProperties": false
},
"prefixes": {
"type": "object",
"patternProperties": {
"^[\\w-]+$": { "format" : "uri" }
"^[\\w-]+$": {
"format": "uri"
}
},
"additionalProperties": false
}
},
"required": ["prefixes", "project"],
"required": [
"prefixes",
"project"
],
"additionalProperties": false
}
@@ -1,11 +1,9 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://knora.org/pyknora/ontology/knora-schema.json",
"title": "knora-py JSON schema",
"description": "JSON Schema for Knora ontologies",

"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://dasch.swiss/schema/knora-schema.json",
"title": "JSON schema for DSP ontologies",
"description": "JSON schema for DSP ontologies",
"definitions": {

"langstring": {
"anyOf": [
{
@@ -22,32 +20,29 @@
}
]
},

"label": {
"$ref": "#/definitions/langstring"
},

"description": {
"$ref": "#/definitions/langstring"
},

"comment": {
"$ref": "#/definitions/langstring"
},

"groupdef": {
"type": "string",
"pattern": "^(([\\w-]*)?:([\\w ]+))|(SystemAdmin)$",
"additionalProperties": false
},

"projectdef": {
"type": "string",
"pattern": "^([\\w-]*)?:(member|admin)$"
},

"resourcedef": {
"type": ["string", "array"],
"type": [
"string",
"array"
],
"oneOf": [
{
"enum": [
@@ -74,7 +69,6 @@
"$ref": "#/definitions/resourcedef"
}
},

"excelref": {
"type": "object",
"properties": {
@@ -91,9 +85,11 @@
"type": "integer"
}
},
"required": ["file", "worksheet"]
"required": [
"file",
"worksheet"
]
},

"user": {
"type": "object",
"properties": {
@@ -128,9 +124,14 @@
}
}
},
"required": ["username", "email", "givenName", "familyName", "password"]
"required": [
"username",
"email",
"givenName",
"familyName",
"password"
]
},

"group": {
"type": "object",
"properties": {
@@ -147,9 +148,11 @@
"type": "boolean"
}
},
"required": ["name", "description"]
"required": [
"name",
"description"
]
},

"node": {
"type": "object",
"properties": {
@@ -177,10 +180,12 @@
]
}
},
"required": ["name", "labels"],
"required": [
"name",
"labels"
],
"additionalProperties": false
},

"ontology": {
"type": "object",
"properties": {
@@ -199,17 +204,21 @@
"$ref": "#/definitions/property"
}
},
"resources": {
"resources": {
"type": "array",
"items": {
"$ref": "#/definitions/resource"
}
}
},
"required": ["name", "label", "properties", "resources"],
"required": [
"name",
"label",
"properties",
"resources"
],
"additionalProperties": false
},

"property": {
"type": "object",
"properties": {
@@ -275,11 +284,9 @@
"type": "string",
"pattern": "^([\\w-]+)?:(\\w+)$"
},

"labels": {
"$ref": "#/definitions/label"
},

"gui_element": {
"type": "string",
"enum": [
@@ -302,7 +309,6 @@
"Fileupload"
]
},

"gui_attributes": {
"type": "object",
"properties": {
@@ -333,7 +339,10 @@
},
"wrap": {
"type": "string",
"enum": ["soft", "hard"]
"enum": [
"soft",
"hard"
]
},
"max": {
"type": "number"
@@ -343,23 +352,30 @@
}
}
},

"comments": {
"$ref": "#/definitions/comment"
}
},
"required": ["name", "object", "labels", "gui_element"],
"required": [
"name",
"object",
"labels",
"gui_element"
],
"additionalProperties": false
},

"cardinality":{
"cardinality": {
"type": "object",
"properties": {
"propname": {
"type": "string",
"oneOf": [
{
"enum": ["Region", "isPartOf", "seqnum"]
"enum": [
"Region",
"isPartOf",
"seqnum"
]
},
{
"pattern": "^(([\\w-]*)?:([\\w ]+))$"
@@ -368,16 +384,23 @@
},
"cardinality": {
"type": "string",
"enum": ["1", "0-1", "1-n", "0-n"]
"enum": [
"1",
"0-1",
"1-n",
"0-n"
]
},
"gui_order": {
"type": "integer"
}
},
"required": ["propname", "cardinality"],
"required": [
"propname",
"cardinality"
],
"additionalProperties": false
},

"resource": {
"type": "object",
"properties": {
@@ -400,21 +423,29 @@
}
}
},
"required": ["name", "super", "labels", "cardinalities"],
"required": [
"name",
"super",
"labels",
"cardinalities"
],
"additionalProperties": false
}
},

"type": "object",
"properties": {
"prefixes": {
"type": "object",
"patternProperties": {
"^[\\w-]+$": { "format" : "uri" }
"^[\\w-]+$": {
"format": "uri"
}
},
"additionalProperties": false
},

"$schema": {
"type": "string"
},
"project": {
"type": "object",
"properties": {
@@ -449,25 +480,32 @@
"$ref": "#/definitions/user"
}
},

"lists": {
"type": "array",
"items": {
"$ref": "#/definitions/node"
}
},

"ontologies": {
"type": "array",
"items": {
"$ref": "#/definitions/ontology"
}
}
},
"required": ["shortcode", "shortname", "longname", "ontologies", "keywords"],
"required": [
"shortcode",
"shortname",
"longname",
"ontologies",
"keywords"
],
"additionalProperties": false
}
},
"required": ["project"],
"required": [
"$schema",
"project"
],
"additionalProperties": false
}
@@ -1,8 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://knora.org/pyknora/ontology/knora-schema-resources-only.json",
"title": "Knora JSON schema for resources only",
"description": "JSON schema for resources used in Knora ontologies",
"$schema": "https://json-schema.org/draft/2020-12/schema#",
"$id": "https://dasch.swiss/schema/knora-schema-resources-only.json",
"title": "JSON schema for resources used in DSP ontologies",
"description": "JSON schema for the resources section used in DSP ontologies",
"definitions": {
"langstring": {
"anyOf": [
@@ -258,7 +258,7 @@ def validate_list_with_schema(json_list: str) -> bool:
"""
current_dir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(current_dir, 'knora-schema-lists-only.json')) as schema:
with open(os.path.join(current_dir, '../schemas/lists-only.json')) as schema:
list_schema = json.load(schema)

try:
@@ -17,7 +17,7 @@ def validate_resources_with_schema(json_file: str) -> bool:
"""
current_dir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(current_dir, 'knora-schema-resources-only.json')) as schema:
with open(os.path.join(current_dir, '../schemas/resources-only.json')) as schema:
resources_schema = json.load(schema)

try:
Loading

0 comments on commit 16ba335

Please sign in to comment.