DSL

General discussions about MagicDraw

Moderator: Moderators

DSL

Postby shreyas.shah@siemens.com » Wed May 24, 2017 1:28 pm

I am trying to create a derived property (say MyName) in a stereotype (say MyClass) for a metaproperty (say Name). I can rename the property Name to MyName. However, I cannot create a derived property MyName that will be same as Name.

I have tried the following in the customization without success:
1. simple navigation. UML attribute Name, source to target
2. metachain navigation, <> MyClass, Name

What should be done?
shreyas.shah@siemens.com
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed May 24, 2017 12:36 pm

Re: DSL

Postby ieva.n » Wed May 24, 2017 1:59 pm

Hello,

Can you please explain what you are trying to achieve? Do you want to have a custom editable property (in that case you should create a stereotype property with type, for example, "String"), or do you want to retrieve value that is not available directly (derived properties intention is to display information derived from other properties or related elements).

Sincerely,
No Magic, Inc. Customer Support
ieva.n
No Magic
No Magic
 
Posts: 369
Posts Rating:32
Joined: Thu Aug 02, 2012 5:02 am
Full name: Ieva

Re: DSL

Postby shreyas.shah@siemens.com » Wed May 24, 2017 2:46 pm

Hi,

I am bringing data from an external system. It uses "className" etc. for the name of the class among many things. I can import the data. However, I wanted a tab with the application name and properties listed as it appears in the external system.

I created a property group for the tab. Just cannot get to the properties of the existing object without renaming them completely.
shreyas.shah@siemens.com
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed May 24, 2017 12:36 pm

Re: DSL

Postby ieva.n » Wed May 24, 2017 3:00 pm

Hello,

Can you please attach the sample project and image of what do you expect?

Sincerely,
No Magic, Inc. Customer Support
ieva.n
No Magic
No Magic
 
Posts: 369
Posts Rating:32
Joined: Thu Aug 02, 2012 5:02 am
Full name: Ieva

Re: DSL

Postby shreyas.shah@siemens.com » Thu May 25, 2017 9:08 am

Hello,

Attached are profile and a test project files. What I am looking for in the test project when I select the stereotyped class "abc" as:

1. Element tab, no different from typical MagicDraw tab
2. SimApp tab, where some new properties and some renamed properties are displayed. The renamed properties should pick up the values from underlying standard properties.

BTW, is it possible to make the "Class" drag-drop from the Diagram Pallet to default to the stereotype?

Regards,
Shreyas
You do not have the required permissions to view the files attached to this post.
shreyas.shah@siemens.com
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed May 24, 2017 12:36 pm

Re: DSL

Postby ieva.n » Thu May 25, 2017 10:49 am

Hello,

Thank you for sample projects.

Regarding the Name property renaming - you can create a derived property that displays this field value, but no actual property name renaming is possible without editing the code or writing plugin, as it is one of core properties and used in other features.

I was not sure about other properties, so I attached a modified profile, which adds your custom class to Class diagram pallet (a feature from version 18.3 - https://docs.nomagic.com/display/MD183/ ... am+palette ) and adds a derived property that displays the element Name property value. However, as it is derived property, it is not editable. I also moved part of properties and nodes to Expert mode - you can hide them at all. Basically, if you want an editable property, it should be added via stereotype, and it remains a custom property. Derived properties only displays information and in most cases are not editable.

Sincerely,
No Magic, Inc. Customer Support
You do not have the required permissions to view the files attached to this post.
ieva.n
No Magic
No Magic
 
Posts: 369
Posts Rating:32
Joined: Thu Aug 02, 2012 5:02 am
Full name: Ieva

Re: DSL

Postby shreyas.shah@siemens.com » Mon May 29, 2017 3:32 pm

Hello,

Thanks a lot for your response. I understand the underlying limitations for derived property now. I do have two additional questions:

1. How do you provide value for a meta property? I have stereotyped Myproperty for Property and made it abstract. I also have sub-typed Myproperty into MyString, MyBool, MyReference etc. What I want to do is whenever MyString is created, initialize its type to "String". I cannot figure out how to initialize or provide default value to a meta property such as type.

2. I see that sysml template shows block with multiple compartments. I could not find any documentation on how to define new compartments and their contents. Can you point me to some reference document?

Regards,
Shreyas
shreyas.shah@siemens.com
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed May 24, 2017 12:36 pm

Re: DSL

Postby osvaldas.jankauskas@nomagic.com » Wed May 31, 2017 8:35 am

Hello,

Thank you for your question.

The existing metaproperty name can be changed. This can be done performing the following steps:

1.Create a property of customization.
2. Apply "metaProperty" stereotype for it.
3. Name it the same as existing metaproperty, which you need to rename.
4. Set "New Name" property value to the needed metaproperty name.

As a result, the metaproperty Name would be changed to your specified "New Name" property value.

It is not possible to provide a default value for a meta property. So, your need that after MyString creation its type would be set to the String cannot be achieved. The only thing that you can do is to restrict the type selection by choosing the needed metaclass or stereotype. This can be done performing the following steps:

1.Create a property of customization.
2. Apply "metaProperty" stereotype for it.
3. Name it the same as existing metaproperty, which you need to rename.
4. Set "New Type" property value to the needed metaclass or stereotype.

Note that it is not possible to set the type to the specific primitive type e.g. String. You can define only metaclasses and stereotypes as new types.

It's not possible to define your own compartments.

If you have any other questions or concerns - feel free to contact us.

Best regards,
No Magic, Inc. Customer Support
osvaldas.jankauskas@nomagic.com
Customer Support
Customer Support
 
Posts: 127
Posts Rating:16
Joined: Mon Apr 20, 2015 10:01 am

Re: DSL

Postby shreyas.shah@siemens.com » Thu Jun 01, 2017 2:32 pm

Hello,

I tried what you suggested by adding metaproperty customization. I renamed Type to MyType just to see if that part of the customization is working or not.

Attached image shows what I have done I have tested with and without Suggested Values.

cust.PNG


When I use this, the specification does have MyType label. However, trying to set the value for it, it shows no possible values.

Capture.PNG


Regards,
Shreyas
You do not have the required permissions to view the files attached to this post.
shreyas.shah@siemens.com
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:0
Joined: Wed May 24, 2017 12:36 pm

Re: DSL

Postby osvaldas.jankauskas@nomagic.com » Thu Jun 01, 2017 11:13 pm

Hello,

In the previous message, I wrote:

"Note that it is not possible to set the type to the specific primitive type e.g. String. You can define only metaclasses and stereotypes as new types."

As I mentioned before, types restriction works only for stereotypes and metaclasses. The mechanism is based on defining the metatypes to which type selection would be restricted.

If you have any other questions or concerns - feel free to contact us.

Best regards,
No Magic, Inc. Customer Support
osvaldas.jankauskas@nomagic.com
Customer Support
Customer Support
 
Posts: 127
Posts Rating:16
Joined: Mon Apr 20, 2015 10:01 am


Return to MagicDraw

Who is online

Users browsing this forum: No registered users and 0 guests