metanorma / metanorma-plugin-lutaml

Metanorma plugin: access LutaML objects from within a Metanorma document
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Create a block macro to render table of a class in plateau #140

Closed kwkwan closed 1 month ago

kwkwan commented 2 months ago

The table should show:

ReesePlews commented 1 month ago

thank you @ronaldtse for the clarification, that initial row will need to be styled either as a separate table or as normative body text. i have requested a decision on that this week.

ReesePlews commented 1 month ago

@kwkwan question 2) from earlier has been resolved.

kwkwan commented 1 month ago

hello @kwkwan thank you for updating the model. i have checked the output and i have two questions:

  1. in the Landuse model, i added "content" into the "Notes properties" for the attributes after the "⾃⾝に定義された属性" heading (example "areaClassificationType") but that content is not showing in the autogenerated table.

Hi @ReesePlews, for question 1, the attribute of areaClassificationType is belonged to LandUseDetailAttribute rather than LandUse. So, the table will not show the content.

<element xmi:idref="EAID_38DBDE3D_DC81_4505_A700_7EC81CED4BD1" xmi:type="uml:Class" name="LandUseDetailAttribute" scope="public">
...
    <attributes>
      <attribute xmi:idref="EAID_FEE8895A_4DD1_4349_A3CD_9BA582E5DFEF" name="areaClassificationType" scope="Public">
        <documentation value="[format=asciidoc]&#xA;&#xA;[lang=jp]&#xA;== Content&#xA;&#xA;&#x571F;&#x5730;&#x304C;&#x5C5E;&#x3059;&#x308B;&#x533A;&#x57DF;&#x533A;&#x5206;&#x3002;&#x30B3;&#x30FC;&#x30C9;&#x30EA;&#x30B9;&#x30C8;(Common_areaClassificationType.xml)&#x3088;&#x308A;&#x9078;&#x629E;&#x3059;&#x308B;&#x3002;"/>
...

There is another attribute with the name uro:areaClassificationType which is belonged to LandUse. If you update that attribute, the content should be shown in the table. Currently, the content of it is empty.

 <packagedElement xmi:type="uml:Class" xmi:id="EAID_B34C7AA1_F3FD_42a0_A358_EAC39394782C" name="LandUse">
      <ownedAttribute xmi:type="uml:Property" xmi:id="EAID_01A977DA_3316_4599_9CDE_1FA18D8BCDAA" name="uro::areaClassificationType">
        <type xmi:idref="EAID_0F5E62CD_5DD3_4fc0_94FD_7FB26CD0807D"/>
        <lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI002273_3316_4599_9CDE_1FA18D8BCDAA" value="0"/>
        <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI002274_3316_4599_9CDE_1FA18D8BCDAA" value="1"/>
      </ownedAttribute>
...
      <element xmi:idref="EAID_B34C7AA1_F3FD_42a0_A358_EAC39394782C" xmi:type="uml:Class" name="LandUse" scope="public">
        ...
      <attribute xmi:idref="EAID_01A977DA_3316_4599_9CDE_1FA18D8BCDAA" name="uro::areaClassificationType" scope="Public">
        <initial/>
        <documentation/>
...
ReesePlews commented 1 month ago

hello @kwkwan

i discussed this with the client and they understand that content from _AbstractBuilding class will not appear in the table but there is also content for bldg::Building the class below _AbstractBuilding. because the table is for bldg::Building, that content should appear in the right cell of the top row of the table. (as shown in the image)

image

please tell me if that content accessible in the .xmi file? thank you.

kwkwan commented 1 month ago

The name will be shown when the definition is not found.

ronaldtse commented 1 month ago

@kwkwan wait, this is not the right way of doing things.

The "型の定義" field is only supposed to show the definition of "bldg:Building". We should not insert the name "bldg:Building" or the definition of "bldg:_AbstractBuilding" here.

The EA model is now like this:

image

Therefore the text at the bottom right corner should be filled in "型の定義".

ReesePlews commented 1 month ago

@kwkwan let me double check the text in the file. i copy-pasted from another "Notes property" into the model, perhaps that is an issue.

ReesePlews commented 1 month ago

@kwkwan i have checked and i am not seeing those characterset issues. as shown in the image below. also, the contents in the "Notes property" is tied to class "bldg::Building"

image

