Example: Heterogeneous Model Merging with ECL/EML

rule MatchSystemWithVocabulary
  match s : Source!System
  with v : Vocabulary!Vocabulary {
  
  compare {
    return true;
  }
}

rule MatchEntityWithTerm
  match s : Source!Entity
  with t : Vocabulary!Term {

  compare {
    return s.name = t.name or 
    t.`alias`.exists(a|a.name = s.name);
  }
}
rule MergeEntityWithTerm
  merge s : Source!Entity
  with t : Vocabulary!Term
  into m : Target!Entity {
  
  m.name = t.name;
  m.inDomain = true;
  
}

rule MergeSystemWithVocabulary
  merge s : Source!System
  with v : Vocabulary!Vocabulary
  into t : Target!System {
  
  t.entity = s.entity.equivalent();
}

rule TransformEntity
  transform s : Source!Entity
  to t : Target!Entity {
  
  t.name = s.name;
  t.inDomain = false;
}
@namespace(uri="Entity", prefix="Entity")
package Entity;


class System {
  val Entity[*]#system entity;
}

class Entity {
  attr String name;
  ref System#entity system;
  attr Boolean inDomain;
}
@namespace(uri="DomainVocabulary", prefix="DomainVocabulary")
package DomainVocabulary;

class Vocabulary {
  val Term[*] term;
}

class Term {
  attr String name;
  val Alias[*] alias;
}

class Alias {
  attr String name;
}

Check out the code from the SVN:

  • go to the SVN repository
  • navigate to trunk/examples
  • check out the org.eclipse.epsilon.examples.metamodels project
  • check out the org.eclipse.epsilon.examples.mergeentitywithvocabulary project

Once you have checked out/imported the code, to run the example you need to go through the following steps:

  1. register all .ecore metamodels in the org.eclipse.epsilon.examples.metamodels project (select all of them and then right click and select Register EPackages)
  2. register any .ecore metamodels in the org.eclipse.epsilon.examples.mergeentitywithvocabulary project
  3. right click the .launch file in the org.eclipse.epsilon.examples.mergeentitywithvocabulary project
  4. select Run as... and click the first item in the menu that pops up

What's this?

In this example, we demonstrate merging heterogeneous models using ECL and EML.

What are .emf files?

.emf files are Ecore metamodels expressed using the Emfatic textual syntax.

More examples...

Epsilon Object Language
Epsilon Transformation Language
Epsilon Generation Language
Epsilon Validation Language
Epsilon Merging Language
Epsilon Flock
Combining the Epsilon Languages
EuGENia
EUnit

Even more examples...

More examples are available in the examples folder of the SVN repository.