Successfully reported this slideshow.
Your SlideShare is downloading. ×

The Epsilon Pattern Language

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Epsilon
Epsilon
Loading in …3
×

Check these out next

1 of 17 Ad
Advertisement

More Related Content

Slideshows for you (20)

Advertisement
Advertisement

The Epsilon Pattern Language

  1. 1. The Epsilon Pattern Language Dimitris Kolovos, Richard Paige May 22, 2017 Department of Computer Science University of York 9th Workshop on Modelling in Software Engineering (MiSE) ICSE 2017, Buneos Aires, Argentina
  2. 2. Pattern Matching • In general: finding sub-structures of interest within more complex structures • e.g. character sequences that look like email addresses • In modelling: finding sets of model elements that have certain properties and/or are connected in interesting ways 1
  3. 3. Example: Attributes to Pull Up • Find pairs of attributes that can be moved up to a common supertype 2
  4. 4. Declarative Pattern Matching • Describe patterns declaratively • Let the pattern matching engine figure out the optimal execution plan 1 1 from Arend et. al. – Henshin: Advanced Concepts and Tools for In-Place EMF Model Transformations, ACM/IEEE MoDELS 2010 3
  5. 5. Declarative Pattern Matching Languages Strengths • Lots of room for behind-the-scene optimisation • Can be executed incrementally (speed/memory trade-off) Weaknesses • Complex patterns can be challenging/verbose to express graphically • Falling back to complex expressions can reduce the scope for optimisation/incrementality • Current execution planners are not great 4
  6. 6. Practical Considerations • Bound to a particular modelling technology / model representation format • Non-negligible conversion cost • No support for patterns that involve elements from different (heterogeneous) models • e.g. UML activities and Simulink blocks • No out-of-the-box support for “exporting” the results of pattern matching to downstream activities (e.g. M2M, M2T) 5
  7. 7. Epsilon Pattern Language • Hybrid OCL-based pattern matching language • Modelling-technology independent • Support for patterns that involve elements from multiple heterogeneous models • Support for “exporting” detected pattern instances to M2T, M2M transformations etc. 6
  8. 8. Epsilon Organisation eclipse.org/epsilon 7
  9. 9. Example: Attributes to Pull Up • Find pairs of attributes that can be moved up to a common supertype 8
  10. 10. Finding Attributes to Pull Up using EPL pattern AttributesToPullUp c : EClass , a1 , a2 : EAttribute { match : a1.name = a2.name and a1.eType = a2.eType and a1 <> a2 and a1. eContainingClass . eAllSuperTypes .includes(c) and a2. eContainingClass . eAllSuperTypes .includes(c) } 9
  11. 11. A More Performant Version pre { var attributes = EAttribute.all.mapBy(a|a.name ); } pattern AttributesToPullUp c : EClass , a1 : EAttribute , a2 : EAttribute from : attributes.get(a1.name ). excluding(a1) { match : a1.eType = a2.eType and a1. eContainingClass . eAllSuperTypes .includes(c) and a2. eContainingClass . eAllSuperTypes .includes(c) } 10
  12. 12. Adding a Second Model • To specify attributes which should be ignored during pattern detection • The second model is an Excel spreadsheet with one worksheet called “Ignore” M class attribute . . . . . . Employee name . . . . . . C 11
  13. 13. Pattern Matching on Two Models pre { var attributes = M!EAttribute.all.mapBy(a|a.name ); } pattern AttributesToPullUp c : M!EClass , a1 : M!EAttribute , a2 : M!EAttribute from : attributes.get(a1.name ). excluding(a1) guard : not a1.isIgnored() and not a2.isIgnored() { match : a1.eType = a2.eType and a1. eContainingClass . eAllSuperTypes .includes(c) and a2. eContainingClass . eAllSuperTypes .includes(c) } operation M!EAttribute isIgnored() { return C!Ignore.all.exists(i|i.attribute = self.name and i.class = self. eContainingClass .name ); } 12
  14. 14. Consuming Pattern Instances • Pattern instances are wrapped as an EMC-compatible in-memory “model” • Patterns become types (e.g. AttributesToPullUp) • Roles become fields (e.g. c, a1, a2) • Other Epsilon programs can query and navigate them • To transform, validate them etc. • . . . even to detect patterns of patterns 13
  15. 15. Pattern Matching in a Workflow <project default="main"> <target name="main"> <epsilon.emf.loadModel name="M" modelfile="model.ecore" metamodeluri="http://www.eclipse.org/emf/2002/Ecore"/> <epsilon.loadModel name="C" type="ExcelModel"> <parameter name="SPREADSHEET FILE" file="config.xlsx"/> </epsilon.loadModel> <epsilon.epl src="patterns.epl" exportas="P"> <model ref="M"/> <model ref="C"/> </epsilon.epl> <epsilon.eol> for (atp in P!AttributesToPullUp.all) { atp.c.name.println(); } <model ref="M"/><model ref="C"/><model ref="P"/> </epsilon.eol> </target > </project > 14
  16. 16. Future Work • Experimental evaluation against GrGen.NET, Henshin, VIATRA/EMF-IncQuery, AGG etc. • Static analysis • Parallel and incremental pattern matching 15
  17. 17. Summary • Hybrid OCL-based pattern matching language • Modelling-technology independent • Support for “exporting” detected patterns to downstream model management programs eclipse.org/epsilon 16

×