Skip to content

Commit

Permalink
feature/mx-1478 more model alignments (#8)
Browse files Browse the repository at this point in the history
- add empty arrays as defaults (`"default": []`) to list fields with no min items
- consistently use `anyOf` instead of `oneOf` for union types
- allow `"type": "null"` for non-required fields and set `null` as default
- put `examples` and `useScheme` on the correct levels for array/union fields
- update identifier pattern to match new implementation
- bump version to `2.2.0`
  • Loading branch information
cutoffthetop authored Dec 18, 2023
1 parent 7d5fb5f commit d8ef77a
Show file tree
Hide file tree
Showing 26 changed files with 543 additions and 291 deletions.
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
fail_fast: false
default_language_version:
python: python3.11
files: schema
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: pretty-format-json
name: json
args: [--autofix, --no-sort-keys, --indent=4, --no-ensure-ascii]
- id: check-yaml
name: yaml
- id: end-of-file-fixer
name: eof
- id: trailing-whitespace
name: whitespaces
- id: fix-byte-order-marker
name: byte-order
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ data Findable, Accessible, Interoperable and Reusable.

## package

The `mex-model` repository contains two models:
The `mex-model` repository contains the MEx metadata model in two formats.

- the conceptual model, which is mainly used to facilitate interoperability with other metadata schemas and models
- the json schema, which represents the conceptual model in a format that can be used for technical implementation in applications
- `/docs` contains the conceptual model, which is mainly used to facilitate
interoperability with other metadata schemas and models
- `mex/model` holds the JSON schema, which represents the conceptual model in a format
that can be used for technical implementation in applications

## license

Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions mex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
Empty file added mex/model/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"sameAs": [
"http://purl.org/dc/terms/alternative"
],
"type": "array"
"type": "array",
"default": []
},
"contact": {
"items": {
"oneOf": [
"anyOf": [
{
"$ref": "/schema/entities/organizational-unit#/identifier"
},
Expand All @@ -28,7 +29,8 @@
"sameAs": [
"http://www.w3.org/ns/dcat#contactPoint"
],
"type": "array"
"type": "array",
"default": []
},
"description": {
"items": {
Expand All @@ -37,26 +39,51 @@
"sameAs": [
"http://purl.org/dc/terms/description"
],
"type": "array"
"type": "array",
"default": []
},
"endpointDescription": {
"$ref": "/schema/fields/link",
"sameAs": [
"http://www.w3.org/ns/dcat#endpointDescription"
]
],
"anyOf": [
{
"$ref": "/schema/fields/link"
},
{
"type": "null"
}
],
"default": null
},
"endpointType": {
"$ref": "/schema/entities/concept#/identifier",
"anyOf": [
{
"$ref": "/schema/entities/concept#/identifier",
"useScheme": "https://mex.rki.de/item/api-type",
"examples": [
"https://mex.rki.de/item/api-type-1"
]
},
{
"type": "null"
}
],
"default": null,
"subPropertyOf": [
"http://purl.org/dc/terms/type"
],
"useScheme": "https://mex.rki.de/item/api-type",
"examples": [
"https://mex.rki.de/item/api-type-1"
]
},
"endpointURL": {
"$ref": "/schema/fields/link",
"anyOf": [
{
"$ref": "/schema/fields/link"
},
{
"type": "null"
}
],
"default": null,
"sameAs": [
"http://www.w3.org/ns/dcat#endpointURL"
]
Expand Down Expand Up @@ -89,7 +116,8 @@
"sameAs": [
"http://www.w3.org/ns/dcat#landingPage"
],
"type": "array"
"type": "array",
"default": []
},
"stableTargetId": {
"$ref": "/schema/fields/identifier"
Expand All @@ -111,7 +139,8 @@
"sameAs": [
"http://purl.org/dc/terms/title"
],
"type": "array"
"type": "array",
"default": []
},
"unitInCharge": {
"items": {
Expand All @@ -120,7 +149,8 @@
"sameAs": [
"http://dcat-ap.de/def/dcatde/maintainer"
],
"type": "array"
"type": "array",
"default": []
}
},
"required": [
Expand Down
87 changes: 52 additions & 35 deletions schema/entities/activity.json → mex/model/entities/activity.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@
"sameAs": [
"http://purl.org/dc/terms/description"
],
"type": "array"
"type": "array",
"default": []
},
"activityType": {
"examples": [
"https://mex.rki.de/item/activity-type-1"
],
"items": {
"$ref": "/schema/entities/concept#/identifier"
"$ref": "/schema/entities/concept#/identifier",
"examples": [
"https://mex.rki.de/item/activity-type-1"
],
"useScheme": "https://mex.rki.de/item/activity-type"
},
"subPropertyOf": [
"http://purl.org/dc/terms/type"
],
"type": "array",
"useScheme": "https://mex.rki.de/item/activity-type"
"default": []
},
"alternativeTitle": {
"items": {
Expand All @@ -31,7 +33,8 @@
"sameAs": [
"http://purl.org/dc/terms/alternative"
],
"type": "array"
"type": "array",
"default": []
},
"contact": {
"items": {
Expand Down Expand Up @@ -60,23 +63,25 @@
"sameAs": [
"http://purl.org/dc/terms/isReferencedBy"
],
"type": "array"
"type": "array",
"default": []
},
"end": {
"items": {
"examples": [
"2024-01-17",
"2024",
"2024-01"
],
"format": "date",
"pattern": "^\\d{4}(-\\d{2})?(-\\d{2})?$",
"type": "string"
},
"examples": [
"2024-01-17",
"2024",
"2024-01"
],
"sameAs": [
"http://www.wikidata.org/entity/P582"
],
"type": "array"
"type": "array",
"default": []
},
"externalAssociate": {
"items": {
Expand All @@ -92,20 +97,23 @@
"sameAs": [
"http://purl.org/dc/terms/contributor"
],
"type": "array"
"type": "array",
"default": []
},
"funderOrCommissioner": {
"items": {
"$ref": "/schema/entities/organization#/identifier"
},
"sameAs": "http://www.wikidata.org/entity/P8324",
"type": "array"
"type": "array",
"default": []
},
"fundingProgram": {
"items": {
"type": "string"
},
"type": "array"
"type": "array",
"default": []
},
"hadPrimarySource": {
"$ref": "/schema/entities/primary-source#/identifier",
Expand Down Expand Up @@ -135,7 +143,8 @@
"sameAs": [
"http://purl.org/dc/terms/contributor"
],
"type": "array"
"type": "array",
"default": []
},
"involvedUnit": {
"items": {
Expand All @@ -144,7 +153,8 @@
"sameAs": [
"http://purl.org/dc/terms/contributor"
],
"type": "array"
"type": "array",
"default": []
},
"isPartOfActivity": {
"items": {
Expand All @@ -154,7 +164,8 @@
"http://purl.org/dc/terms/isPartOf",
"http://www.cidoc-crm.org/cidoc-crm/P9i_forms_part_of"
],
"type": "array"
"type": "array",
"default": []
},
"publication": {
"items": {
Expand All @@ -163,7 +174,8 @@
"sameAs": [
"http://purl.org/dc/terms/isReferencedBy"
],
"type": "array"
"type": "array",
"default": []
},
"responsibleUnit": {
"items": {
Expand All @@ -180,26 +192,28 @@
"sameAs": [
"http://www.wikidata.org/entity/P1813"
],
"type": "array"
"type": "array",
"default": []
},
"stableTargetId": {
"$ref": "/schema/fields/identifier"
},
"start": {
"items": {
"examples": [
"2023-01-16",
"2023",
"2023-02"
],
"format": "date",
"pattern": "^\\d{4}(-\\d{2})?(-\\d{2})?$",
"type": "string"
},
"examples": [
"2023-01-16",
"2023",
"2023-02"
],
"sameAs": [
"http://www.wikidata.org/entity/P580"
],
"type": "array"
"type": "array",
"default": []
},
"succeeds": {
"items": {
Expand All @@ -208,20 +222,22 @@
"sameAs": [
"http://www.cidoc-crm.org/cidoc-crm/P173_start_before_or_with_the_end_of"
],
"type": "array"
"type": "array",
"default": []
},
"theme": {
"examples": [
"https://mex.rki.de/item/theme-1"
],
"items": {
"$ref": "/schema/entities/concept#/identifier"
"examples": [
"https://mex.rki.de/item/theme-1"
],
"$ref": "/schema/entities/concept#/identifier",
"useScheme": "https://mex.rki.de/item/theme"
},
"sameAs": [
"http://www.w3.org/ns/dcat#theme"
],
"type": "array",
"useScheme": "https://mex.rki.de/item/theme"
"default": []
},
"title": {
"items": {
Expand All @@ -241,7 +257,8 @@
"http://www.wikidata.org/entity/P856",
"http://xmlns.com/foaf/0.1/homepage"
],
"type": "array"
"type": "array",
"default": []
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"sameAs": [
"http://purl.org/dc/elements/1.1/description"
],
"type": "array"
"type": "array",
"default": []
},
"identifier": {
"examples": [
Expand All @@ -29,7 +30,8 @@
"sameAs": [
"http://www.w3.org/2000/01/rdf-schema#label"
],
"type": "array"
"type": "array",
"default": []
}
},
"required": [
Expand Down
Loading

0 comments on commit d8ef77a

Please sign in to comment.