Book a Demo

Author Topic: Adding Custom Compartments to Element  (Read 12983 times)

Mats Gejnevall

  • EA User
  • **
  • Posts: 98
  • Karma: +1/-0
    • View Profile
Adding Custom Compartments to Element
« on: December 08, 2015, 01:28:02 am »
I am trying the new functionality to add custom compartment to elements using RelatedElement. I have setup a little model with one Component and two Classes. The Component has dependency relationships to both Classes. I copied the exact script from example 4 at
http://www.sparxsystems.com.au/enterprise_architect_user_guide/11/extending_uml_models/add_custom_compartments_to_ele.html

but I cannot get it do create any compartment. I removed all of the if's in the example as well and just kept
SetCompartmentName("dependsOn");
AppendCompartmentText("#Element.Name#");

and it still does not work.

I was planning to use this functionality extensively cross my set of models.

Help !!!!!
Mats


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding Custom Compartments to Element
« Reply #1 on: December 08, 2015, 06:32:46 am »
Mats,

I just tried those examples myself, and I can't get them to work either; not the RelatedElement, and not the ChildElement examples.

If I were you I would send an email to Sparx support. Maybe they see something we both missed.

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #2 on: December 08, 2015, 08:25:38 am »
The current version has an issue that it won't go into the compartments at all if the related (or child) element is on the diagram being rendered. Could that be the problem you're getting?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #3 on: December 08, 2015, 09:20:36 am »
No. Works in neither case. It's broken (like your QA if there's any  :P).

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #4 on: December 08, 2015, 11:31:31 am »
Quote
The current version has an issue that it won't go into the compartments at all if the related (or child) element is on the diagram being rendered. Could that be the problem you're getting?
The whole issue of what to show on a diagram has become a bit problematic - especially with the advent of visual embedding (such as with ArchiMate).

For example, there is a diagram option that says: [ ] Show additional parents - which will indicate that a generalized parent is not visible.  At present, this is rendered when the generalized parent is NOT on the diagram.  But I would argue that is is actually being shown because the generalization relationship is NOT shown on the diagram and even if the parent was on the diagram and the generalization was suppressed, it should still be shown.

So the decision of what to show on a diagram is more complex than it first seems.

I think this needs careful thinking over - with input from knowledgeable and experienced users - with  real world needs being taken into account.

PAolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #5 on: December 08, 2015, 02:00:14 pm »
Just tested with the following shape script:
Code: [Select]
shape ChildElement
{
    SetCompartmentName("#TYPE#");
    AppendCompartmentText("#NAME#");
}
shape RelatedElement
{
    SetCompartmentName("#Connector.Type#");
    AppendCompartmentText("#Element.Name#");
}

Initially, only the child elements were shown when they didn't exist on the diagram. However, the script is working. The issue is the by default the connector compartments are turned off. Once I turned the compartment display on, they worked as expected. Is that your issue?

I think this is because when child compartments were introduced for SysML elements we had a number of complaints about showing unwanted information and ruining the diagram layout. We took that feedback on board when deciding on the default behavior for the related elements compartments.

Quote
So the decision of what to show on a diagram is more complex than it first seems.
I don't disagree. That's why I described the current behavior of forcing the compartment text off an 'issue'. We have a shape script property to determine if it is visible through other means. I don't know how that is interpreted for related elements, but I don't see why we couldn't extend the 'IsVisible' property queries so that the language designer can define when the compartment should be visible.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding Custom Compartments to Element
« Reply #6 on: December 08, 2015, 02:47:03 pm »
Hi Simon,

I can confirm.
If I
- add a relation
- remove the related element from the diagram
- close and reopen the diagram
- right click on the element and choose Features and Properties|Feature and Compartmen Visibility...
- check the new checkbox for the new type of relation I added

Then it actually shows

Geert

Mats Gejnevall

  • EA User
  • **
  • Posts: 98
  • Karma: +1/-0
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #7 on: December 08, 2015, 10:18:31 pm »
Is there a way of setting that checkbox for all elements? I want to use the Relationship Matrix to set my relationships and then when adding elements to a diagram the releated elements would be seen immediatly. And when adding a new relationship, it would be added to the diagram automatically. This would ease maintenance of diagrams a lot. Then I could set a tagged value on the diagrams that the shape script could detetect and only show relevant relationships in the compartment. :)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding Custom Compartments to Element
« Reply #8 on: December 08, 2015, 10:47:23 pm »
You cannot add tagged values to diagrams, so that won't be an option.

You could probably find out where the checkbox info is stored, and manipulate that in a script or add-in. I don't think this is supported by the API, so you would have to do it the dirty way directly in the database.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #9 on: December 08, 2015, 10:52:58 pm »
Quote
If I
...
Easy peasy

q.

Mats Gejnevall

  • EA User
  • **
  • Posts: 98
  • Karma: +1/-0
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #10 on: December 09, 2015, 07:35:51 pm »
I now tried using Compartments for TOGAF MDG. Created a Process which had two Data Entity with Consume relationships. Removed the Data Entities from the diagam and saved. Created this shape script on the Process entity:
shape RelatedElement
{
SetCompartmentName("Information");
AppendCompartmentText("#Element.Name#");
}
And looked in Feature and Compartment visbility but the Information compartment never showed up >:(

Does the compartments only work for certain shapes?
Thanks Mats ::)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #11 on: December 09, 2015, 09:37:03 pm »
Interestingly when the compartment is shown and you add the related element then the compartment gets blanked out. But when you remove the related element again from the diagram the compartment stays empty. EAUI.

q.

Mats Gejnevall

  • EA User
  • **
  • Posts: 98
  • Karma: +1/-0
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #12 on: December 10, 2015, 01:32:14 am »
I do think this could be an extremely powerful function in SPARX. You can create shape scripts for your elements which shows selected relationships depending on the type of diagram (using diagram sterotypes).
Then you can automatically update lots of your diagrams by just adding or removing relations in the Relationship Matrix instead of having to redraw each diagram which contains the changed relationship. ;D

Or changing what is seen in one diagram by just changing the diagram sterotype. :P

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #13 on: December 10, 2015, 07:07:57 am »
Quote

For example, there is a diagram option that says: [ ] Show additional parents - which will indicate that a generalized parent is not visible.  At present, this is rendered when the generalized parent is NOT on the diagram.  But I would argue that is is actually being shown because the generalization relationship is NOT shown on the diagram and even if the parent was on the diagram and the generalization was suppressed, it should still be shown.

PAolo

I use this a lot to link a conceptual data model to an upper ontology and I've found the only reliable way to use additional parents in v12.x is to create the relationship via Advanced | Parents.  Diagrammatically creating a generalize relationship doesn't seem to consistently get the label to show on the child class.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Adding Custom Compartments to Element
« Reply #14 on: December 10, 2015, 11:03:28 am »
Quote
Quote

I use this a lot to link a conceptual data model to an upper ontology and I've found the only reliable way to use additional parents in v12.x is to create the relationship via Advanced | Parents.  Diagrammatically creating a generalize relationship doesn't seem to consistently get the label to show on the child class.
I haven't seen that I must admit with v12.x however, if you can reproduce it; it's a bug.

BTW I'm also trying to link conceptual models to an ontological model, but I use dependencies to link the conceptual item to the Concept (and specialised naming dependencies to link the item to the terms in the ontological model).

If you're interested in swapping ideas and experiences, contact me off-line.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!