Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Modesto Vega on May 04, 2021, 08:11:57 pm

Title: How to use the Subtype Property?
Post by: Modesto Vega on May 04, 2021, 08:11:57 pm
I cannot find any documentation on how to use the Subtype property, perhaps I have not looked hard enough.

The caption reads
Quote
"Name of an enumeration tagged value, in the form of "Profile::Stereotype::Tag". When the element is created, a sub-menu will list all the enumeration literals."

I understand this as meaning that I can create an enumeration with the subtype values and link it to the Subtype Property. However, since there is no way to select an existing enumeration, I am not sure how to link them.
Title: Re: How to use the Subtype Property?
Post by: Eve on May 05, 2021, 08:17:49 am
Fill in the names of your profile, the stereotype defining the tag and the tag itself.
Title: Re: How to use the Subtype Property?
Post by: Modesto Vega on May 06, 2021, 12:56:29 am
Fill in the names of your profile, the stereotype defining the tag and the tag itself.
Thanks for the telegraphic answer.

Just for the record, this is what I had to do to get this working:
Title: Re: How to use the _subtypeProperty?
Post by: Paolo F Cantoni on May 06, 2021, 09:48:13 am
Hi Modesto,
A quick question.  You are trying to use this (_subtypeProperty) for elements other than Activity?  The implication of the Help is that it is for Activity only - since that is the only Element Type listed in the See also.  From your post, it seems to work for Class, yes?  Did you try anything else?

TIA,
Paolo
Title: Re: How to use the _subtypeProperty?
Post by: KP on May 06, 2021, 10:00:32 am
Hi Modesto,
A quick question.  You are trying to use this (_subtypeProperty) for elements other than Activity?  The implication of the Help is that it is for Activity only - since that is the only Element Type listed in the See also.  From your post, it seems to work for Class, yes?  Did you try anything else?

TIA,
Paolo


I think you're reading too much into that 'See Also'. _subtypeProperty can be used with any metaclass, even connector metaclasses. All it does is set a tagged value on creation.
Title: Re: How to use the Subtype Property?
Post by: Eve on May 06, 2021, 10:53:47 am
Make sure the _subtypeProperty is specified on the metaclass.

Other than that, here's a working example.

Code: [Select]
<?xml version="1.0" encoding="windows-1252"?>
<UMLProfile profiletype="uml2">
<Documentation id="2D919350-9" name="Subtype" version="1.0" notes="Subtype"/>
<Content>
<Stereotypes>
<Stereotype name="Toast" notes="">
<AppliesTo>
<Apply type="Class">
<Property name="_subtypeProperty" value="Subtype::Toast::spread"/>
<Property name="isActive" value=""/>
</Apply>
</AppliesTo>
<TaggedValues>
<Tag name="spread" type="enumeration" description="" unit="" values="peanutButter,jam,vegemite,honey" default=""/>
</TaggedValues>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
<ViewDefinitions/>
<Metamodel/>
</Content>
</UMLProfile>
Title: Re: How to use the Subtype Property?
Post by: qwerty on May 06, 2021, 05:31:36 pm
Make sure the _subtypeProperty is specified on the metaclass.

Other than that, here's a working example.

Interesting! I right away tried that and, whoa!, there popped up a menu with the spread. Great! But wait, this is EA. Despite selecting one of the entries the property was empty then. I had to manually re-select it. This is a feature, I guess?

Let's see. Ah well, it's EAUI. You have to deselect the element and select it again. Then you see the property.

Wouldn't it be nice to have something developed that a customer could not start mocking about immediately?

q.
Title: Re: How to use the Subtype Property?
Post by: Paolo F Cantoni on May 06, 2021, 06:11:22 pm
[SNIP]
Wouldn't it be nice to have something developed that a customer could not start mocking about immediately?
q.
(my emphasis)
Maybe their testing mocks aren't "up to scratch"?  (couldn't resist)

Paolo
Title: Re: How to use the Subtype Property?
Post by: qwerty on May 06, 2021, 07:32:38 pm
Didn't we alread agree that Sparx' QA are their users?

q.
Title: Re: How to use the _subtypeProperty?
Post by: Modesto Vega on May 06, 2021, 08:01:47 pm
Hi Modesto,
A quick question.  You are trying to use this (_subtypeProperty) for elements other than Activity?  The implication of the Help is that it is for Activity only - since that is the only Element Type listed in the See also.  From your post, it seems to work for Class, yes?  Did you try anything else?

TIA,
Paolo
Hi Paolo,

I am currently using it for classes and will soon used it for components. It works fine for classes and I expect the same for components. This allows me to flatten the meta-model.

The XML generated is a per Eve's last reply.
Title: Re: How to use the Subtype Property?
Post by: Paolo F Cantoni on August 02, 2021, 01:05:48 pm
Fill in the names of your profile, the stereotype defining the tag and the tag itself.
Thanks for the telegraphic answer.

Just for the record, this is what I had to do to get this working:
  • Create an enumeration with the desired subtype values
  • In Stereotype Properties/Tagged Values, add to the stereotype an enumeration specialised tagged value and point it to the enumeration created in the previous step
  • In Stereotype Properties/General, select metaclass being extended and in the subtype, property enter the fully qualified name of the tag holding the subtype - e.g., MyProfile::Class:Type[/i]

    This should do the trick. Unfortunately, I cannot find it anywhere in the documentation but perhaps I was too inpatient and did not look hard enough.
(my emphasis)
Hi Modesto,  finally getting around to having a look at this...
Firstly, I think the word you were after was impatient.  An in-patient is in a hospital (so maybe you were being accurate!)  ;)

I just want to clarify that the _subtypeProperty has to be in the (in our view incorrectly) Metaclass.  This, surely, is a property of the stereotype?

Paolo
Title: Re: How to use the Subtype Property?
Post by: qwerty on August 02, 2021, 08:13:08 pm
m an n are quite next to each other on the keyboard. Might simply be a typo. Comes ages, comes typo - my fingers do not seem to obey my brain they used to do.

q.
Title: Re: How to use the Subtype Property?
Post by: Paolo F Cantoni on August 02, 2021, 10:14:00 pm
m an n are quite next to each other on the keyboard. Might simply be a typo. Comes ages comes typos - my fingers do not seem to obey my brain they used to do.

q.
I use a grammar checker that automatically indicates errors.  (it fixed up some of your above... ;))

Anyway, it "tickled my fancy"...

Paolo
Title: Re: How to use the Subtype Property?
Post by: qwerty on August 03, 2021, 12:01:27 am
Well, I wrote truely. With quite some (unwanted) typos. I like that proverb: if you find any spelling errors you may keep them.

q.