Writing Constraints, Model-to-Model, and Model-to-Text Transformations
changes in red

Find a partner.  You are to work in groups of 2 in this (and other) programming assignments.

This assignment is aimed at covering the major bases in MDE: constraints, M2M, and M2T transformations using MDELite.  Start by downloading MDELite8 and installing it in some convenient directory. MDELite is a set of Java packages developed for Windows and should work in Mac and Linux environments -- no guarantees though!

We reviewed in class the ATL family-to-persons M2M and its corresponding MDELite program.  This assignment is based on families-to-persons -- you will write a:

  1. A conformance program for families2 databases. ("families2" is the name of a schema).
  2. A M2M transformation of a families2 database to a families1 database.  ("families1 is the name of another database schema).
  3. A M2T transformation to report the contents of a families1 database.

Here is the main method of a Java class that invokes all three programs that you are to write.  Comment out the programs that you haven't written until all are implemented.

     public static void main(String... args)  {			// <-- program #1
try {
System.out.println("conform: bad.families2.pl");
ConformFamilies2.main("bad.families2.pl"); // <-- program #2
} catch (Exception e) {
System.out.println(e.getMessage());
}
try {
System.out.println("conform: ahmet.families2.pl");
ConformFamilies2.main("ahmet.families2.pl");
} catch (Exception e) {
System.out.println(e.getMessage());
}

doit("inria");
doit("ahmet3");
}

static void doit(String in) {
String i = in+".families2.pl";
String o = in+".families1.pl";
System.out.println("conform: "+i);
ConformFamilies2.main(i);
// <-- program #2 again
M2M.main(i); // <-- program #3
System.out.println("output: "+o);
M2T.main(o); // <-- program #4
}
For each part, do the reading assignment before you proceed.

Note: MDELite is a large package.  It may take you some time to work your way through it and its documentation.  Please feel free to post me email/Piazza notes on how to do <whatever?>   I'd be happy to save you some time with advice.  If you have problems/bugs, if I can help, let me know.  The programs you are to
write are not long, but they're dense.

Your regression test is given below, you just need to change the code in red to point to the right directory.  You execute your main program.  It produces some standard out text, and your M2T transformations produce "ahmet.txt" and "inria.txt". Here are your input files and correct output files:

and in case you need it, the schema for families1:

package p1cs392f;

import org.junit.Test;

public class P1cs392fTest {
public P1cs392fTest() {}

static final String Correct = "test/p1cs392f/Correct/";

@Test
public void testMain() throws Exception {
RegTest.Utility.redirectStdOut("out.txt");
P1cs392f.main();
RegTest.Utility.validate("out.txt", Correct+"all.txt", false);
RegTest.Utility.validate("ahmet.txt", Correct+"ahmet.txt", false);
RegTest.Utility.validate("inria.txt", Correct+"inria.txt", false);
}
}

Part 1: Constraints

From the MDELite Documents, read:
Also note that the following code fragments will be your friend:
Table myTable = ...;  // initialize table

myTable.print(); // print contents of table to System.out
And finally, review the class notes on ATL Families; see this too.

Recall the ATL Families metamodel, shown below:



An MDELite database of the original ATL example is inria.families2.pl.  This design is a bit strange as it takes some time to understand.  In particular, note the following:

What to Submit for Part 1


Part 2: M2M Transformations

From the MDELite Documents, read:


There are two different but equivalent schemas for the family database. You are given databases that are instances of schema f2.  You are to translate these databases to corresponding databases of schema f1.  The difference in schemas is that each member tuple of f2 has a pair of family pointers that indicate whether the member is male or female AND the family to which he/she belongs.  f1 uses a more sane encoding: one pointer to the family and a boolean indicating sex.

You are to write an M2M MDELite Java program that transforms x.families2.pl to its corresponding x.families1.pl counterpart.  Note that the tables of x.families1.pl should be sorted by (increasing) tuple identifier.

What to Submit for Part 2



Part 3: M2T Transformations

From the MDELite Documents, read:


A Model-to-Text (M2T) or database-to-text transformation in MDELite uses the RunningBear (RB) tool.  You are to translate inria.families2.pl and ahmet.families2.pl to produce the following output files:


What to Submit for Part 3


What to Submit to Canvas

  1. a single zip file
  2. the request for Part 1
  3. the request for Part 2
  4. the request for Part 3
  5. Remember to put your name and email address at the top of your submitted PDF file.

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.