Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » inter-models OCLs
inter-models OCLs [message #1449602] Tue, 21 October 2014 15:37 Go to next message
Mahin Abbasipour is currently offline Mahin AbbasipourFriend
Messages: 24
Registered: June 2013
Junior Member
Hi,

I have a UML profile in Papyrus and I create some models and apply the created profile on them.
when I write an OCL for a profile, these OCLs are per model. suppose that the profile has a steretype called "A" with a tag value (attribute) "a". if I write an OCL that the summation of value "a" for all instances of A should be greater than 10, then it is checked per each model; while I want to have an OCL that checks the summation of attribute "a" for all instances in all models to be greater than 10. the number of models which are instances of the created metamodel is unknown,
Is it possible to write such OCLs? If not, which tool is used for these purposes? Can you provide the tutorial as well?

Thank you very much,
Mahin
Re: inter-models OCLs [message #1449640 is a reply to message #1449602] Tue, 21 October 2014 16:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5580
Registered: July 2009
Senior Member
Hi

I'm a bit confused since you make some inaccurate statements.

Each OCL Constraint is per-context, which in the case of your Profile is
probably a Stereotype.

The OCL Constraint can be validated for any Element to which that
Stereotype is applied.

Models do not come in to it, except in so far as models maybe the quanta
in which you load Elements.

I am not clear how you can expect a tool to validate models that you
have not loaded. It could be done but the time taken to search the
Internet for all possible models would be prohibitive and it would not
find models behind firewalls unless of course you have an algorithm that
can hack through firewalls in which case ..... good luck.

Perhaps you should draw yourself some pictures so that you understand
what you are really trying to do.

Regards

Ed Willink


On 21/10/2014 16:37, Mahin Abbasipour wrote:
> Hi,
>
> I have a UML profile in Papyrus and I create some models and apply the
> created profile on them.
> when I write an OCL for a profile, these OCLs are per model. suppose
> that the profile has a steretype called "A" with a tag value (attribute)
> "a". if I write an OCL that the summation of value "a" for all instances
> of A should be greater than 10, then it is checked per each model; while
> I want to have an OCL that checks the summation of attribute "a" for all
> instances in all models to be greater than 10. the number of models
> which are instances of the created metamodel is unknown,
> Is it possible to write such OCLs? If not, which tool is used for these
> purposes? Can you provide the tutorial as well?
>
> Thank you very much,
> Mahin
Re: inter-models OCLs [message #1449724 is a reply to message #1449640] Tue, 21 October 2014 19:18 Go to previous messageGo to next message
Mahin Abbasipour is currently offline Mahin AbbasipourFriend
Messages: 24
Registered: June 2013
Junior Member
Hi Ed,
Thanks for the reply.
Yes, When we create a model from a profile that contains a constraint, this constraints are checked for every elements of the instance model that the stereotypes are applied.
I was wondering is it possible to have similar thing but not only inside one instance model, but also between multiple instance models. therefore, the constraint is still on an element (i.e. a stereotype) but this element can be in different instance models.
Actually I need that because I want to be sure that the summation of a specific attribute that can be in different models should not be greater than a value. one possible solution is that to merge all models with model transformation, and have one simple constraint. But the problem is that I don't know how many models I have as input to write the transformation for it. So I was thinking of this way.

Thanks.
Re: inter-models OCLs [message #1450192 is a reply to message #1449724] Wed, 22 October 2014 07:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5580
Registered: July 2009
Senior Member
Hi

Sorry. I have no idea what you want. You provide only a vague
description and nothing resembling an example/repro. What is an instance
model?

Why don't you know how many models you have?

Why don't you just use a known one Collection of some models?

Regards

Ed Willink


On 21/10/2014 20:18, Mahin Abbasipour wrote:
> Hi Ed, Thanks for the reply.
> Yes, When we create a model from a profile that contains a constraint,
> this constraints are checked for every elements of the instance model
> that the stereotypes are applied.
> I was wondering is it possible to have similar thing but not only inside
> one instance model, but also between multiple instance models.
> therefore, the constraint is still on an element (i.e. a stereotype) but
> this element can be in different instance models.
> Actually I need that because I want to be sure that the summation of a
> specific attribute that can be in different models should not be
> greater than a value. one possible solution is that to merge all models
> with model transformation, and have one simple constraint. But the
> problem is that I don't know how many models I have as input to write
> the transformation for it. So I was thinking of this way.
>
> Thanks.
Re: inter-models OCLs [message #1450481 is a reply to message #1450192] Wed, 22 October 2014 13:46 Go to previous messageGo to next message
Mahin Abbasipour is currently offline Mahin AbbasipourFriend
Messages: 24
Registered: June 2013
Junior Member
Hi Ed,

By instance models, I mean the models that I create and apply the defined profile on them.
When we define a profile, someone can make any number of models and apply the defined profile on them. Suppose, each model is for a separate user using a resource. we have a capacity for that resource, and we want to be sure, the summation of all used resources is not more than a total capacity (it's an example).
Re: inter-models OCLs [message #1450596 is a reply to message #1450481] Wed, 22 October 2014 16:30 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5580
Registered: July 2009
Senior Member
Hi

It would seem that an easy way to solve that problem is by reference
counting on the constrained resource. Using EMF, you might use
bidirectional references to ensure that the 'counts' are accurately
maintained. You could use an OCL constraint to impose the limit, but why
not exploit the upper bound of the multiplicity? No need for a
programmatic constraint at all.

Regards

Ed Willink

On 22/10/2014 14:46, Mahin Abbasipour wrote:
> Hi Ed,
>
> By instance models, I mean the models that I create and apply the
> defined profile on them.
> When we define a profile, someone can make any number of models and
> apply the defined profile on them. Suppose, each model is for a separate
> user using a resource. we have a capacity for that resource, and we want
> to be sure, the summation of all used resources is not more than a total
> capacity (it's an example).
Previous Topic:extension of OCL visitor: property vs operation
Next Topic:OCL query failing for the 'matches' function of String
Goto Forum:
  


Current Time: Fri Jan 19 06:03:24 GMT 2018

Powered by FUDForum. Page generated in 0.02750 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software