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

chore(schemas): update schemas (DSP-1902) #92

Merged
merged 11 commits into from Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 8 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
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",
Expand Down
@@ -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",
Expand Down Expand Up @@ -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": [
{
Expand All @@ -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": [
Expand All @@ -74,7 +69,6 @@
"$ref": "#/definitions/resourcedef"
}
},

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

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

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

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

"ontology": {
"type": "object",
"properties": {
Expand All @@ -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": {
Expand Down Expand Up @@ -275,11 +284,9 @@
"type": "string",
"pattern": "^([\\w-]+)?:(\\w+)$"
},

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

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

"gui_attributes": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -333,7 +339,10 @@
},
"wrap": {
"type": "string",
"enum": ["soft", "hard"]
"enum": [
"soft",
"hard"
]
},
"max": {
"type": "number"
Expand All @@ -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 ]+))$"
Expand All @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion knora/dsplib/utils/excel_to_json_lists.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion knora/dsplib/utils/excel_to_json_resources.py
Expand Up @@ -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:
Expand Down