Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kwkwan opened this issue Aug 30, 2024 · 79 comments · Fixed by #143
Closed

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

kwkwan opened this issue Aug 30, 2024 · 79 comments · Fixed by #143
Assignees
Labels
enhancement New feature or request

Comments

@kwkwan
Copy link
Contributor

kwkwan commented Aug 30, 2024

The table should show:

  • its owned attributes
  • its super class
  • owned attributes of super class
  • loop super class to get its super class till it is topmost
  • owned attributes of these super classes
@kwkwan
Copy link
Contributor Author

kwkwan commented Aug 30, 2024

Refer to table in 4.18.3.1.1 dem:ReliefFeature (Plateau document 001-v4)

@ronaldtse
Copy link
Contributor

@kwkwan can we loop till we get to the top superclass?

@kwkwan
Copy link
Contributor Author

kwkwan commented Aug 30, 2024

@kwkwan can we loop till we get to the top superclass?

@ronaldtse Yes, it will.

@ReesePlews
Copy link

hello @kwkwan thanks for the work on the lutaml gml dictionary tool, it is working well.

regarding the example table, shown below

Refer to table in 4.18.3.1.1 dem:ReliefFeature (Plateau document 001-v4)

is it possible to use a different table (shown below) for the initial test?
doc001-v4 - document page 58, pdf page 69.
4.2.3 建築物の応用スキーマ文書
Building (CityGML)
bldg:Building

i have prepared the most content (EA "Notes" property) for that subpackage tables. thank you.

happy to test these updates when you are ready. just let me know. thanks!

@kwkwan
Copy link
Contributor Author

kwkwan commented Aug 30, 2024

hello @kwkwan thanks for the work on the lutaml gml dictionary tool, it is working well.

regarding the example table, shown below

Refer to table in 4.18.3.1.1 dem:ReliefFeature (Plateau document 001-v4)

is it possible to use a different table (shown below) for the initial test? doc001-v4 - document page 58, pdf page 69. 4.2.3 建築物の応用スキーマ文書 Building (CityGML) bldg:Building

i have prepared the most content (EA "Notes" property) for that subpackage tables. thank you.

happy to test these updates when you are ready. just let me know. thanks!

OK. I will switch the initial test to this example.

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 2, 2024

During the test with the example (4.2.3 bldg:Building) and xmi file plateau_uml_20240708_all_packages_export.xmi, I can retrieve the following properties in 継承する関連役割:

lod0RoofEdge
address
boundedBy
lod2Solid
lod4Solid
lod1Solid
lod3Solid
bldg::lod2MultiSurface
lod0FootPrint
lod4MultiSurface
bldg::lod3MultiSurface
bldgDmAttribute
bldgDataQualityAttribute
largeCustomerFacilityAttribute
consistsOfBuildingPart
bldgDisasterRiskAttribute
ifcBuildingAttribute
bldgFacilityAttribute
bldgFacilityIdAttribute
bldgRealEstateIDAttribute
outerBuildingInstallation
bldgUsecaseAttribute
bldgKeyValuePairAttribute
buildingDetailAttribute
interiorRoom
indoorBuildingAttribute
buildingIDAttribute
bldgFacilityTypeAttribute
interiorBuildingInstallation

A property named bldgUsecaseAttribute is found but not in the PDF. Is it correct to show it?

@ReesePlews
Copy link

ReesePlews commented Sep 2, 2024

hello @kwkwan since these tables in the document are "model driven" i think we should always show the content from the model, as it may have been mistakenly left off in the PDF (because they were manually created). i think @ronaldtse would agree with this understanding.

@ReesePlews
Copy link

hello again @kwkwan if i wanted to confirm the version (date) of the XMI file, where should i look? want to make sure you have the newest version.

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 2, 2024

I download the xmi file plateau_uml_20240708_all_packages_export.xmi on 12 July 2014. The size of it is 10.6 MB.

@ReesePlews
Copy link

there is a newer version, how can i get that to you?

@ronaldtse
Copy link
Contributor

ronaldtse commented Sep 2, 2024

I have just uploaded it to this commit:

It is located in this PR:

@kwkwan can you try with the newly exported XMI file? It seems to contain additional GML content.

@ReesePlews
Copy link

thanks @ronaldtse

@ReesePlews
Copy link

@kwkwan if you have any questions about the new version, please let me know. the structure has changed, with the figures now inside of the individual folders, instead of outside.

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 3, 2024

When generating the table for class. some attributes shown in PDF are still missing in the new macro. It is because I cannot find out the logic to get these attributes from Building.

These are:

  • attributes: gml and core in 継承する属性
  • associations: gen in 継承する関連役割

@ronaldtse Do you have any cues to link up the these attributes with Building?

@ReesePlews
Copy link

hello @kwkwan because the UML tables in doc01 were made manually, there are attributes which are not readily accessible (through the model), in my understanding. the inherited attribute cells that are "gray" in color were manually added to those tables and are not in the individual models. are those the attributes you are mentioning?

@ronaldtse and i have discussed with the client, and at this time, we can leave out the attributes from the gray cells if they are not already linked in the UML, unless Ron has directed you to do something different. i am not really the UML expert.

does that help?

@ronaldtse
Copy link
Contributor

@kwkwan can you please post the exact attributes/relationships that are missing and from which class?

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 3, 2024

OK. Here they are.
Screenshot 2024-09-03 at 3 13 49 PM

Screenshot 2024-09-03 at 3 14 44 PM

@ronaldtse
Copy link
Contributor

Update: I did some digging on the 2nd category, with dateAttribute. Unfortunately, I cannot find any connection between Building and dateAttribute in the XMI. They should not exist in the table?

