M2M Transformations and an MDE Application

Model-to-model (M2M) transformations in MDE corresponds to database-to-database transformations in MDELite.  In this assignment, you will write a M2M  transformation to map databases of type VPL to databases of type YPL, and use Yuml to display your class diagrams. This will involve writing 2 Java programs.

You are to continue working in pairs.

Yuml

Yuml is a free web service that draws UML class diagrams given a Yuml input specification.  As this is a for-profit company, the "free" service comes with some strings attached.  Namely, it will produce a pretty class diagram for you provided that your specification is not too complicated.  (I found other problems with Yuml, but this is a story for another day).

Familiarize yourself with Yuml:

[student|name]has-loves[course|name]


YPL Schema and the YPL2Yuml M2M Tool

In assignment P2, you became familiar with the VPL schema.  A database instance of this schema is produced by transforrming an ugly Violet XML document (below X.class.violet) into a VPL database (below X.vpl.pl):
> java Violett.ClassParser X.class.violet
MDELite7 has a tool that transforms a YPL database (below X.ypl.pl)  into a YUML document (below X.yuml.yuml):
> java Yuml.ClassUnParser X.ypl.pl
The transformation chain that we have (and want to implement) is shown below:



Ovals are domains and arrows are total functions. (A total function maps every element in its input domain to some element in the output domain).  Thus, we have  Violett.ClassParser:XmlViolet→VPL, Yuml.ClassUnParser:YPL→Yuml, and what is missing is a tool to implement vpl2ypl:VPL→YPL. Your task is to write a Java program M2M.vpl2ypl that performs the VPL→YPL database translation:
> java M2M.vpl2ypl X.vpl.pl
Where:

YPL Schema

Here is the starting VPL schema which you have used before:
% Violet (vpl) class database

dbase(vpl,[vBox,vAssociation]).

% type = c(class),i(nterface),n(ote). packages are skipped

table(vBox,[id,type,"name","fields","methods",x,y]).

% type1,type2 = c(lass) or i(nterface)
% lineStyle = ""(solid) or "DOTTED"
% arrow1,2 = V, TRIANGLE, DIAMOND, BLACK_DIAMOND, "" (NONE)
% bentStyle = "", HV, VH, HVH, VHV

table(vAssociation,[id,cid1,type1,"role1","arrow1",cid2,type2,"role2","arrow2","bentStyle","lineStyle","middleLabel"]).

Here is the YPL schema:
% yuml class schema

dbase(ypl,[yumlBox,yumlAssociation]).

% type = n (for note), c (for class), i (for interface)

table(yumlBox,[id,type,"name","fields","methods"]).

% end1 = <> | ++ | ^ | < | "" (nothing)
% end2 = <> | ++ | ^ | > | "" (nothing)
% lineType = - | -.-

table(yumlAssociation,[id,box1,"role1","end1","lineType",box2,"role2","end2"]).
Basically, vBox tuples map to yumlBox tuples, etc. Your Java program M2M.vpl2ypl does this translation.

I give you a NetBeans shell of a project for this assignment.  Use it.  It contains regression tests that your program must satisfy.

Final Step: Write a Java Program to Implement the Translation Chain

Your last step is to write a Java program (whose main method is but a few lines) that implements the entire transformation chain of the above Figure, including your P2 VPL.Conform file to validate a Violet class diagram. Your program is M2M.Violet2Yuml:
> java M2M.Violet2Yuml X.violet.class
Which translates file X.violet.class to file X.yuml.yuml. You will need to use MDELite7's Yuml.ClassUnparser, which maps YPL files to YUML specifications (.ypl.pl .yuml.yuml files). A shell of this program is also available, with regression tests, in the NetBeans shell given above.

What to Submit

All of the below in a zip file. The zip file must unzip into <yourName>/<YourFilesAndDirectories>.
  1. Your completed NetBeans Project, with programs M2M.vpl2ypl and M2M.Violet2Yuml passing all regression tests.

  2. Expect the TA to try some Violet files of his/her own making on your programs.
     
  3. A PDF file (in the required format) that the Grader should read to provide any information that is not obvious.  For each Violet test file given as a regression test, show its class diagram and the corresponding class diagram your program produces using Yuml

A critical part of any design is clarity and understandability.   Hence, you will be graded on the clarity of your project and its ability to work correctly.  Sloppy code, documentation, or anything that makes grading or understanding your program difficult will cost you points.  Beware, some of these "beauty" points are subjective. 

Remember: No late assignments/submissions will be accepted.