General (#1) - Models without some elements (#14) - Message List

Models without some elements
 unsolved

I have problems with transforming UML models with missing (optional) elements.
A bit more precise, I have a transformation script with f.e. relations for classes (or any elementtype else) and it doesn't deliver proper output, if my source model does not consist of any class.


Let's take:

 UmlToUml ( source : uml, target : uml ) {
top relation Models
{
modelName : String;checkonly domain source src : uml::Model
{
name = modelName,
packagedElement = srcPkg : Package {},
packagedElement = srcCls : Class {},
packagedElement = srcDt : DataType {}
};
enforce domain target dst : uml::Model
{
name = modelName,
packagedElement = dstPkg : Package {},
packagedElement = dstCls : Class {},
packagedElement = dstDt : DataType {}
};
where
{
Packages (srcPkg, dstPkg);
Classes (srcCls, dstCls);
Datatypes(srcDt, dstDt);
}
}
relation Packages
{
packageName : String;checkonly domain source src : uml::Package { name =  packageName };enforce domain target dst : uml::Package { name = packageName };
}
relation Classes
{
className : String;checkonly domain source src : uml::Class { name = className };
enforce domain target dst : uml::Class { name = className };
}
relation Datatypes
{
datatypeName : String;checkonly domain source src : uml::DataType { name = datatypeName };enforce domain target dst : uml::DataType { name = datatypeName };
}
}

This doesn't deliver proper targets, if f.e. a package or class or datataype isn't part of the source model (what may be the case in my opinion).

Is this a problem with medini or is it a problem with my understanding the RL specification ?

Thanks for help,

Siegfried

  • Message #31

    A uml::Model is only matched if it has at least one Package, at least one Class and at least one DataType. Is this really what you want?

  • Message #32

    The following maybe a solution:

    top relation Models
    {
      modelName : String;
      checkonly domain source src : uml::Model { name = modelName };
      enforce   domain target dst : uml::Model { name = modelName };
      where
      {
        Packages (src, dst);
        Classes  (src, dst);
        Datatypes(src, dst);
      }
    }
    relation Packages
    {
      packageName : String;
      checkonly domain source src : uml::Package
      {
        packagedElement = spe : Package { name = packageName }
      };
      enforce  domain target dst : uml::Package
      {
        packagedElement = tpe : Package { name = packageName }
      };
    }
    relation Classes
    {
      className : String;
      checkonly domain source src : uml::Package
      {
        packagedElement = spe : Class { name = className }
      };
      enforce domain target dst : uml::Package
      {
        packagedElement = tpe : Class { name = className }
      };
    }
    relation Datatypes
    {
      datatypeName : String;
      checkonly domain source src : uml::Package
      {
        packagedElement = spe : !DataType { name = datatypeName }
      };
      enforce domain target dst : uml::Package
      {
        packagedElement = spe : !DataType { name = datatypeName }
      };
    }
    

    Yet I don't know exactly why?

    Siegfried

    • Message #33

      The reason is simple: in your first version, the domain "src" only matched if all contained variables match, i.e. if there is a DataType which can be bound to srcDt and if there is a ...

      Now, in your current version this is no longer a condition, so it works.

      • Message #34

        Yes, now I remember that from the specification. 

        Thank you,

        Siegfried 

Attachments

No attachments created.