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

Modeling the "gray box" indicating that an inherited attribute is not to be used #199

Open
ronaldtse opened this issue Oct 11, 2024 · 10 comments
Labels
documentation Improvements or additions to documentation

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Oct 11, 2024

In Enterprise Architect 16, I've created a usage attribute in Building that overrides the usage attribute in _AbstractBuilding.

It looks like this:

image

You have to manually set its "Multiplicity" to "0..0" in the EA Properties pane.

Screenshot 2024-10-11 at 7 02 01 PM

Then the result in XMI as you will see below, says <bounds lower="0" upper="0"/>:

<attributes>
	<attribute xmi:idref="EAID_B0A1A78F_F75A_4b39_BCFF_8E2579D1C17D" name="usage" scope="Private">
		<initial/>
		<documentation/>
		<model ea_localid="2167" ea_guid="{B0A1A78F-F75A-4b39-BCFF-8E2579D1C17D}"/>
		<properties type="gml::CodeType" collection="false" static="0" duplicates="0" changeability="changeable"/>
		<coords ordered="0"/>
		<containment containment="Not Specified" position="0"/>
		<stereotype/>
		<bounds lower="0" upper="0"/>
		<options/>
		<style/>
		<styleex value="volatile=0;"/>
		<tags/>
		<xrefs/>
	</attribute>
</attributes>

This way we are able to detect which attributes are meant to be disabled, and the reason of why that attribute is disabled can also be entered in the Notes.

@ronaldtse
Copy link
Contributor Author

FYI @ReesePlews @Chika96

@ronaldtse
Copy link
Contributor Author

Note that when creating this attribute, you will need to choose the same data type, and can use "Select Type" if the type is a defined element in the package.

Screenshot 2024-10-11 at 7 04 14 PM

@ronaldtse ronaldtse added the documentation Improvements or additions to documentation label Oct 11, 2024
@ReesePlews
Copy link
Contributor

hello @ronaldtse thank you very much for researching this option. i am still grappling with UML, so i am wondering what happens if we change the structure of Building by adding this new attribute? i have been told that the specific order of attributes, and other constructs matters.

if i understand your idea correctly: (based on the snippet image from doc01v4, shown below)

image

do we create identical attributes for "boundedBy", "relativeToTerrain", "relativeToWater", etc in the bldg class and set their multiplicity to [0..0]?

does this same method also work for the inherited roles?

thank you again for researching this.

@ronaldtse
Copy link
Contributor Author

Yes you're right we have to do it for all greyed out attributes.

I actually haven't tried the role override. Will report back.

@ronaldtse
Copy link
Contributor Author

For overriding a role/association/relationship, it's more complicated. Nonetheless it is possible, but you have to create a (throw-away) diagram.

After setting the relationships, you can just delete the diagram. The relationships are stored in the model, not the diagram.

Steps:

  1. Create a diagram (could be anywhere)
  2. Add the Building class to the diagram (e.g. through drag and drop) (the class you want to override a role)
  3. Add the data type or class you want to override the role for. For example, in the Building class you want to override lod2MultiSurface. The target data type is called gml:MultiSurface.
  4. Create an "Association" between them (e.g. through dragging the arrow icon from the source to the target)
  5. Edit the Association's property (e.g. double click the association line) through the Properties popup. Go to the "Role(s)" tab. In the "SOURCE Building" pane, enter lod2MultiSurface. In the "TARGET MultiSurface" pane, enter lod2MultiSurface, then set "Multiplicity" to "0".
  6. Click on the "Building" class in the diagram, and see that the "Relationships" pane shows a new association with the desired "Target cardinality" of 0.

To test:

  1. Save the diagram and changes. Right-click the image tab in the navigation, click "Save All".
  2. Go to "Publish" in the navigation Ribbon, click on "Publish As...". Export as UML 2.5.1 XMI.

Notice this line in the XML: <type multiplicity="0" .

