[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: GMF mapping Audit Rules

Hi, Achilleas,

From the OCL perspective, accessing the types in other models is just as easy as qualifying their names. So, assuming that your metamodels are named mm1 and mm2, respectively, you can do in the context of the mm1::Class1 metaclass:

context Class1:
  mm2::Class2.allInstances()->exists(c2 | self.value1 = c2.value2)

This assumes, of course, that both the mm1::Class1::value1 and mm2::Class2::value2 properties have the same type, probably from some other metamodel mm3 (or, perhaps, ecore if it's one of the Ecore standard data types, for example).

Concerning how to develop GMF models based on multiple metamodels, I have no expertise to offer. I'm quite certain, though, that the subject has been raised several times in this newsgroup, before. A search should turn something up.

Cheers,

Christian


Achilleas wrote:
Hi Christian,

You are always a step ahead with your answers:))..Since I tried your second suggestion and my next question was going to be: "Why the problem marker does not display the message assigned in the corresponding Audit Rule?" I rather gives a custom message that denotes the problem.

Your clarifications are very helpful and give me an insight when I should use each constraint to fit my needs.

I have another question for you though:), if you please could provide me with an answer!

Lets assume that I have two metamodels that are defined as follows:

Metamodel 1:
 Root1(aggregates classes1)
    Class1(includes value1)
       Value1

Metamodel 2:
 Root2(aggregates classes2)
    Class2(includes value2)
       Value2

Is it possible to load into the gmfmap model of Metamodel 1 the resource (i.e. ecore,gmfmap) that points to Metamodel 2 so that I can check if there two instances with equal values (value1,value2)???--- in this case I require them to be equal!

Can it be done in a single audit rule similar to the one below (that you originally provided)?

  context Class1
  inv:
    Class2.allInstances()->forAll(c2 | self.value1 <> c2.value2)

Thanks,

Achilleas