so it was that content (because it is at the class level) that i was thinking is accessible to put into that cell (shown by the pink box) above. if my understanding is not correct please let me know and discuss with @ronaldtse .

ronaldtse commented 1 month ago

@kwkwan : the description given by @ReesePlews seems correct.

Can you help make sure this text ("居住その他の目的をもって構築された建築物。...") appears in the cell "型の定義" for "bldg:Building"?

Thanks.

kwkwan commented 1 month ago

@ReesePlews Updates the way to lookup definition by the documentation of properties under element whendocumentation under attribute is not found.

<element xmi:idref="EAID_B2D484B5_202B_4034_9046_90FCCEC07F56" xmi:type="uml:Class" name="Building" scope="public">
  <model package="EAPK_1D38D48C_F798_4ab9_AFDB_A6140AB461D4" tpos="0" ea_localid="63798" ea_eleType="element"/>
  <properties documentation="[format=asciidoc]&#xA;&#xA;[lang=jp]&#xA;== Content&#xA;&#xA;&#x5C45;&#x4F4F;&#x305D;&#x306E;&#x4ED6;&#x306E;&#x76EE;&#x7684;&#x3092;&#x3082;&#x3063;&#x3066;&#x69CB;&#x7BC9;&#x3055;&#x308C;&#x305F;&#x5EFA;&#x7BC9;&#x7269;&#x3002; &#xA;&#x666E;&#x901A;&#x5EFA;&#x7269;&#x3001;&#x5805;&#x308D;&#x3046;&#x5EFA;&#x7269;&#x3001;&#x666E;&#x901A
...
kwkwan commented 1 month ago

For example, documentation of _AbstractBuilding is stored like:

<xmi:Extension extender="Enterprise Architect" extenderID="6.5"></xmi:Extension>
<elements>
<element xmi:idref="EAID_6F915D44_6B5C_4298_891D_0FB0B1AF24F0" xmi:type="uml:Class" name="_AbstractBuilding" scope="public">
<attributes>
  <attribute xmi:idref="EAID_FDC435D4_544B_4122_BEA1_7C0B55136938" name="class" scope="Public">
  <initial/>
  <documentation value="[format=asciidoc]&#xA;&#xA;[lang=jp]&#xA;== Content&#xA;&#xA;&#x5EFA;&#x7BC9;&#x7269;&#x306E;&#x5F62;&#x614B;&#x306B;&#x3088;&#x308B;&#x533A;&#x5206;&#x3002;&#x30B3;&#x30FC;&#x30C9;&#x30EA;&#x30B9;&#x30C8;(&amp;lt;&amp;lt;Building_class.xml&amp;gt;&amp;gt;)&#x3088;&#x308A;&#x9078;&#x629E;&#x3059;&#x308B;&#x3002;"/>
...
ronaldtse commented 1 month ago

@kwkwan for _AbstractBuilding -> class it is actually an attribute called class with a description:

Screenshot 2024-09-13 at 11 36 16 AM

The _AbstractBuilding definition is a separate location, I think as you mentioned under element > properties[documentation]:

Screenshot 2024-09-13 at 11 37 12 AM
ReesePlews commented 1 month ago

@kwkwan and @ronaldtse thank you for following up on this. i am sorry i am not understanding everything.

i select the individual classes (boxes) attributes and roles only on the model figures, then i update (paste) the content into the "Notes property". when i go to the non-figure browser, and press on "Building" i can see my content for the class (box) Building (in the image below). because the call to lutaml to render the table used Building

lutaml_klass_table::../../sources/001-mds/20240910_all_package_export_plus_new_tc211_gml.xmi[name="Building"]

that is what i was expecting would be visible in the right cell of the first row of the Building table that lutaml is generating. if my understanding is wrong, we will need to talk with the client. @ronaldtse if you have time today i will ask them if they can discuss. let me know offline. thanks

image

kwkwan commented 1 month ago

@ReesePlews Sorry to make you confused. After discussed with @ronaldtse, this definition has been restricted to lookup the documentation from element properties.

i.e.

