Download presentation
Presentation is loading. Please wait.
Published byAshlynn Floyd Modified over 8 years ago
1
Budapest University of Technology and Economics Department of Measurement and Information Systems Foundations of DSLs in the Eclipse Modeling Framework Dániel Varró Budapest University of Technology and Economics (BME) Dagstuhl Seminar Schloss Dagstuhl, Germany February 2-6, 2015
2
Focus of the talk: EMF/Ecore Aspects of Defining DSMLs
3
Specification of DSMLs Graphical syntax Code generation View Well-formedness constraints Behavioral semantics, simulation, refactoring Abstract syntax Textual syntax Mapping Code (documentation, configuration)
4
Role of EMF/Ecore technology in DSL Goal: Provide common base for advanced DSL tools Consistent model manipulation Persist models Tree based editor Goal: Provide common base for advanced DSL tools Consistent model manipulation Persist models Tree based editor GMF, Graphiti, EuGENia, Sirius, Spray, Xtext, … GMF, Graphiti, EuGENia, Sirius, Spray, Xtext, … Acceleo, ATL, Epsilon, IncQuery, QVT, Xtend, … EMF Compare EMF Store, CDO, … EMF Compare EMF Store, CDO, …
5
The Classical EMF/Ecore Waterfall
6
Example Ecore (Meta)model of Questionnaire
7
Core metamodel constructs (Ecore) Typing: EClass deep_instantiates(2) EObject = every EClass instance implicitly subtypes EObject = every instance of every instance of EClass implicitly instantiates EObject
8
Core metamodel constructs (Ecore) Class with arbitrary num. of superclasses associations attributes Class with arbitrary num. of superclasses associations attributes Typed Attribute Unidirectional (binary) relation (Association) typed optional inverse end multiplicities Unidirectional (binary) relation (Association) typed optional inverse end multiplicities
9
Example Constraint Definition // Object Constraint Language context Question inv: self.name = self.variable.name // Epsilon Validation Langauge (EVL) context Question { constraint IdentifiersWithoutMatchingVariableName { check : self.name = self.variable.name message : ‘Identifier of question ' + self.name + ' does not match its variable name ‘ + self.variable.name } } // EMF-IncQuery @Constraint(location = Q, message = "Identifier of question $Q.name$ does not match its variable name $V.name$ ", severity = "error",targetEditorId = "*") pattern identifiersWithoutMatchingVariableName (Q: Question, V: Variable) { Question.name(Q, Nm1); Question.variable.name(V,Nm2); Variable.name(V,Nm2); check (Nm1 != Nm2); } Constraint Languages for EMF: Declarative Object/Graph based Scalable evaluation Constraint Languages for EMF: Declarative Object/Graph based Scalable evaluation
10
Example Derived Features in Ecore @QueryBasedFeature(feature = "isComputed") pattern isComputed (Q: Question, BoolValue) { find questionWithExpression(Q, _Exp); BoolValue == true; } or { neg find questionWithExpression(Q, _Exp); BoolValue == false; } pattern questionWithExpression(Q: Question, E: Expression){ Question.expression(Q, E); } Derived Features: Values calculated from other model elements Not persisted Common best practice Declared in metamodel, defined by queries Recalculation upon change? Derived Features: Values calculated from other model elements Not persisted Common best practice Declared in metamodel, defined by queries Recalculation upon change? Definition by Queries
11
Example Generate Tooling Autogenerated Tooling: Model access & manipulation interfaces + implementations Model persistency (XMI) Notifications, commands, Undo, redo Tree-based editor Client test code Autogenerated Tooling: Model access & manipulation interfaces + implementations Model persistency (XMI) Notifications, commands, Undo, redo Tree-based editor Client test code
12
Example Sample Questionnaire Model Model editing: Models serialized in XMI Manipulated in tree editors Properties view Model editing: Models serialized in XMI Manipulated in tree editors Properties view
13
ResourceSet Resource EMF Instance Models in the Large Strict containment hierarchy EObject Resource Containment reference Cross-reference EObject Resource (typically file) Root object (typically single) Objects with attributes
14
Example Constraint Validation Constraint Validation for EMF: Scalable evaluation for models with 1M+ elements Largest models: 30M+ Error reporting with markers Constraint Validation for EMF: Scalable evaluation for models with 1M+ elements Largest models: 30M+ Error reporting with markers
15
Validation of Well-formedness Constraints Meta- model Model pattern switchWOSignal(sw) { Switch(sw); neg find switchHasSignal(sw); } pattern switchHasSignal(sw) { Switch(sw); Signal(sig); Signal.mountedTo(sig, sw); } Query Modify User Result
16
The Dynamic / Reflective EMF Workflow Goal: Immediate feedback during DSL development Code generation only for production ready editor Goal: Immediate feedback during DSL development Code generation only for production ready editor
17
Limitations of EMF/Ecore Technology
18
Summary of EMF/Ecore technology Goal: Provide common base for advanced DSL tools Consistent model manipulation Persist models Tree based editor Goal: Provide common base for advanced DSL tools Consistent model manipulation Persist models Tree based editor EuGENia, GMF, Graphiti, Sirius, Spray, Xtext, … EuGENia, GMF, Graphiti, Sirius, Spray, Xtext, … Acceleo, ATL, Epsilon, IncQuery, QVT, Xtend, … EMF Compare EMF Store, CDO, … EMF Compare EMF Store, CDO, …
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.