Multiple stereotype instances

UML related questions and discussions

Moderator: Moderators

Multiple stereotype instances

Postby jvernonjpmc » Fri Oct 06, 2017 11:15 am

I want to be able to record the mapping of database elements, e.g. tables, to elements in class models, e.g. classes.

Sometimes a table maps to multiple classes. When I record a mapping, I want to record the element and the reason. Therefore, for each table, there may be multiple element / reason value pairs.

I have implemented this as a stereotype, where metaclass type is Element, and there are two attributes, mappedElement: Element and reason : String.

This only allows me to record the mapping of each table to one class. How do I define the stereotype to allow me to record the mapping of each table to multiple classes?

Thank you
jvernonjpmc
Forum Beginner
Forum Beginner
 
Posts: 30
Posts Rating:0
Joined: Mon Aug 15, 2016 3:56 pm

Re: Multiple stereotype instances

Postby Rolandas » Mon Oct 09, 2017 8:16 am

Hello,

Change the multiplicity mappedElement: Element to *. Or to number your require.

Regards,
No Magic Support Team
Rolandas
Customer Support
Customer Support
 
Posts: 156
Posts Rating:10
Joined: Mon Jul 30, 2012 3:59 am

Re: Multiple stereotype instances

Postby jvernonjpmc » Tue Oct 10, 2017 6:39 am

Sorry I should have been more specific.

Your solution allows me to record the mapping of each table to multiple classes. How do I define the stereotype to allow me to record the mapping of each table to multiple classes, and with each mapping, record the reason? That is, for each mapping, I want to record the mapped element and the reason. So I could map Table T to classes C1 and C2 and for the mapping of T to C1 I record reason R1, and for the mapping of T to C2 I record reason R2.

Thank you
jvernonjpmc
Forum Beginner
Forum Beginner
 
Posts: 30
Posts Rating:0
Joined: Mon Aug 15, 2016 3:56 pm

Re: Multiple stereotype instances

Postby Rolandas » Tue Oct 10, 2017 11:31 pm

Hello,

There is no simple solution to that. You need to make another class probably, that has the tags you need. Then your main object mapping should be that type. You create and fill tags for newly created class and set tags, then set that class as mapping object. Mapping should be multiplicity *. Or similar. Depends how you fill it, how you want to handle it.

Regards,
No Magic Support Team
Rolandas
Customer Support
Customer Support
 
Posts: 156
Posts Rating:10
Joined: Mon Jul 30, 2012 3:59 am

Re: Multiple stereotype instances

Postby jvernonjpmc » Wed Oct 11, 2017 8:42 am

Can you provide an example, or point me to a tutorial?

Thank you
jvernonjpmc
Forum Beginner
Forum Beginner
 
Posts: 30
Posts Rating:0
Joined: Mon Aug 15, 2016 3:56 pm

Re: Multiple stereotype instances

Postby Rolandas » Thu Oct 12, 2017 12:48 am

Hello,

You want example/tutorial of code how to create it? Or model how to create?
From model. You have a Stereotype A, that has mappedElement: Element and reason : String
Ok, now you create another Stereotype B that has, list: Stereotype A [*]

When you importing elements, you create Element with Stereotype A and fill mappedElement, reason. Then add that element to your Element that has Stereotype B, to list.
How to work with OpenAPI from code, you can find here: https://docs.nomagic.com/display/MD185/ ... l+elements


Regards,
No Magic Support Team
Rolandas
Customer Support
Customer Support
 
Posts: 156
Posts Rating:10
Joined: Mon Jul 30, 2012 3:59 am


Return to Software Modeling (UML)

Who is online

Users browsing this forum: No registered users and 0 guests