[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.ocl] Re: How to check the types of containment?

Hi, Gilbert,

How about something like this:

  context CompositionModel
  inv: let epkg : ecore::EPackage = self.eClass().ePackage,
            supertype : ecore::EClass = epkg.getEClassifier("AbstractModel"),
            concreteTypes : Set(ecore::EClass) = epkg.eClassifiers->select(c |
                    not c.isAbstract and supertype.isSuperClassOf(c))->asSet()
        in
    containedModel->unique(eClass()) and
    containedModel.eClass()->asSet() = concreteTypes

The idea is to find all of the concrete subclasses of AbstractModel and then check that the elements in the containedModel collection are all of different types and that all of the concrete types are instantiated.  Thus, unique instances of every type.

HTH,

Christian


On Fri, 2009-09-11 at 17:05 +0200, Gilbert Mirenque wrote:
And how could I realize it that generically all sub types of
AbstractModel will be checked? I can't do the test for every type
because it can be that the metamodel will be extended.