metanorma / metanorma-ogc

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

Inline YAML proposal #716

Open opoudjis opened 2 months ago

opoudjis commented 2 months ago

@gbuehler @ghobona @ogcscotts : We discussed in our latest teleconference the complaint from editors that they have to edit lots of little separate requirement files for a Modspec document, instead of being able to edit a single document containing all the requirements at the same time.

The requirement to have the requirements in separate files for processing is legitimate, but there are a couple of little-used concepts in Metanorma, which we could combine to address this preference:

YAML can be incorporated in an Asciidoc document, as sourcecode. We are already using that, to add YAML-structured metadata into other Metanorma flavours, e.g. for document history.

In addition, there is functionality to associate a filename with sourcecode snippets: this was included to do exactly this, to export soucecode snippets to a filename. We've never actually done it.

I suggest that we:

This is introducing another way of doing Modspec requirements out of YAML:

So, to give an illustration:

= Titile
:mn-document-class: ogc

== Clause

[requirement]
====
[source,yaml,filename=req/1.yaml]
----
conformance_classes:
- name: Validation of XML instance for metadata basic information
  identifier: https://standards.isotc211.org/19115/-1/1/conf/metadata-xml/basic
  target: https://standards.isotc211.org/19115/-1/1/req/metadata-xml/basic
  dependencies:
  - https://standards.isotc211.org/19115/-1/1/conf/metadata-minimal-xml
  - https://standards.isotc211.org/19115/-1/1/conf/metadata-xml/common
  - https://standards.isotc211.org/19115/-1/1/conf/metadata-xml/multilingual
----
====

[requirement]
====
[source,yaml,filename=req/2.yaml]
----
identifier: /req/relief/classes
statement: "For each UML class defined or referenced in the Relief Package:"
parts:
- The Implementation Specification SHALL contain an element which represents the
same concept as that defined for the UML class.
- The Implementation Specification SHALL represent associations with the same
source, target, direction, roles, and multiplicities as those of the UML class.
----
====

Processing will do the following:

My assumption from what you've said tonight is that your editors would rather edit a single file containing two YAML snippets, like the above, than two separate YAML files like req/1.yaml and req/2.yaml

This is a small bit of work, and it's yet another way of doing things; but it builds on notions that are halfway there already in Metanorma.

Let me know if this kind of thing is of interest to your editors. I am going to implement https://github.com/metanorma/modspec-ruby/issues/2 anyway; the code for that would end up reused for this.

opoudjis commented 1 month ago

Would like input from @ogcscotts

ogcscotts commented 1 month ago

@opoudjis I really like this improvement. I presume that the requirement number is being pulled from the filename? Will there also be a means to create the Requirements Classes inline?

ronaldtse commented 1 month ago

@ogcscotts thanks for the feedback! The requirement number is auto-generated per document just like before.

Yes, Requirements Classes can also be generated inline using YAML directly in this syntax. It is actually possible to create the entire Requirements Class with its Requirements embedded in YAML so all the "Requirement Class <==> Requirement" links are automatically built too.

opoudjis commented 4 weeks ago

On hold pending https://github.com/metanorma/modspec-ruby/issues/2 which is pending https://github.com/metanorma/mn-requirements/issues/30 which is pending https://github.com/lutaml/lutaml-model/issues/88