EVL: How to define and use a profile and stereotypes in a model validation [message #1730972] |
Sun, 01 May 2016 08:45 |
Alireza Rouhi Messages: 148 Registered: December 2015 |
Senior Member |
|
|
Hi,
Considering the following code to create a non-existing class stereotype:
pre {
// getting the existing FooProfile
var MyProfile = ProfileModel.select(p|p.name = "FooProfile");
}
.
.
.
if (not Stereotype.all.exists(s|s.name = "foo"))
{
// define a new stereotype named with the given name
var stereotype: Stereotype = Stereotype.createInstance();
stereotype.name = "foo";
stereotype.package = MyProfile;
stereotype.feature = "base_Class";
}
else
{
("foo" + " exists!").println();
}
.
.
.
1) The following error is raised when I apply the code in a UML model validation:
Cannot find meta-class 'foo' in model ''
I think, it is required here to store the created stereotype "foo" in my profile model too. Is this true? How can I add the created stereotype to my profile model file (here ProfileModel)?
2) I want to create a UML profile from scratch, i.e., the profile must be created in the pre section of my EVL module. How can I create this profile in the EOL language?
Best regards,
Alireza
[Updated on: Sun, 08 May 2016 09:13] Report message to a moderator
|
|
|
|
|
|
|
Re: EVL: How to define and use a profile and stereotypes in a model validation [message #1731352 is a reply to message #1731248] |
Wed, 04 May 2016 13:51 |
Alireza Rouhi Messages: 148 Registered: December 2015 |
Senior Member |
|
|
Hi all,
I like to define stereotypes which extend metaclasses like Classifier, Operation, etc. Is there any solution to modify the following code in EOL to resolve my problem?
if (not Stereotype.all.exists(s|s.name = "foo"))
{
// define a new stereotype named with the "foo" name here
var stereotype: Stereotype = Stereotype.createInstance();
// the following line raises error,
// even for the string "base_Class" in the right-hand side too
stereotype.metaclass = "base_Classifier";
stereotype.name = "foo";
stereotype.package = MyProfile;
}
else
{
("foo already exists!").println();
}
Thanks
Alireza
[Updated on: Wed, 04 May 2016 16:58] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04206 seconds