Skip to content

Commit

Permalink
Merge pull request #65 from co-cddo/issue-59/slot-usage
Browse files Browse the repository at this point in the history
Update display of obligations on property page
  • Loading branch information
cyberdudeuk authored Oct 31, 2023
2 parents 3923023 + ecb11e6 commit e139e32
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 39 deletions.
29 changes: 12 additions & 17 deletions src/docs/templates/slot.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@
{% if element.description %}
{% set element_description_lines = element.description.split('\n') %}
{% for element_description_line in element_description_lines %}
{{ element_description_line }}
_{{ element_description_line }}_
{% endfor %}
{% endif %}

URI: {{ gen.uri_link(element) }}

## Obligation and Cardinality

The obligation or cardinality can be overridden when used by classes. Check the [Applicable Classes](#applicable-classes) section below for details.
The table below details the classes which use this property and the conditions of its use.

| URL | Range | Obligation | Cardinality |
| Class | Range | Obligation | Cardinality |
|-----------------------------|-----------------------------|-------------|-------------|
| {{ gen.uri_link(element) }} | {{gen.link(element.range)}} {% if element.minimum_value is not none %}<br/>Minimum Value: {{ element.minimum_value|int }}{% endif %}{% if element.maximum_value is not none %}<br/>Maximum Value: {{ element.maximum_value|int }}{% endif %}{% if element.pattern %}<br/>Regex pattern: {{ '`' }}{{ element.pattern }}{{ '`' }}{% endif %} | {% if element.required %}Mandatory{% elif element.recommended %}Recommended{% else %}Optional{% endif %} | {% if element.multivalued %}Many{% else %}One{% endif %} |
{% for c in schemaview.get_classes_by_slot(element, include_induced=True) -%}
{%- for slot in schemaview.class_induced_slots(c) -%}
{%- if gen.name(slot) == gen.name(element) -%}
| {{ gen.link(c) }} | {{ gen.link(slot.range) }}{% if slot.minimum_value is not none %}<br/>Minimum Value: {{ slot.minimum_value|int }}{% endif %}{% if slot.maximum_value is not none %}<br/>Maximum Value: {{ slot.maximum_value|int }}{% endif %}{% if slot.pattern %}<br/>Regex pattern: {{ '`' }}{{ slot.pattern }}{{ '`' }}{% endif %} | {% if slot.required %}Mandatory{% elif slot.recommended %}Recommended{% else %}Optional{% endif %} | {% if slot.multivalued %}Many{% else %}One{% endif %} |
{%- endif -%}
{% endfor %}
{% endfor %}

{% if schemaview.is_mixin(element.name) %}
Mixin: {{ element.mixin }}
Expand Down Expand Up @@ -56,19 +64,6 @@ _Usage notes still to be provided._
<!-- no inheritance hierarchy -->
{% endif %}

{% if schemaview.get_classes_by_slot(element, include_induced=True) %}

## Applicable Classes

| Name | Description | Modifies Property |
| --- | --- | --- |
{% for c in schemaview.get_classes_by_slot(element, include_induced=True) -%}
{{ gen.link(c) }} | {{ schemaview.get_class(c).description|enshorten }} | {% if c in schemaview.get_classes_modifying_slot(element) %} yes {% else %} no {% endif %} |
{% endfor %}

{% endif %}


{% if schemaview.is_mixin(element.name) %}
## Mixin Usage

Expand Down
42 changes: 20 additions & 22 deletions src/model/uk_cross_government_metadata_exchange_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ classes:
- type
- theme
- version
slot_usage:
accessRights:
required: true
description:
required: true
modified:
required: true

DataService:
is_a: DataResource
Expand Down Expand Up @@ -115,12 +122,7 @@ classes:
- title
- type
slot_usage:
accessRights:
required: false
description:
required: false
modified:
required: false
recommended: true

Organisation:
Expand All @@ -146,7 +148,6 @@ slots:
accessRights:
slot_uri: dct:accessRights
description: A rights statement that concerns how the distribution is accessed.
required: true
range: AccessRightsValues
address:
slot_uri: vcard:hasAddress
Expand Down Expand Up @@ -183,7 +184,7 @@ slots:
Include special characters such as quotations marks, apostrophes, and accented characters, e.g. Métis.
byteSize:
slot_uri: dcat:byteSize
description: |
description: |-
The filesize of the item (file) being described.
The size of the distribution in bytes.
recommended: true
Expand Down Expand Up @@ -235,7 +236,7 @@ slots:
# - range: ContactPoint
created:
slot_uri: dct:created
description: |
description: |-
The date, or date and time, on which the content of an information resource is created or compiled.
__When used on a metadata record__ The date and time on which an information resource is made available through the catalogue.
Expand Down Expand Up @@ -290,10 +291,9 @@ slots:
- Decide what to do about `contributor`
description:
slot_uri: dct:description
description: |
description: |-
A concise narrative of the content of an information resource.
A free-text account of the distribution.
required: true
range: string
comments: |
purpose:
Expand All @@ -318,7 +318,7 @@ slots:
# range: Dataset
downloadURL:
slot_uri: dcat:downloadURL
description: |
description: |-
The electronic location where the item (file) being described can be found.
The URL of the downloadable file in a given format. E.g., CSV file or RDF file. The format is indicated by the distribution's `dcterms:format` and/or `dcat:mediaType`.
range: uri
Expand Down Expand Up @@ -351,7 +351,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
range: uri
identifier:
slot_uri: dct:identifier
description: |
description: |-
A unique number, code, or reference value assigned to an information resource within a given context.
A unique identifier of the resource being described or catalogued.
identifier: true
Expand Down Expand Up @@ -419,7 +419,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
- Special characters, such as accent marks, should be included as long as they reflect common usage (e.g. Métis).
licence:
slot_uri: dct:license
description: |
description: |-
Reference to the legal document outlining access and usage rights for an information resource.
A legal document under which the distribution is made available.
required: true
Expand All @@ -436,7 +436,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
Rules as per Open Data Policy, all information and data that is made publicly available by HMG is likely to be released under the Open Government licence unless it is exempt under specific conditions. Any other applicable licences should be explicitly stated.
mediaType:
slot_uri: dcat:mediaType
description: |
description: |-
The file format or encoding method of the item (file) being described.
The media type of the distribution as defined by IANA [IANA-MEDIA-TYPES](https://www.iana.org/assignments/media-types/media-types.xhtml).
required: true
Expand All @@ -462,7 +462,6 @@ Note that there could be a security risk in sharing the endpoint URL for interna
modified:
slot_uri: dct:modified
description: The date, or date and time, on which the content of an information resource is changed.
required: true
range: date
comments: |
purpose:
Expand Down Expand Up @@ -557,15 +556,14 @@ Note that there could be a security risk in sharing the endpoint URL for interna
The value of the `servesData` property should be the URI that identifies a dataset.
serviceStatus:
slot_uri: adms:status
description: |
description: |-
The status of the resource in the context of a particular workflow process.
Lifecycle status
required: true
range: ServiceStatusValues
serviceType:
slot_uri: dct:type
description: |
description: |-
The nature or genre of the resource.
The business design or structure used in the presentation and publication of an information resource.
Expand All @@ -575,7 +573,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
range: ServiceTypeValues
summary:
slot_uri: rdfs:comment
description: |
description: |-
A short textual summary of the resource with a maximum length of 250 characters.
recommended: true
range: string
Expand All @@ -595,7 +593,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
range: string
theme:
slot_uri: dcat:theme
description: |
description: |-
Topic
A controlled term that expresses the broad topical content of an information resource.
Subject
Expand Down Expand Up @@ -641,7 +639,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
- Indicate vocabularies to be used
title:
slot_uri: dct:title
description: |
description: |-
The full and formal name given to an information resource.
A name given to the distribution.
required: true
Expand Down Expand Up @@ -673,7 +671,7 @@ Note that there could be a security risk in sharing the endpoint URL for interna
range: uriorcurie
updateFrequency:
slot_uri: dct:accrualPeriodicity
description: |
description: |-
The time interval at which new or updated versions of an information resource are issued.
The frequency at which a dataset is published.
Expand Down

0 comments on commit e139e32

Please sign in to comment.