<connector xmi:idref="EAID_2D561F37_F66C_48ae_99E1_973940394BE9">
  <source xmi:idref="EAID_B2D484B5_202B_4034_9046_90FCCEC07F56">
    <model ea_localid="612" type="Class" name="Building"/>
    <role visibility="Public" targetScope="instance"/>
    <type aggregation="none" containment="Unspecified"/>
    <constraints/>
    <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
    <style value="Union=0;Derived=0;AllowDuplicates=0;Owned=0;Navigable=Unspecified;"/>
    <documentation/>
    <xrefs/>
    <tags/>
  </source>
  <target xmi:idref="EAID_9CD87EC7_BBC1_4503_B284_14860C27C0BF">
    <model ea_localid="22" type="Class" name="MultiSurface"/>
    <role name="lod2MultiSurface" visibility="Public" targetScope="instance"/>
    <type multiplicity="0" aggregation="none" containment="Unspecified"/>
    <constraints/>
    <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
    <style value="Union=0;Derived=0;AllowDuplicates=0;Owned=0;Navigable=Unspecified;"/>
    <documentation/>
    <xrefs/>
    <tags/>
  </target>
  <model ea_localid="961"/>
  <properties ea_type="Association" direction="Source -&gt; Destination"/>
  <modifiers isRoot="false" isLeaf="false"/>
  <parameterSubstitutions/>
  <documentation/>
  <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
  <labels rb="0" rt="+lod2MultiSurface"/>
  <extendedProperties virtualInheritance="0"/>
  <style/>
  <xrefs/>
  <tags/>
</connector>

Create a diagram and add those classes

Use the "Add Element > Insert > Any Element" dialog.

Screenshot 2024-10-12 at 4 39 39 PM

Use the Quick Link association linker to connect the two classes

Screenshot 2024-10-12 at 4 40 33 PM

Double-click or right-click/properties to open the association's property window

And fill in the details.

Screenshot 2024-10-12 at 4 36 41 PM

Notice the Relationships pane at the bottom will show the relationship

Screenshot 2024-10-12 at 4 41 39 PM

Remember to save the diagram and all changes

Screenshot 2024-10-12 at 4 42 07 PM

Export package to XMI

Screenshot 2024-10-12 at 4 42 29 PM

@ronaldtse
Copy link
Contributor Author

EA's website said there's an easier way to create Relationships, but I can't seem to get it working. The "Link Type" does not provide a selection of what can a relationship be built with.

@ReesePlews
Copy link
Contributor

thank you @ronaldtse that is quite a set of steps. i am really going to have to study how that works. thank you for figuring this out and for documenting it so carefully. i am sure the Plateau Team and @Chika96 will be interested in checking this. thank you!

@ronaldtse
Copy link
Contributor Author

We will implement something like this:

---
targets:
- type: package
  name: CityGML 2.0
  targets:
  - type: package
    name: bldg
    targets:
    - type: class
      name: Building
      targets:
      - type: attribute
        name: boundedBy
        used: false
        guidance: |
          この属性は使用されていません。
      - type: attribute
        name: relativeToTerrain
        used: false
        guidance: |
          この属性は使用されていません。
      - type: attribute
        name: relativeToWater
        used: false
        guidance: |
          この属性は使用されていません。
      - type: attribute
        name: function
        used: false
        guidance: |
          この属性は使用されていません。
      - type: attribute
        name: storeyHeightsAboveGround
        used: false
        guidance: |
          この属性は使用されていません。
      - type: attribute
        name: storeyHeightsBelowGround
        used: false
        guidance: |
          この属性は使用されていません。
      - type: association
        name: lod2MultiSurface
        used: false
        guidance: |
          この関連役割は使用されていません。
      - type: association
        name: lod3MultiSurface
        used: false
        guidance: |
          この関連役割は使用されていません。

@ReesePlews
Copy link
Contributor

thank you for the updated idea @ronaldtse , this looks like one external "guidance file" per table? i am wondering though how a list of the "types" and "names" are produced?

@kwkwan
Copy link
Contributor

kwkwan commented Oct 21, 2024

Hi @ReesePlews, according to my preliminary study, it is supposed to use a single yaml file to define the guidances. The path of the yaml file will be configured in the config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants