Successfully reported this slideshow.
Your SlideShare is downloading. ×

Partial Loading of XMI Models

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 88 Ad
Advertisement

More Related Content

Advertisement

Similar to Partial Loading of XMI Models (20)

Advertisement

Partial Loading of XMI Models

  1. 1. 1 Par$al Loading of XMI Models Ran Wei, Dimitris Kolovos, Antonio Garcia-Dominguez, Konstan9nos Barmpis, Richard Paige University of York
  2. 2. 2
  3. 3. 3Outline •  Context: EMF and XMI •  EMF's XMI Parser •  Par9al XMI Loading •  Evalua9on & Limita9ons •  Conclusions & Future Work
  4. 4. 4Context •  Eclipse Modeling Framework (EMF) –  De-facto standard for building MDE tools •  OCL, Xtext, ATL, Epsilon, EMF-IncQuery, Acceleo, Xpand •  XML Metadata Interchange (XMI) –  Enables model interoperability –  Supported na9vely by EMF and as an import/export format by modeling tools •  e.g. Enterprise Architect, Modelio, MagicDraw, MicrosoW Visio, Visual Paradigm
  5. 5. 5The Problem •  Model management opera9ons (valida9on, transforma9on, etc. ) typically use only a subset of the elements of a model •  EMF’s XMI parser needs to load the en9re model anyway –  Wasteful (memory + 9me)
  6. 6. 6var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  7. 7. 7Alterna$ves to XMI •  Binary model serialisa9on –  Supported na9vely by EMF –  Smaller files and faster –  S9ll requires full loading •  Database-backed model persistence –  NeoEMF, CDO, Morsa, MongoEMF –  Support dynamic model element loading/unloading –  Not widely supported by modelling tools (yet)
  8. 8. 8Contribu$ons •  A par9al XMI loading algorithm –  Skip irrelevant model elements –  Expected memory and performance benefits •  An implementa9on of the algorithm as an extension to EMF's XMI parser –  To avoid reinven9ng the wheel –  To facilitate exploita9on by EMF-based model management languages and tools
  9. 9. 9EMF's XMI Parser •  Event-based (SAX) parser – startDocument, startElement, endElement etc. •  Keeps track of its posi9on in the model using a stack of model elements (EObjects) – On start element: the top of the object stack is used to determine what EObject to create – On end element: the top of the object stack is removed
  10. 10. 10The University Metamodel
  11. 11. 11EMF's XMI Parser Object Stack Resource
  12. 12. 12EMF's XMI Parser Object Stack :University Resource :University
  13. 13. 13EMF's XMI Parser :University Object Stack :University Resource :Department :Department
  14. 14. 14EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :Lecturer
  15. 15. 15EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :Lecturer :WebPage :WebPage
  16. 16. 16EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :Lecturer :WebPage
  17. 17. 17EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :Lecturer :WebPage
  18. 18. 18EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :WebPage
  19. 19. 19EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Student :Lecturer :WebPage :Student
  20. 20. 20EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :WebPage :Student
  21. 21. 21EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Module :Lecturer :WebPage :Student :Module
  22. 22. 22EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Module :Lecturer :WebPage :Student :Module :WebPage :WebPage
  23. 23. 23EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Module :Lecturer :WebPage :Student :Module :WebPage
  24. 24. 24EMF's XMI Parser :University Object Stack :University Resource :Department :Department :Lecturer :WebPage :Student :Module :WebPage
  25. 25. 25EMF's XMI Parser :University Object Stack :University Resource :Department :Lecturer :WebPage :Student :Module :WebPage
  26. 26. 26EMF's XMI Parser Object Stack :University Resource :Department :Lecturer :WebPage :Student :Module :WebPage
  27. 27. 27EMF's XMI Parser Object Stack :University Resource :Department :Lecturer :WebPage :Student :Module :WebPage
  28. 28. 28EMF's XMI Parser •  Every XMI element is processed •  All EObjects need to be created •  All aeribute/reference slots are populated
  29. 29. 29Par$al XMI Loading •  Effec9ve Metamodel (aka footprint) – Extracted from model management programs – … so that we know what to load from a model •  Par9al Loading Algorithm – Extension of EMF’s XMI parsing algorithm – Uses the effec9ve metamodel to •  Skip XMI elements •  Avoid crea9on of elements that are not needed •  Avoid popula9on of slots that are not needed
  30. 30. 30Effec$ve M2 Extrac$on •  Iden9fies types/features that are likely to be accessed during the execu9on of a model management program – Extracts an "effec9ve metamodel" •  Prototype for Epsilon but applicable to any sta9cally analysable language
  31. 31. 31Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  32. 32. 32Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  33. 33. 33Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  34. 34. 34Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  35. 35. 35Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  36. 36. 36Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  37. 37. 37Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  38. 38. 38Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  39. 39. 39Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  40. 40. 40Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  41. 41. 41Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  42. 42. 42Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  43. 43. 43Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  44. 44. 44Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage WebPage var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  45. 45. 45Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage WebPage url var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  46. 46. 46Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage WebPage url var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  47. 47. 47Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage WebPage url var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  48. 48. 48Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage modules WebPage url var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  49. 49. 49Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage modules WebPage url Module var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  50. 50. 50Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage modules WebPage url Module var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  51. 51. 51Effec$ve M2 Extrac$on Effec9ve Metamodel Lecturer first_name last_name webPage modules WebPage url Module var lecturers = Lecturer.allOfKind(); for (l in lecturers) { l.first_name.println(); l.last_name.println(); l.webPage.url.println(); l.modules.size().println(); }
  52. 52. 52Effec$ve M2 Extrac$on
  53. 53. 53Effec$ve M2 Reconcilia$on •  Effec9ve metamodels extracted from model management programs may be incomplete –  They require reconcilia9on
  54. 54. 54Effec$ve M2 Reconcilia$on
  55. 55. 55Par$al Loading Algorithm •  The en9re document is s9ll read but only XMI elements of elements are processed •  Novelty: Placeholder Objects – The object stack is essen9al to EMF's XMI loading algorithms – We create one placeholder object for each irrelevant type and use in in the place of ignored model elements
  56. 56. 56Reconciled Effec$ve M2
  57. 57. 57Par$al XMI Loading Object Stack Resource Placeholders :University :Department :Student
  58. 58. 58Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student
  59. 59. 59Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department
  60. 60. 60Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer
  61. 61. 61Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :Lecturer
  62. 62. 62Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :Lecturer :WebPage :WebPage
  63. 63. 63Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :Lecturer :WebPage :WebPage
  64. 64. 64Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :Lecturer :WebPage
  65. 65. 65Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage
  66. 66. 66Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Student
  67. 67. 67Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Student
  68. 68. 68Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage
  69. 69. 69Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Module :Module
  70. 70. 70Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Module :Module :WebPage
  71. 71. 71Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Module :Module
  72. 72. 72Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Department :Lecturer :WebPage :Module
  73. 73. 73Par$al XMI Loading :University Object Stack Resource Placeholders :University :Department :Student :Lecturer :WebPage :Module
  74. 74. 74Par$al XMI Loading Object Stack Resource Placeholders :University :Department :Student :Lecturer :WebPage :Module
  75. 75. 75Par$al XMI Loading Object Stack Resource Placeholders :University :Department :Student :Lecturer :WebPage :Module
  76. 76. 76Par$ally Loaded Model
  77. 77. 77Integra$on with EMF
  78. 78. 78 Evalua$on_
  79. 79. 79Benchmarks •  Models from GraBaTs 2009 •  5 data sets – set0 – set4, obtained by reverse-engineering Java projects – Sizes: 9.2MB, 27.9MB, 283.2MB, 626.7MB and 676.9MB •  Benchmark query sets – EOL queries automa9cally generated to access 20%, 40%, 60%, 80% and 100% of all data sets
  80. 80. 80Benchmark Results: Set 0
  81. 81. 81Benchmark Results: Set 1
  82. 82. 82Benchmark Results: Set 2
  83. 83. 83Benchmark Results: Set 3
  84. 84. 84Benchmark Results: Set 4
  85. 85. 85Observa$ons •  Linear behaviour with regard to the number of model elements and slots of interest – Loading 9me – Memory footprint •  When loading 100% of the model, the par9al loading algorithm is marginally slower
  86. 86. 86Limita$ons •  XMI models should use unique IDs rather than fragment path IDs – Such as //@departments.0/@modules.0 •  Par9ally loaded models are read-only – Changes cannot be saved back to the original model
  87. 87. 87Conclusions •  First aeempt to par9ally load XMI models •  to save 9me and memory •  Algorithm implemented as an extension to EMF's XMI parser •  Scales linearly with respect to the number of model elements and slots of interest
  88. 88. 88Future Work •  Run9me model-level pruning – Avoiding XML tags and its children if completely not needed •  Propaga9ng changes back to the original model •  Suppor9ng fragment path IDs •  Par9al loading of models serialised in EMF's binary format

×