Facet-oriented modelling

Open objects for model-driven engineering.

Facet-oriented modelling with metaDepth

This page contains a prototype implementation of MetaDepth, supporting facet-oriented modelling, whose main ideas are in the following papers:

Requirements

In order to experiment with the tool, you'll need Java 8 (at least) installed in your computer.

Installation

  • Download the following JAR here.
  • Create a folder and copy the JAR into that folder
  • Open a command line console, go to the folder, and type:
    metaDepth / code
      java -jar metaDepth.jar
      
  • Then, you should see the following in the console:
  • Console output
                                               //    ) )                                 
          _   __      ___    __  ___  ___     //    / /  ___      ___    __  ___ / __    
        // ) )  ) ) //___) )  / /   //   ) ) //    / / //___) ) //   ) )  / /   //   ) ) 
       // / /  / / //        / /   //   / / //    / / //       //___/ /  / /   //   / /  
      // / /  / / ((____    / /   ((___( ( //____/ / ((____   //        / /   //   / /   
    
      MetaDepth v0.3.MTL
      http://metadepth.org
      Top level command shell
      Tue Mar 17 11:18:40 CET 2020
      >
      
  • This is metaDepth's console (the REPL), where you can type commands, load metaDepth (.mdepth) files, or execute file commands (.mdc)
  • Please refer to the documentation for further details on basic commands

Execution and Facet examples

Some examples can be found in this zip file. Please unzip the folder, and set MetaDepth's working directory to the example folder you want to work with. For example, to work with the employees folder, use the following command:

metaDepth / code
  set DIR "[path]/employees/"
  

where [path] is your path to folder employees. Each example contains creation and facet meta-models, sample models, interfaces and facet laws. In addition, they contain executable files that can be run within the tool. For example, the file Pspec.mdc contains the following commands:

metaDepth / code
  load "People"
  load "Employment"
  context Springfield

  addFacet homer 
	work: Employment.Employee with {
	   name = fullName [equality]
	   salary = 12345
	   ssNumber = 555
	}
	
  context Springfield
  dump
  

which simply loads the People and Employment meta-models (People.mdepth also contains a sample model named Springfield), adds a facet to object homer, and dumps the context of model Springfield.

You can run this file with command:

metaDepth / code
  run Pspec
  

There you should see that homer has now the fields of an Employee filled as specified in the add command:

metaDepth / code
  ext People Springfield{
    ...
    @Facets(Employee)
    ext Person homer
    {
      address=SimpsonsHouse;
      fullName="Homer Simpson";
      female=false;
      age=50;
      spouse=marge;
      @Facet(work, Employee)
      name="Homer Simpson";
      @Facet(work, Employee)
      ssNumber=555;
      @Facet(work, Employee)
      salary=12345.0;
    }
    ...
  }
  

You can now for example change homer's fullName, and check that the field name of the work facet changes as well. You can do this using EOL as follows:

Console output
  > # EOL
  :: entering eol execution mode
  > homer.fullName:="Homer Jay Simpson";
  > #
  Warning: current context is $root, setting context to Springfield
  :: executing command 
  

Where the lines starting by ">" are user inputs, and the others are metaDepth replies. By typing command dump, you should see the changes:

metaDepth / code
  ...
  ext People Springfield{
    ...
    @Facets(Employee)
    ext Person homer
    {
      address=SimpsonsHouse;
      fullName="Homer Jay Simpson";
      female=false;
      age=50;
      spouse=marge;
      @Facet(work, Employee)
      name="Homer Jay Simpson";
      @Facet(work, Employee)
      ssNumber=555;
      @Facet(work, Employee)
      salary=12345.0;
    }
    ...
  }
  
The examples zip file contains the following case studies:
  • components: Dynamic product lines of component architectures using facets (run file CmpSpec.mdc).
  • concreteSyntax: Bi-directional synchronization of textual and graphical syntax with facets (People2Graph.mdc).
  • dynamicPL: Dynamic product lines of Petri nets using facets (PNspec.mdc and PNspecInt.mdc).
  • employees: Illustrates basic facet usage (FacetObeObject.mdc), facet laws and scenes (FacetLawAndScene.mdc) as well as analysis (Analysis.mdc).
  • measurable and measurable2: Model transformation reuse using facets (People2Metrics.mdc).
  • multilevel: Powerype-based multi-level modelling using facets (ProdTypesLaw.mdc).
  • multiview: Multi-view modelling using facets (PHE.mdc).
  • processes: Hierarchical modelling using facets (reusingProcesses2.mdc).
  • runTime: Dynamic component reconfiguration using facets and multi-level modelling (CompArchSpec.mdc).