Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334551

Summary: [Flock] Rule re-use for subtypes in original metamodel
Product: [Modeling] Epsilon Reporter: Louis Rose <louis>
Component: CoreAssignee: Louis Rose <louis>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: interim

Description Louis Rose CLA 2011-01-17 12:15:45 EST
Presently, Flock rules cannot be specified on abstract types, which limits re-use. The following strategy (for GMF Graph) exhibits duplication because of this:

// Compartment, Connection, Node and DiagramLabel are subtypes of the abstract class DiagramElement
migrate Compartment {
  migrated.figure := original.figure.length();
}

migrate Connection {
  migrated.figure := original.figure.length();
}

migrate DiagramLabel {
  migrated.figure   := original.figure.length();
  migrated.accessor := original.accessor.length();
}

migrate Node {
  migrated.figure := original.figure.length();
}
Comment 1 Louis Rose CLA 2011-01-17 12:19:32 EST
I could think of two solutions (there are probably more):

- add abstract rules and an extends keyword to rules
- separate "retyping" (to part of rules) and rule application (to allow rules to be executed on abstract types)

I preferred the latter approach because it adds fewer new concepts to the language, and (presuming that migration logic is often similar for subtypes) should yield more concise migration strategies than the former. With the former approach, it would have been possible to re-use migration logic from types outside of the inheritance hierarchy, but I don't anticipate much demand for this.

Now, the above migration strategy is written:

migrate DiagramElement {
  migrated.figure := original.figure.length();
}

migrate DiagramLabel {
  migrated.accessor := original.accessor.length();
}
Comment 2 Louis Rose CLA 2011-01-17 12:27:45 EST
Checked into SVN. Assigning to Dimitris for build integration; thanks!
Comment 3 Louis Rose CLA 2011-06-01 14:19:23 EDT
This was fixed no later than interim build 0.9.0.201104180016.
Comment 4 Dimitris Kolovos CLA 2011-07-25 08:15:42 EDT
Fixed in 0.9.1