metanorma / mn-samples-plateau

Project PLATEAU by MLIT: Japanese Ministry of Land, Infrastructure, Transport and Tourism (国土交通省)
https://www.mlit.go.jp/plateau/
1 stars 0 forks source link

Convert "Items of concern" (留意事項) to requirements syntax #126

Closed anermina closed 2 months ago

anermina commented 2 months ago

Closes https://github.com/metanorma/mn-samples-plateau/issues/121.

anermina commented 2 months ago

Thanks @anermina , just need to fix block type.

Thank you @ronaldtse, this is now fixed.

ronaldtse commented 2 months ago

Thanks. I've also decided to change to use the URI path att for "points of attention".

The problem right now is that these crash Metanorma (ping @opoudjis ):

[requirement]
.拡張製品仕様書に含めることが望ましい地物型等について
====
[%metadata]
identifier:: /att/decision/1
subject:: 3D都市モデル
statement:: 拡張製品仕様書に含めることが望ましい地物型
+
--
* 「拡張製品仕様書に含めることが望ましい地物型とLODの組み合わせ」(<<tab-1-1>>)として「基本セット」に含まれる「建築物」、「道路」、「都市計画決定情報」、「土地利用」、「災害リスク」及び「地形」の各地物型は、ユースケースの利用有無によらず、3D都市モデルに含むことが望ましい。

* これらの地物型に定義された地物属性のうち、主題属性(名称や種類、面積など、図形以外の属性)について、拡張製品仕様書に含むことが望ましい主題属性を「Annex A拡張製品仕様のための様式」の「取得項目一覧」に示す。

* 拡張製品仕様書に含むべき地物型等の選定においては、「取得項目一覧」を参考にすること。
--
====

Error:

<dt>statement</dt>
Fatal Error: undefined local variable or method `e' for an instance of Metanorma::Requirements::Default
mn-requirements-0.3.7/lib/metanorma/default/cleanup.rb:140:in `reqt_dl_to_classif2': undefined local variable or method `e' for an instance of Metanorma::Requirements::Default (NameError)

        val = term.at("./following::dd/p") || e.at("./following::dd")
                                              ^
    from mn-requirements-0.3.7/lib/metanorma/default/cleanup.rb:134:in `block in reqt_dl_to_classif1'
ronaldtse commented 2 months ago

Changing it into this doesn't crash:

[requirement]
.拡張製品仕様書に含めることが望ましい地物型等について
====
[%metadata]
identifier:: /att/decision/1
subject:: 3D都市モデル
statement:: 拡張製品仕様書に含めることが望ましい地物型
part:: 「拡張製品仕様書に含めることが望ましい地物型とLODの組み合わせ」(<<tab-1-1>>)として「基本セット」に含まれる「建築物」、「道路」、「都市計画決定情報」、「土地利用」、「災害リスク」及び「地形」の各地物型は、ユースケースの利用有無によらず、3D都市モデルに含むことが望ましい。
part:: これらの地物型に定義された地物属性のうち、主題属性(名称や種類、面積など、図形以外の属性)について、拡張製品仕様書に含むことが望ましい主題属性を「Annex A拡張製品仕様のための様式」の「取得項目一覧」に示す。
part::  拡張製品仕様書に含むべき地物型等の選定においては、「取得項目一覧」を参考にすること。
====

There is absolutely no error check on what actually goes wrong.

ronaldtse commented 2 months ago

@opoudjis AsciiDoctor has no issue with such DL, this is an mn-requirements bug. Mucking with XML is always the incorrect solution. It's time to integrate mn-requirements with the ogc-modspec gem.

Screenshot 2024-07-28 at 6 16 06 PM
ronaldtse commented 2 months ago

@anermina Due to the bug discovered, please help do the following:

And please try compiling the document. Thanks.

anermina commented 2 months ago

@ronaldtse Markup was incorrect here.

Instead of

statement::
+
--
text
--

we should use

[statement]
--
text
--

Fixing this.

anermina commented 2 months ago

It seems tables are not supported in the requirement blocks. This causes crashing.

Example of the requirement that refers to a table: image

All the tables that were included in the requirement blocks are now set outside of the blocks (below them) in order to prevent crashing.

Non-existing cross-references in the requirement blocks also cause crashing.

I wasn't able to compile the document even before any of the changes I made, so I thought there was some issue with my environment (this is still possible). Investigating further.

opoudjis commented 2 months ago

@anermina The real issue was that you were providing Modspec markup, but the markup did not explicitly indicate that this was a Modspec requirement, because only OGC treats Modspec as its default. I've just made Modspec the default, as accepted by MLIT; so you should be able to revert the workarounds you did here as of next release (Monday).

... There may well be other issues causing crashes, but changing the default to Modspec will address a lot of this.

opoudjis commented 2 months ago

Non-existing cross-references in the requirement blocks also cause crashing

I've just run into that. I'm going to work around it.

anermina commented 2 months ago

@anermina The real issue was that you were providing Modspec markup, but the markup did not explicitly indicate that this was a Modspec requirement, because only OGC treats Modspec as its default. I've just made Modspec the default, as accepted by MLIT; so you should be able to revert the workarounds you did here as of next release (Monday).

... There may well be other issues causing crashes, but changing the default to Modspec will address a lot of this.

Thank you, @opoudjis ! I thought the default is MRR and I was referring to the documentation from metanorma.org. image

Does this mean MRR was not used by default?

opoudjis commented 2 months ago

So, to clarify:

MRR is the default. Modspec is only the default in OGC (and now Plateau).

The issue is, that "statement" as a component type is not part of MRR, but is specific to Modspec. MRR does not recognise it as a component type. When that happens, MRR shoves its content into a classification, and it was not dealing with the blocks inside it. (The only MRR catch-all for a piece of prose is "description".)

anermina commented 2 months ago

Thank you for clarifying, @opoudjis !

The following example has caused confusion because it uses "statement" under MRR documentation. image

I will replace "statement" with "specification" in this example.

opoudjis commented 2 months ago

Thank you, my apologies if it was me. (It likely was.)