<element xmi:idref="EAID_B2D484B5_202B_4034_9046_90FCCEC07F56" xmi:type="uml:Class" name="Building" scope="public">
  <model package="EAPK_1D38D48C_F798_4ab9_AFDB_A6140AB461D4" tpos="0" ea_localid="63798" ea_eleType="element"/>
  <properties documentation="[format=asciidoc]&#xA;&#xA;[lang=jp]&#xA;== Content&#xA;&#xA;&#x5C45;&#x4F4F;&#x305D;&#x306E;&#x4ED6;&#x306E;&#x76EE;&#x7684;&#x3092;&#x3082;&#x3063;&#x3066;&#x69CB;&#x7BC9;&#x3055;&#x308C;&#x305F;&#x5EFA;&#x7BC9;&#x7269;&#x3002; &#xA;&#x666E;&#x901A;&#x5EFA;&#x7269;&#x3001;&#x5805;&#x308D;&#x3046;&#x5EFA;&#x7269;&#x3001;&#x666E;&#x901A
...
ReesePlews commented 1 month ago

thank you @kwkwan, am a UML beginner, so confusion problem is on me! i appreciate the patience from you and Ron! when you make any changes that you need me to check, just let me know. thanks for all the diligent work on this!

ReesePlews commented 1 month ago

hello @kwkwan and @ronaldtse

i have generated the document locally after doing a "bundle update" the very positive results are shown below:

image image

it looks really good. thank you. even the other tables i have asked you to add the lutaml statement for are generating well. (but i still need to check them).

my next question would be the gray coloring of the cells and the rendering of the [Content] in those cells. should i discuss those things here, or a different issue, please advise.

kwkwan commented 1 month ago

Yes, I think we discuss them here.

ReesePlews commented 1 month ago

hello @kwkwan regarding the next questions:

Q1: gray background coloring of cells:

  1. how can i style a single cell to be "gray"?
  2. would there be a way to indicate individually which cells in a row would be "gray"? like [cell1:rgb...] because the content i made is placed into the right most cell, it would seem difficult (and possibly strange) to try and control the coloring of other cells when that content in those cells is automatically added. however, the client document colors the left most cells of certain entities as a way of communicating to the user. i am wondering if it may be better to support [row:rgb] as a way to color the background of the current row?

Q2: the current status of the content as asciidoc being read from the XMI file:

  1. in the cells where i have added content, there are [_content_x] Content. i can understand the [_content_x] is perhaps debugging call but what about the other "Content", is that being interpreted as an asciidoc heading? there is a discussion here.

if you need me to modify the contents in the 3 tables we are checking please let me know. thank you.

kwkwan commented 1 month ago

Q1: gray background coloring of cells:

  1. how can i style a single cell to be "gray"?
  2. would there be a way to indicate individually which cells in a row would be "gray"? like [cell1:rgb...] because the content i made is placed into the right most cell, it would seem difficult (and possibly strange) to try and control the coloring of other cells when that content in those cells is automatically added. however, the client document colors the left most cells of certain entities as a way of communicating to the user. i am wondering if it may be better to support [row:rgb] as a way to color the background of the current row?

Hi @ReesePlews and @ronaldtse For the styling of the table, I think it can be changed by using standard asciidoc syntax. However, the plugin will be needed to update to allow the user to specific the template path.

ReesePlews commented 1 month ago

thank you @kwkwan standard asciidoc syntax is important. we dont want to deviate from that. i could not find that asciidoc/asciidoctor supported such coloring except through the use of CSS.

if the shading setup for the "dynamic content" (content which you parse from the .xmi file) is in the template, can it be called on a "cell by cell" or "row by row" basis... when it is needed?

for example in the original document the left most cells are shaded: image

in our autogenerated document: image

i dont understand much with the template. i think you understand the issue here. a "work around" is also a possibility, such as "shading the row, not just the left most cell." please discuss these things with @ronaldtse at your earliest convenience. thank you.

ronaldtse commented 1 month ago
  1. Shading of table cells are not allowed in Metanorma, because Metanorma is a semantic syntax. The way to shade a cell is to mark it as a heading cell (h|). According to our last discussion, the gray shading was to indicate which inherited cells are not used in the current class, and the team was fine to omit that?

  2. The "content" issue will be handled by the Coradoc task of embedding AsciiDoc.

ReesePlews commented 1 month ago

According to our last discussion, the gray shading was to indicate which inherited cells are not used in the current class, and the team was fine to omit that?

thanks Ron but they are still asking about it. i will say we cannot do that. i will follow up.

