metanorma / metanorma-ogc

Metanorma processor for OGC documents
https://www.metanorma.com
BSD 2-Clause "Simplified" License
2 stars 3 forks source link

Validation of OGC requirements as standalone YAML #242

Open opoudjis opened 2 years ago

opoudjis commented 2 years ago

https://github.com/metanorma/ogcapi-processes/issues/2 has resulted in the addition of OGC requirements, properly specified, to metanorma-ogc, as documented in https://www.metanorma.org/author/ogc/topics/requirements/

The Modular Specification, https://www.ogc.org/standards/modularspec, has a grammar of OGC requirements, setting out the cardinalities and attributes of different types of requirement; see Appendix C of that document, which is also represented in https://github.com/opengeospatial/NamingAuthority/blob/master/definitions/models/modspec.ttl and in https://github.com/metanorma/metanorma-requirements-models/issues/11 (which resulted in a LutaML encoding of the UML in ModSpec Appendix C).

It is desirable to validate requirements entered for OGC against this model. This validation could be done within metanorma, but it makes more sense to validate OGC requirements as standalone YAML files, to be included into OGC Metanorma documents via a lutaml plugin.

So

[recommendation,label=/ogc/recommendation/wfs/2,obligation=permission,subject=user,inherit=/ss/584/2015/level/1,classification="control-class:Technical;priority:P0"]
.Widgets
====
[.component,class=conditions]
---
. Candidate test subject is a witch
. Widget has been suitably calibrated for aerodynamics
---

[.component,class=part]
---
Determine travel distance by flight path
---

[[a2]]
[.component,class=part]
---
Independently verify flight path
---

Widgets are tested for aerodynamic flight potential in partnership with witches.
Consult local coven for more information.
====

would be sourced as a standalone YAML file looking like:

class: recommendation
type: requirement_class
obligation: permission
label: /ogc/recommendation/wfs/2
subject: user
inherit: /ss/584/2015/level/1
classification:
  control-class: technical
  priority: p0
caption: Widgets
component:
  conditions:
    - Candidate test subject is a witch
    - Widget has been suitably calibrated for aerodynamics
  part:
    - Determine travel distance by flight path
    - Independently verify flight path

text: |
  Widgets are tested for aerodynamic flight potential in partnership with witches.
  Consult local coven for more information.

And the file would be validated by lutaml for conformance to the UML grammar according to its type.

ghobona commented 8 months ago

Discussed with OGC staff on 2023-11-06.

Agreement to leave this Issue open until a resource becomes available to work on it.

The resource would be a ruby developer that understands the ModSpec.

ghobona commented 4 months ago

Discussed 2024-02-15

Ribose will provide a prototype for showing to the OAB.

ghobona commented 3 months ago

@opoudjis to look into whether there is a schema validation tool/language for YAML (e.g. similar to JSON Schema or XSD).

opoudjis commented 3 months ago

Done in https://github.com/metanorma/metanorma-ogc/issues/493#issuecomment-2007276367 . There are lots of ad hoc schemas specific to implementations, and done as YAML objects themselves. But the standard way of doing it is JSON Schema, since JSON and YAML are both just serialisations of objects; and there is a well-used Ruby implementation of JSON Schema. JSON Schema is kind of clumsy, but I would recommend its use as a recognised standard.