Successfully reported this slideshow.

Eclipse OCL Summary



Upcoming SlideShare
OCL 2.4. (... 2.5)
OCL 2.4. (... 2.5)
Loading in …3
1 of 19
1 of 19

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Eclipse OCL Summary

  1. 1. Eclipse OCL Summary Edward Willink Eclipse (MDT) OCL Project Lead, Eclipse (M2M) QVTd Project Lead Thales representive to OMG OCL RTF, Thales representive to OMG QVT RTF Modeling Symposium BoF 3rd November 2011
  2. 2. MDT/OCL Project context Ecore Modeling Services in Java UML Modeling Services in Java Ecore, UML Execution Services in Java
  3. 3. Executing/Using OCL <ul><li>Use the Java API
  4. 4. Use the Java debugger </li><ul><li>OCL console </li></ul></ul><ul><li>Use OCL in a model ?? </li><ul><li>embed OCL text as XML CDATA
  5. 5. embed OCL text as EAnnotations </li><ul><li>custom OCL genmodel templates </li></ul><li>embed OCL text as EAnnotations </li><ul><li>standard templates and EMF delegates (Helios) </li></ul></ul></ul>
  6. 6. OCLinEcore editor <ul><li>Xtext-based, full Ecore coverage
  7. 7. Embedded OCL, validation messages </li></ul>
  8. 8. Extended behaviour/OCL execution @Generated NOT manual Java (pre-Helios) EMF Delegates support EAnnotations (Helios) Direct OCL 2 Java (Juno) genmodel run run parse interpret genmodel run call genmodel run
  9. 9. Behind the Scenes : Problems OMG OCL specification has significant issues <ul><ul><li>manual editing => ambiguities, inconsistencies
  10. 10. main behaviours obvious
  11. 11. corner cases problematic
  12. 12. no real consideration of UML @ runtime </li><ul><li>profiles, merging, serialization, polymorphism </li></ul></ul></ul>Eclipse OCL Ecore/UML2 bindings have problems <ul><ul><li>direct extension of Ecore.ecore / UML.ecore
  13. 13. accuracy / extensibility </li></ul></ul>
  14. 14. Behind the Scenes : Solutions New Eclipse OCL Pivot binding solution <ul><ul><li>pre-compliant OMG prototype
  15. 15. concrete syntax 'unchanged'
  16. 16. external API similarity </li></ul></ul>Shared models <ul><ul><li>Acceleo auto-generation of specification </li><ul><li>consistent, complete </li></ul><li>Acceleo/genmodel auto-generation of tooling </li><ul><li>useable, correct, extensible </li></ul></ul></ul>Re-useable for OCL-defined languages => QVT
  17. 17. Juno Xtext and Pivot Architecture Develop-time: Java code from Xtext editor Run-time: Fast Java execution Pivot Library Feature Bodies Dispatch Tables Dispatch Runtime Ecore BodyCalls genmodel Acceleo Acceleo Acceleo CSG 2 ASG Editor Parser Xtext Acceleo Acceleo ASG Visitors CSG Visitors Acceleo genmodel genmodel OCLstdlib editor OCLinEcore editor Xtext editor CompleteOCL editor Acceleo genmodel OCL Xtext Console Pivot Runtime
  18. 18. OCL evaluation performance Release Compile-time (genmodel) First Run-time Every Run-time Run-time support Helios Text copy OCL parsing Slow Visitor Interpreter Unmodelled library Indigo Text copy OCL parsing Faster Visitor Interpreter Modelled library Faster library Juno OCL parsing Java Body generation Dispatch Table generation Java JIT Fast Inline Polymorphic Dispatcher Modelled library Faster library Polymorphic values
  19. 19. OCL and Xbase OCL - executable model-oriented specification language <ul><ul><ul><li>Integer has unlimited range, 4.0 is equal to 4
  20. 20. anObject.oclType().name = 'Class'
  21. 21. side effect free => analyzable (Impact Analyzer) </li></ul><li>many small projects </li></ul></ul>Xbase - pragmatic Java-like implementation language <ul><ul><ul><li>java.lang.Integer, 4.0 not usually equal to 4
  22. 22. anObject.eClass().name == &quot;EClass&quot;
  23. 23. side effecting => limited analysis </li></ul><li>coherent support from itemis </li></ul></ul>Both almost useless till embedded in some context
  24. 24. OCLinEcore and Xcore <ul><li>Textual Ecore </li><ul><li>find / replace / search editing
  25. 25. full text </li></ul></ul>Ecore compliance Operation/Property bodies XMI 100% whatever KM3 80% no Emfatic 95% no Xcore 95% + Xbase + genmodel interpreted Xbase (Juno) Xbase2Java (Juno) OCLinEcore >99% + OCL (+ some UML) interpreted OCL (Helios) OCL2Java (Juno)
  26. 26. Summary Eclipse OCL was <ul><li>a Java-based model
  27. 27. executed by run-time parsing and interpretation </li></ul>Eclipse OCL is (in Helios and Indigo) <ul><li>an integrated editable, interpretable language
  28. 28. Xtext OCLinEcore hides the EAnnotation details </li></ul>Eclipse OCL will be (Juno M3) <ul><li>executed by genmodelled direct Java code
  29. 29. sharing models with OCL specification </li></ul>
  30. 30. Obect Control Language <ul><li>OMG specification - OCL 2.x split off from UML 1.x </li><ul><li>generic UML-independent constraint expressions
  31. 31. foundation for many other modelling specifications
  32. 32. e.g MOFM2T (Acceleo) </li></ul></ul><ul><li>direct navigation
  33. 33. compact iterations/loops
  34. 34. embedded anonymous functions </li></ul>
  35. 35. Ecore OCL Architecture Develop-time: EAnnotation from Text editor Run-time: OCL parsed by old LPG tooling Ecore Library CS 2 AS Parser LPG ASG CST genmodel genmodel Sample Ecore editor Text editor OCL Console Ecore Runtime Ecore genmodel CDATA CS actions EMF Delegate EAnnotations EAnnotations + templates
  36. 36. Helios Xtext Architecture Develop-time: EAnnotation from Xtext editor Run-time: OCL parsed by old LPG tooling Editor Parser Xtext CSG genmodel OCLstdlib editor OCLinEcore editor Xtext editor CompleteOCL editor Ecore genmodel
  37. 37. Indigo Xtext and Pivot Architecture Develop-time: EAnnotation from Xtext editor Run-time: OCL re-parsed by Xtext tooling Pivot Library Ecore CSG 2 ASG Editor Parser Xtext Acceleo Acceleo ASG Visitors CSG Visitors Acceleo genmodel genmodel OCLstdlib editor OCLinEcore editor Xtext editor CompleteOCL editor OCL Xtext Console Pivot Runtime genmodel
  38. 38. OCL Resources <ul><li>OCL 2.2 Specification </li><ul><ul><li>Clause 7 is quite readable (many typos) </li></ul></ul></ul><ul><li>The Object Constraint Language: Getting Your Models Ready For MDA Jos B. Warmer, Anneke Kleppe </li></ul><ul><li>Eclipse MDT/OCL project </li></ul>
  39. 39. Project History Pre-Helios IBM contribution Christian Damus Helios OCL delegates Xtext editors OCLinEcore Essential OCL Complete OCL syntactic validation Indigo Pivot model Impact Analyzer Library model Xtext OCL Console re-use in Papyrus re-use in Xtext Accurate evaluation Faster evaluation semantic validation Juno OCL2Java promotion from examples re-use for QVTd Fast evaluation model-defined model validation
  40. 40. Essential OCL embedding <ul><li>Interactive Xtext OCL Console </li><ul><li>supports interactive practice of OCL expressions
  41. 41. re-uses Xtext editor </li><ul><li>eliminates need for intuitive assistant </li></ul></ul></ul><ul><li>Papyrus Class Diagram Constraint editor </li><ul><li>embedded Xtext Essential OCL editor </li><ul><li>pop-up to augment UML model </li></ul></ul></ul>