ronaldtse commented 1 month ago

@reeseplews can’t they use another way like an additional “star” or some indication for that purpose?

ReesePlews commented 1 month ago

hello @kwkwan earlier in this issue we talked about the order of how attributes, and other entities from the UML model (.xmi file) will be ordered in the table. is that a "switch" that the user can invoke when they make the call to lutaml or is that something hard coded into the code?

i ask because i was told about a setting in EA that could be useful to this project. in EA from the "Start > Preference pane (Preferences) > the dialogue below:

image

let me know if i should make a new issue where i ask about this. thank you,

kwkwan commented 1 month ago

Hi @ReesePlews Currently, the order of the attributes in the Class table is sorted by name. If you want to change the type of sort_by or order (ascending or descending), please free feel to create new issue to further elaborate it.

ReesePlews commented 1 month ago

thank you @kwkwan , before i create a new issue to request some code enhancement, can you turn off the sort so that the original order from the .xmi file is used. this way we will know if there is an option in EA to handle or not. sorry to ask you to do that but i think better we test with it off at this time, and before any enhancement is requested. thank you.

ReesePlews commented 1 month ago

@kwkwan sorry i have another question. last month you updated branch 001-mds using the following code in the document.adoc file:

= Standard Data Product Specification for 3D City Model
:docnumber: 1
:edition: 4
:revdate: 2024-03-22
:published-date: 2024-03-22
:copyright-year: 2024
:language: ja
:title-intro-ja: 3D都市モデル導入のためのガイドブック
:title-main-ja: 3D都市モデル標準製品仕様書
:publisher: 国土交通省 都市局
:sponsor: (協力)内閣府 地方創生推進事務局
:title-intro-en: Handbook of 3D City Models
:title-main-en: Standard Data Product Specification for 3D City Model
:doctype: handbook
:coverpage-image: images/coverpage.png
:imagedir: images
:mn-document-class: plateau
// :mn-output-extensions: doc,xml,html,pdf,rxl
:mn-output-extensions: html,pdf
:local-cache-only:
:data-uri-image:

include::sections/abstract-01.adoc[]

include::sections/abstract-02.adoc[]

include::sections/section-01.adoc[]

// TODO: This section fails when parsing the XMI due to "GML" issues
[[conceptual-model]]
[lutaml_uml_datamodel_description,./plateau_uml_20240708_all_packages_export.xmi,lutaml_data_dictionary.yml]
----
[.diagram_include_block,base_path="./xmi-images",format="png"]
....
....
----

include::sections/bibliography-01.adoc[]

include::sections/appendix-A.adoc[]

which autogenerated all of the tables from the .xmi for testing purposes (but not the other parts of the document).

i tried to run it yesterday but i did not work. ran for a few hours. i think because of the change to lutaml_klass_table that document no longer is generating the previous output?

if this is a minor change, can you update that so it auto generates all of the tables like it was doing a month back?

if this requires an enhancement, please discuss with @ronaldtse first.

i will send a new .xmi file later today. the content of the "Notes property" has been simplified. thank you.

kwkwan commented 1 month ago

thank you @kwkwan , before i create a new issue to request some code enhancement, can you turn off the sort so that the original order from the .xmi file is used. this way we will know if there is an option in EA to handle or not. sorry to ask you to do that but i think better we test with it off at this time, and before any enhancement is requested. thank you.

I will turn off the sorting to allow it follows original order in xmi. (https://github.com/lutaml/lutaml/issues/88)

kwkwan commented 1 month ago

@kwkwan sorry i have another question. last month you updated branch 001-mds using the following code in the document.adoc file:

which autogenerated all of the tables from the .xmi for testing purposes (but not the other parts of the document).

i tried to run it yesterday but i did not work. ran for a few hours. i think because of the change to lutaml_klass_table that document no longer is generating the previous output?

if this is a minor change, can you update that so it auto generates all of the tables like it was doing a month back?

if this requires an enhancement, please discuss with @ronaldtse first.

i will send a new .xmi file later today. the content of the "Notes property" has been simplified. thank you.

I have update the document in 001-mds via https://github.com/metanorma/mn-samples-plateau/pull/114/commits/dffcbf9e799c02b768eeb9bbac4a094e3402972f. Please try again to regenerate the document in 001-mds.