@ReesePlews
Copy link

hello @kwkwan looks like you are using the HTML output, please use the PDF, the official file plateau_doc_0001_ver04.pdf from the "reference-docs" folder. it will have gray shaded tables
i will paste in here

@ReesePlews
Copy link

image

image

please see the pdf for the remaining parts of the table

@ronaldtse
Copy link
Contributor

As previously agreed, things that cannot be determined from the model must be dropped.

This includes:

  • gray shading and the parentheses because whether an attribute is meant to be used is not shown in the table.

@ReesePlews
Copy link

ReesePlews commented Sep 3, 2024

@ronaldtse yes, correct "gray shading" content will not be in the model, and will be dropped. but i dont know why i cannot find gml:description, its not shaded gray.

@ReesePlews
Copy link

maybe it comes from gml:feature?

image

@ronaldtse
Copy link
Contributor

Update: I checked core:terminationDate and core:RelativeToWaterType, both of them do not seem in any way connected to the Building class.

@ReesePlews we need the PLATEAU team's help here, the tables in the PDF seem to be erroneous.

Let me explain terminationDate.

There are 2 terminationDate attributes in the XMI.

  • One belongs to the _CityObject UML class in the core package. We want this one.
  • One belongs to the DmElement UML class in the "Urban Planning ADE 3.1" package.

The first one is shown here:

			<packagedElement xmi:type="uml:Package" xmi:id="EAPK_9E3ECCD9_5472_45ce_BE7A_BC004A52B63C" name="CityGML2.0">
				<packageImport xmi:type="uml:PackageImport" xmi:id="EAID_B0802E45_AF95_433a_BA7A_93EB62945730" importedPackage="EAPK_939925FF_6235_4286_82FF_7392B33F305C"/>
				<packagedElement xmi:type="uml:Package" xmi:id="EAPK_526A0DDE_1614_4df1_920F_F681125AE7C4" name="core">
					<packagedElement xmi:type="uml:Class" xmi:id="EAID_60CE61DE_7E88_4e8b_BFED_13500E7DCDEC" name="_CityObject" isAbstract="true">
<!-- ... --> 
						<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_6008181F_A953_4a0f_9F76_208235B9BC3A" name="terminationDate">
							<lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI004199_A953_4a0f_9F76_208235B9BC3A" value="0"/>
							<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI004200_A953_4a0f_9F76_208235B9BC3A" value="1"/>
							<type xmi:idref="EAJava_xs__date"/>
						</ownedAttribute>

In order for UML classes to "inherit this attribute", they need to have a Generalization relation to "EAID_60CE61DE_7E88_4e8b_BFED_13500E7DCDEC", which is the ID of the abstract class _CityObject.

Classes that inherit from _CityObject in the bldg package are only these:

  • _BoundarySurface
  • _Opening
  • BuildingFurniture
  • BuildingInstallation
  • IntBuildingInstallation
  • Room

i.e. Not from Building.

i.e. This means that Building cannot have this attribute.

@ronaldtse
Copy link
Contributor

ronaldtse commented Sep 3, 2024

maybe it comes from gml:feature?

Yes it is from _Feature:

				<packagedElement xmi:type="uml:Class" xmi:id="EAID_553A3DF9_69B8_4fb4_BF15_EC613B5B74CD" name="_Feature" isAbstract="true">
					<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_E52C9299_7D96_49e8_B6E1_B81E93B8C25F" name="boundedBy">

This means all classes that inherit from _Feature shall also have this attribute.

However, the only classes that inherit from _Feature (id: EAID_553A3DF9_69B8_4fb4_BF15_EC613B5B74CD) in the XMI are:

  • _CityObject
  • Address
  • Appearance
  • _FeatureCollection

i.e. this is "meant to come from _Feature", but there doesn't seem to be any connection between _Feature and the Building class in the model.

@ronaldtse
Copy link
Contributor

@kwkwan can you update the table to show for each inherited attribute/association, from which class it is inherited from? This will help the reader.

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 4, 2024

@ronaldtse Updated tables to show where the attributes come from via commit (84dddd3). Those attributes are all from _AbstractBuilding as no attribute has been defined in Building class.

@ronaldtse
Copy link
Contributor

@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
Copy link

@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
Copy link

@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
Copy link
Contributor

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

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

Thanks.

@ronaldtse ronaldtse added the enhancement New feature or request label Sep 13, 2024
@ronaldtse ronaldtse moved this to 🌋 Urgent in Metanorma Sep 13, 2024
@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 13, 2024

@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
Copy link
Contributor Author

kwkwan commented Sep 13, 2024

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
Copy link
Contributor

@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
Copy link

@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
Copy link
Contributor Author

kwkwan commented Sep 13, 2024

@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
Copy link

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
Copy link

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
Copy link
Contributor Author

kwkwan commented Sep 13, 2024

Yes, I think we discuss them here.

@ReesePlews
Copy link

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
Copy link
Contributor Author

kwkwan commented Sep 17, 2024

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
Copy link

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
Copy link
Contributor

  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
Copy link

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
Copy link
Contributor

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

@kwkwan kwkwan linked a pull request Sep 19, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from 🌋 Urgent to ✅ Done in Metanorma Sep 19, 2024
@ReesePlews
Copy link

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
Copy link
Contributor Author

kwkwan commented Sep 24, 2024

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
Copy link

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
Copy link

@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
Copy link
Contributor Author

kwkwan commented Sep 24, 2024

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. (lutaml/lutaml#88)

@kwkwan
Copy link
Contributor Author

kwkwan commented Sep 24, 2024

@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 metanorma/mn-samples-plateau@dffcbf9. Please try again to regenerate the document in 001-mds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants