SlideShare a Scribd company logo
1 of 42
Download to read offline
FLEXIBLE MODELLING
BASED ON FACETS
Juan de Lara1
Joint work with
E. Guerra1, J. Kienzle2, Y. Hattab2
1Universidad Autónoma de Madrid (Spain)
2McGill University (Canada)
AGENDA
Context: Model-driven Engineering
Motivation
Facets
Interfaces and laws
Tool support
Case studies
Conclusions and future work
2
CONTEXT: MODEL-
DRIVEN ENGINEERING
3
For specific domains
• Avoid coding the same
solutions over and over
• Families of applications
Domain-Specific Modelling
Languages (DSLs)
• Syntax defined by a meta-
model
• Code generators, simulators,
model transformations
Code
Generator
Modelling, validation and automatic
generation of telephony services
MDE:
DOMAIN-SPECIFIC LANGUAGES
4
Abstract syntax
• Meta-model
• Integrity constraints (OCL)
Concrete syntax
• Graphical
• Textual
• Tabular, etc
Semantics
• Operational, denotational, etc
Services
• Refactorings, code generators, simulators, etc
MetaEdit+
DOMAIN SPECIFIC
MODELLING LANGUAGES
Describe the structure of the domain
• Relevant primitives and abstractions
• Relations, features
• Explicit expert knowledge
5
DOMAIN SPECIFIC
MODELLING LANGUAGES
DSMLs need not be graphical…
xText
6
MODELS AND
META-MODELS
The abstract syntax of DSMLs is
defined through a meta-model
• Classes
• Attributes
• Relations
7
Factory meta-model
Machine
Part
Conveyor
Generator Assembler
inps
outs
*
*
* parts
Terminator
1..*
1..*
MODELS AND
META-MODELS
The abstract syntax of DSMLs is
defined through a meta-model
• Classes
• Attributes
• Relations
8
«conforms to»
c1:Conveyor
g:Generator
a:Assembler
c2:Conveyor
c3:Conveyor t:Terminator
p2: Partp2: Partouts
outs
inps
inps
outs inps
Factory meta-model
Machine
Part
Conveyor
Generator Assembler
inps
outs
*
*
* parts
Terminator
1..*
1..*
OCL CONSTRAINTS
9
Object Constraint Language
Well-formedness rules, which
every model should satisfy
Based on First-Order Logic
g:Generator
«conforms to»
c:Conveyor
Factory meta-model
Machine
Part
Conveyor
Generator Assembler
inps
outs
*
*
* parts
Terminator
1..*
1..*
Factory meta-model
Machine
Part
Conveyor
Generator Assembler
inps
outs
*
*
* parts
Terminator
1..*
1..*
context Generator inv:
self.inps->isEmpty() and self.outs->size()>0
context Generator inv:
self.inps->isEmpty() and self.outs->size()>0
context Terminator inv:
self.outs->isEmpty() and self.inps->size()>0
context Assembler inv:
self.inps->size()>0 and self.outs.size()>0
…
inps
MODELS AND
META-MODELS
Models are represented using
concrete syntax
• Visual
• Textual
No need for a 1-1 correspondence
between abstract and concrete
syntax elements
10
asse
MODEL
TRANSFORMATIONS
Models need to be manipulated for
• Simulation
• Optimization/refactoring
• Generating another model
• Generating code
in-place
transformations
11
…
MODEL
TRANSFORMATIONS
Models need to be manipulated for
• Simulation
• Optimization/refactoring
• Generating another model
• Generating code
Source
Target
12
model-to-model
transformations
MODEL
TRANSFORMATIONS
Models need to be manipulated for
• Simulation
• Optimization/refactoring
• Generating another model
• Generating code
13
MMsrc MMtar
Msrc Mtar
Transformation
definition
from to
«conforms to» «conforms to»
Transformation
execution
Transformation
developer
Final user
model-to-model
transformations
MODEL
TRANSFORMATIONS
Models need to be manipulated for
• Simulation
• Optimization/refactoring
• Generating another model
• Generating code
14
Template languages
query and
model navigation
15
Very nice…
Where’s the ugly?
SOME LIMITATIONS…
Model-driven Engineering
• Models are the principal artifacts
• Models conform to a meta-model
Objects are closed
• Created using classes as templates
• Slots, types, and constraints cannot be changed
This rigidity makes some MDE scenarios difficult
• Reuse of model transformations
• Model extension
• Multi-view modelling
• …
16
Person
fullName: String
age: int
female: boolean
:Person
fullName=“Homer ”
age=36
female=false
Meta-model
Model «conforms»
MOTIVATION:
REUSE
17
Person
fullName: String
age: int
female: boolean
Address
street: String
city: String
address
spouse
0..1
Census
:Person
fullName=“Homer ”
age=36
female=false
Group
Element
quantity: int
elems
Metrics
*
operation Group avg(): Real {
if (elems.isEmpty()) return 0;
return elems.quantity.sum()/
elems.size();
}
:Person
fullName=“Todd”
age=8
female=false
…
Springfield: Census
«conforms»
Calculate average age of all male
adults in Springfield
Can we reuse operation avg on
Census models?
• Retype some Persons as Elements
• Create a Group containing all male
adults
MOTIVATION:
MODEL EXTENSION
18
Person
fullName: String
age: int
female: boolean
Address
street: String
city: String
address
spouse
0..1
Census
:Person
fullName=“Homer ”
age=36
female=false
:Person
fullName=“Todd”
age=8
female=false
…
Springfield: Census
«conforms»
Employment
Company
name: String
vatId: String
employees *
Owner
name: String
Employee
name: String
salary: double
ssNumber: int
active: boolean
belongsTo
minSalary inv:
self.salary > 15000
reportsTo
Can we extend existing Person
objects with Employment info?
• Retype some Persons as
Employees or Owners
• Add corresponding slots and
constraints
IN THIS TALK…
New modelling mechanism: the facet
• brings flexibility and dynamism to modelling
• lightweight: facets are just objects
Objects become open
• can acquire and drop slots, types and constraints
Facet laws
• specify when objects acquire/drop facets
Practical implementation
• on top of metaDepth, a textual meta-modelling tool
19
WHAT’S A FACET?
A facet is an object
• becomes part of another one(s), called the host object(s),
• the slots of the facet become transparently accessible from the
host, which also acquires the type and constraints of the facet.
A host object can acquire and drop facets dynamically
20
homer :Person
fullName= “Homer”
age= 57
female= false emp: Employee
name= “Homer”
salary=47500
ssNumber=12345
active=true
Springfield :Census
emp: Employee[1]
: Employment
homer :Person :Employee
age= 57
female= false
fullName= name= “Homer”
salary=47500
ssNumber=12345
active=true
Springfield
:Census :Employment
emp: Employee
host
object facet
WHAT’S A FACET?
Object homer receives:
• Slots (name, salary, ssNumber, active)
• Type (Employee)
• Constraints (minSalary)
From its emp facet
Host and facet slots may be synchronized
• fullName and name
• Changing either one modifies the other
Slot name ambiguity
• Resolved by facet name (homer.emp)
Shared facets and several facets in hosts
21
homer :Person :Employee
age= 57
female= false
fullName= name= “Homer”
salary=47500
ssNumber=12345
active=true
Springfield
:Census :Employment
emp: Employee
Employment
Employee
name: String
salary: double
ssNumber: int
active: boolean
minSalary inv:
salary > 15000
…
«conforms»
Census
…
«conforms»
FACET MANAGEMENT
A DSL for adding/removing facets to objects
22
addFacet homer
emp: Employment.Employee
with {
name = fullName [equality]
salary = 22345
ssNumber = 12345
active = true
}
addFacet
$Person.allInstances()→select(age>17)$
emp: Employment.Employee with {…}
Explicit host selection
Query-based host selection
addFacet h:Person, w:Person where
$h.spouse=w$
emp: Employment.Employee with {…}
Pattern-based host selection
Selection of host objects by id Selection of host objects by properties
(similar commands for removing a facet)
FACET MANAGEMENT
23
addFacet
$Person.all()→select(age>17)$
emp: Employment.Employee
with {…} reuse
Facet shared among all
selected host objects
addFacet homer
dayJob: Employment.Employee with {
name = fullName [equality]
salary = 15000
ssNumber = 12345
active = true
}
nightJob: Employment.Employee with {
name = fullName [equality]
salary = 16400
ssNumber = dayJob.ssNumber [equality]
active = dayJob.active [equality]
}
Several facets in same host object
One-to-many and many-to-one host/facet relations are supported
REACTIVE FIELD
ADAPTERS
24
addFacet homer
emp: Employment.Employee
with {
ssNumber = 12345 // value semantics: literals
salary = $100*self.age$ // value semantics: expressions
name = fullName [equality] // reference semantics: bx synchronization
active = [self.age < 65] // reference semantics: reactive field adapter
}
Coupled change dependencies
• active = [self.age < 65]  When age changes, active is updated
• name = fullName [equality]  Eq. to name = [fullName] [fullName=name]
N-ary depedencies
• salary = [100*self.age] [rich = self.salary > 10000]
• ill-behaved: name = [fullName] [fullName = ’Mr. ’.concat(name)]
• Safety policy: each field is evaluated once within a cycle
MODEL SCENES
25
Springfield :Census :Employment
homer :Person :Employee
age=57
female=false
fullName=“Homer”
name=“Homer” dayJob, nightJob
ssNumber=12345 dayJob, nightJob
active=true dayJob, nightJob
salary=15000 dayJob
salary=16400 nightJob
simsHome :Address
street=“Evergreen Terrace”
city=“Springfield”
:address
Different visualizations for a model
• “Scenes”
Total scene
• Default visualization
Total scene
MODEL SCENES
26
Different visualizations for a model
• “Scenes”
Total scene
• Default visualization
Sliced scene
• W.r.t. a given facet meta-model
Springfield :Employment
homer :Employee
name=“Homer” dayJob, nightJob
ssNumber=12345 dayJob, nightJob
active=true dayJob, nightJob
salary=15000 dayJob
salary=16400 nightJob
Scene sliced by Employment
MODEL SCENES
27
Different visualizations for a model
• “Scenes”
Total scene
• Default visualization
Sliced scene
• W.r.t. a given facet meta-model
Granulated
• Shows facets typed w.r.t. a certain meta-
model
Springfield
:Employment
nightJob :Employee
name=“Homer”
salary=16400
ssNumber=12345
active=true
name=“Homer”
salary=15000
ssNumber=12345
active=true
dayJob :Employee
Scene granulated by
Employment
FACET LAWS
AND INTERFACES
Opportunistic vs planned handling of facets
Control which elements can be used as facets
Declarative specification of conditions for acquiring/droping facets
28
:CMM :FMM
FMMCMM
Facet Interface
«conformsto»
«conformsto»
Creation MM Facet MM
model with facets
Facet Law
FACET INTERFACES
Restricts how a meta-model can be used for facet-based modelling
Declares
• classes that can be used to create facets
• allowed combinations
• extra well-formedness constraints (eg., due to facet combination)
29
FacetInterface for Employment {
public: all
compatible: [Employee, Owner]
constraints: Employee.repToIrreflexive= $self.reportsTo.excludes(self)$
}
FACET LAWS
Specs stating when host objects should acquire/drop a facet
• must/may
Can add additional constraints and set default values
Setting homer.age:=16 makes homer drop the work facet
30
FacetLaws for Census with Employment {
must extend <p:Person> where $p.age>17$
with work:Employee with {
name = fullName [equality]
salary = 24000
minLocalSalary: $ self.salary>16000 $
retirement: $ self.age>65 implies not self.active $
}
}
FACET LAWS
Check manually issued addFacet/removeFacet commands
• Should conform to the facet laws, if defined
Check faceted models for consistency
• Models should satisfy the laws
To complete addFacet commands
• Take default values and slot relations from the laws
To constraint facets
• By adding extra constraints
To automate facet acquisition/loss
• Via the “must” extension laws
• addFacet/removeFacet automatically issued
31
TOOL SUPPORT
MetaDepth (http://metaDepth.org)
• Textual multi-level modelling tool
• Epsilon languages for model
management (EOL, ETL, EGL)
Facets, facet handling, interfaces, laws
Mirror fields
Triggered constraints (add/drop facets)
32
Model Census {
Node Person{
name: String;
age: int;
female: boolean = true;
spouse: Person[0..1];
address: Address[1];
}
Node Address {
street: String;
city: String;
}
}
var p : Person := new Person;
p.age := 23; // implicitly creates an Employee facet (as p.age > 17)
p.salary := 15100; // OK, as p has now an Employee facet
p.age := 16; // p loses its Employee facet (as p.age <= 17)
p.salary := 21000; // Error! p has no Employee facet
EOL program
Census meta-model
EVALUATION
Based on five scenarios
• Integration of annotation models
• Reuse of model management operations
• Multi-view modelling
• Multi-level modelling
• Language product lines
Comparison with solutions using alternative techniques
• Cross-referencing, EMF profiles, a-posterioti typing
• Model adaptation, a-posteriori typing, concepts, model typing
• Central repository, OpenFlexo, OSM, Vitruvius
• MetaDepth, Melanee, MultEcore, ML2
• Model templates, DeltaEcore, VML*, SmartAdapters, etc
33
INTEGRATING
ANNOTATION MODELS
Annotation models widely used in MDE:
• Concrete syntax (CS) representation, uncertainty, variability, access
control, etc.
34
Model ConcreteSyntax {
abstract Node GraphicalElem {
x, y : int;
label : String;
linkedTo : GraphicalElem[∗];
}
Node Rectangle : GraphicalElem {
width, height : int;
}
Node Circle : GraphicalElem {
radius : int;
}
}
Graphical CS support
• Meta-model
• Simple visualizer
• Facet laws to assign CS to
domain meta-models
We obtain for free:
• Bidirectional synchronization
textual/graphical CS.
CS meta-model
35
FacetLaws for Census with ConcreteSyntax {
must extend <p:Person> where $p.female$ with c:Circle with {
label = name [equality]
linkedTo = spouse [equality]
radius = [2*age] [age = radius/2]
}
must extend <p:Person> where $not p.female$ with r:Rectangle with {
label = name [equality]
linkedTo = spouse [equality]
height = age [equality]
width = age [equality]
}
}
CS FOR CENSUS
Census Springfield {
Person marge {
fullName = "Marge";
age = 47;
spouse = homer;
address = simsHouse;
}
…
} (scene sliced by Census)
Synch.
CAN WE DO THIS
DIFFERENTY?
36
Cannot be used to fully solve this case study:
Cross-referencing, EMF profiles
• No direct support for conditional styles (different CS based on female)
• No direct support for bidirectional changes
A-posteriori typing
• Cannot map slots like x and y
[1] Langer, Wieland, Wimmer,Cabot. EMF profiles: a lightweight extension approach for EMF
models. JOT 11,1(2012),1–29.
[2] de Lara, Guerra. A posteriori typing for model-driven engineering: Concepts, analysis, and
applications. ACM TOSEM 25, 4(2017),31:1–31:60.
[1]
[2]
(DYNAMIC) PRODUCT LINES
“SE methods for creating a collection of similar software systems from a
shared set of software assets using a common means of production”
(Dynamic) Language product lines
37
Model Components {
abstract Node NamedElement {
name : String;
}
Node Component : NamedElement {
ports : Port[1..*];
}
abstract Node Port : NamedElement ;
Node InputPort : Port;
Node OutputPort : Port {
target : InputPort[1..*];
}
}
Base language definition
// variability model
Model ComponentFeatures {
Node FeaturedElement {
security : boolean = false;
monitoring : boolean = true;
}
}
Feature model
Component
Features
security monitoring
(DYNAMIC) PRODUCT LINES
38
Model ComponentFacets { // facet metamodel
Node Cipher { // to be added to ports when security is selected
blockSize : int;
key : String;
nRounds : int;
}
Node Monitor { // to be added to components when monitoring is selected
activeRate : double = 0.0;
powerConsumption : double = 0.0;
}
}
Meta-model fragments to be added when the configuration changes
(DYNAMIC) PRODUCT LINES
39
FacetLaws for Components with ComponentFeatures {
must extend <n:NamedElement> with cfg: FeaturedElement with {
security = false
monitoring = true
} reuse
}
All elements share a configuration
FacetLaws for Components, ComponentFeatures with ComponentFacets {
must extend <p:Port & FeaturedElement> where $p.security$
with c : Cipher with {
blockSize = 32
key = "915F4619BE41B2516355A50110A9CE91"
nRounds = 12
}
must extend <c:Component & FeaturedElement> where $c.monitoring$
with m: Monitor with {
…
} reuse
}
Facets are added depending on the chosen configuration
RELATED WORKS
Role-based modelling (eg., Lodwick [1], CROM [2])
• Facets fulfill most typical features of role-based languages
• Heavyweight (role, natural, compartment types)
• Practical integration with MDE: inheritance, attribute/slot handling,
OCL constraints, integration with model management languages
A-posteriori typing
• Can dynamically add/remove types
• Cannot add slots or constraints
40
[1] Steimann. On the representation of roles in object-oriented and conceptual modelling.
Data Knowl. Eng. 35,1(2000),83–106.
[2] Kühn, Böhme, Götz,Aßmann. A combined formal model for relational context-dependent
roles. In SLE’15. pp.:113–124.
de Lara, Guerra. A posteriori typing for model-driven engineering: Concepts, analysis, and
applications. ACM TOSEM 25, 4(2017),31:1–31:60.
CONCLUSIONS AND
FUTURE WORK
Facets add flexibility and dynamicity to modelling
• make objects open
• acquire/drop slots, types and constraints dynamically
• reactive synchronization of fields
Facet interfaces and laws
• property-based facet acquisition and drop
Some scenarios where facets present advantages
Implementation on top of metaDepth
41
Future work
• Improve tooling
• Interaction with behaviour specifications
• Combine operations defined in host objects and facet
• Static analysis
Juan.deLara@uam.es
@miso_uam http://metadepth.org
THANKS!
http://miso.es

More Related Content

Similar to Modelado flexible basado en facetas

Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsSimobo
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBMongoDB
 
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...WithTheBest
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathBlue Elephant Consulting
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph DatabaseTobias Lindaaker
 
implementing oop_concept
 implementing oop_concept implementing oop_concept
implementing oop_conceptAmit Gupta
 
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al MesAyudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al MesBig Data Colombia
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#ANURAG SINGH
 
Introduction to Domain-Driven Design in Ruby on Rails
Introduction to Domain-Driven Design in Ruby on RailsIntroduction to Domain-Driven Design in Ruby on Rails
Introduction to Domain-Driven Design in Ruby on RailsVisuality
 
Lecture_four-_Requirements_Modeling (1).pptx
Lecture_four-_Requirements_Modeling (1).pptxLecture_four-_Requirements_Modeling (1).pptx
Lecture_four-_Requirements_Modeling (1).pptxGracePeter10
 
Add Some DDD to Your ASP.NET MVC, OK?
Add Some DDD to Your ASP.NET MVC, OK?Add Some DDD to Your ASP.NET MVC, OK?
Add Some DDD to Your ASP.NET MVC, OK?Steven Smith
 
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...Daniel Varro
 
Episode 1 - PathToCode.com
Episode 1 - PathToCode.comEpisode 1 - PathToCode.com
Episode 1 - PathToCode.comJitendra Zaa
 
SERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolSERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolHenry Muccini
 
SERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENEWorkshop
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DBGreg McMurray
 

Similar to Modelado flexible basado en facetas (20)

Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDB
 
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
Like-for-Like Comparisons of Machine Learning Algorithms - Dominik Dahlem, Bo...
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph Database
 
Sql server select queries ppt 18
Sql server select queries ppt 18Sql server select queries ppt 18
Sql server select queries ppt 18
 
implementing oop_concept
 implementing oop_concept implementing oop_concept
implementing oop_concept
 
Angular
AngularAngular
Angular
 
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al MesAyudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
Introduction to Domain-Driven Design in Ruby on Rails
Introduction to Domain-Driven Design in Ruby on RailsIntroduction to Domain-Driven Design in Ruby on Rails
Introduction to Domain-Driven Design in Ruby on Rails
 
MDE in Practice
MDE in PracticeMDE in Practice
MDE in Practice
 
ReusingMT
ReusingMTReusingMT
ReusingMT
 
Lecture_four-_Requirements_Modeling (1).pptx
Lecture_four-_Requirements_Modeling (1).pptxLecture_four-_Requirements_Modeling (1).pptx
Lecture_four-_Requirements_Modeling (1).pptx
 
Add Some DDD to Your ASP.NET MVC, OK?
Add Some DDD to Your ASP.NET MVC, OK?Add Some DDD to Your ASP.NET MVC, OK?
Add Some DDD to Your ASP.NET MVC, OK?
 
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...
IncQuery-D: Distributed Incremental Model Queries over the Cloud: Engineerin...
 
Episode 1 - PathToCode.com
Episode 1 - PathToCode.comEpisode 1 - PathToCode.com
Episode 1 - PathToCode.com
 
SERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_schoolSERENE 2014 School: Daniel varro serene2014_school
SERENE 2014 School: Daniel varro serene2014_school
 
SERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the CloudSERENE 2014 School: Incremental Model Queries over the Cloud
SERENE 2014 School: Incremental Model Queries over the Cloud
 
Introduction to SQL Server Graph DB
Introduction to SQL Server Graph DBIntroduction to SQL Server Graph DB
Introduction to SQL Server Graph DB
 

More from Facultad de Informática UCM

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?Facultad de Informática UCM
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...Facultad de Informática UCM
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersFacultad de Informática UCM
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmFacultad de Informática UCM
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingFacultad de Informática UCM
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroFacultad de Informática UCM
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...Facultad de Informática UCM
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Facultad de Informática UCM
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFacultad de Informática UCM
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoFacultad de Informática UCM
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCFacultad de Informática UCM
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Facultad de Informática UCM
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Facultad de Informática UCM
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Facultad de Informática UCM
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windFacultad de Informática UCM
 

More from Facultad de Informática UCM (20)

¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?¿Por qué debemos seguir trabajando en álgebra lineal?
¿Por qué debemos seguir trabajando en álgebra lineal?
 
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
TECNOPOLÍTICA Y ACTIVISMO DE DATOS: EL MAPEO COMO FORMA DE RESILIENCIA ANTE L...
 
DRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation ComputersDRAC: Designing RISC-V-based Accelerators for next generation Computers
DRAC: Designing RISC-V-based Accelerators for next generation Computers
 
uElectronics ongoing activities at ESA
uElectronics ongoing activities at ESAuElectronics ongoing activities at ESA
uElectronics ongoing activities at ESA
 
Tendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura ArmTendencias en el diseño de procesadores con arquitectura Arm
Tendencias en el diseño de procesadores con arquitectura Arm
 
Formalizing Mathematics in Lean
Formalizing Mathematics in LeanFormalizing Mathematics in Lean
Formalizing Mathematics in Lean
 
Introduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented ComputingIntroduction to Quantum Computing and Quantum Service Oriented Computing
Introduction to Quantum Computing and Quantum Service Oriented Computing
 
Computer Design Concepts for Machine Learning
Computer Design Concepts for Machine LearningComputer Design Concepts for Machine Learning
Computer Design Concepts for Machine Learning
 
Inteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuroInteligencia Artificial en la atención sanitaria del futuro
Inteligencia Artificial en la atención sanitaria del futuro
 
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 Design Automation Approaches for Real-Time Edge Computing for Science Applic... Design Automation Approaches for Real-Time Edge Computing for Science Applic...
Design Automation Approaches for Real-Time Edge Computing for Science Applic...
 
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
Estrategias de navegación para robótica móvil de campo: caso de estudio proye...
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error Correction
 
Cómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intentoCómo construir un chatbot inteligente sin morir en el intento
Cómo construir un chatbot inteligente sin morir en el intento
 
Automatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPCAutomatic generation of hardware memory architectures for HPC
Automatic generation of hardware memory architectures for HPC
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
 
Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...Hardware/software security contracts: Principled foundations for building sec...
Hardware/software security contracts: Principled foundations for building sec...
 
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
Jose carlossancho slidesLa seguridad en el desarrollo de software implementad...
 
Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?Do you trust your artificial intelligence system?
Do you trust your artificial intelligence system?
 
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.Redes neuronales y reinforcement learning. Aplicación en energía eólica.
Redes neuronales y reinforcement learning. Aplicación en energía eólica.
 
Challenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore windChallenges and Opportunities for AI and Data analytics in Offshore wind
Challenges and Opportunities for AI and Data analytics in Offshore wind
 

Recently uploaded

TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 

Recently uploaded (20)

TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 

Modelado flexible basado en facetas

  • 1. FLEXIBLE MODELLING BASED ON FACETS Juan de Lara1 Joint work with E. Guerra1, J. Kienzle2, Y. Hattab2 1Universidad Autónoma de Madrid (Spain) 2McGill University (Canada)
  • 2. AGENDA Context: Model-driven Engineering Motivation Facets Interfaces and laws Tool support Case studies Conclusions and future work 2
  • 3. CONTEXT: MODEL- DRIVEN ENGINEERING 3 For specific domains • Avoid coding the same solutions over and over • Families of applications Domain-Specific Modelling Languages (DSLs) • Syntax defined by a meta- model • Code generators, simulators, model transformations Code Generator Modelling, validation and automatic generation of telephony services
  • 4. MDE: DOMAIN-SPECIFIC LANGUAGES 4 Abstract syntax • Meta-model • Integrity constraints (OCL) Concrete syntax • Graphical • Textual • Tabular, etc Semantics • Operational, denotational, etc Services • Refactorings, code generators, simulators, etc
  • 5. MetaEdit+ DOMAIN SPECIFIC MODELLING LANGUAGES Describe the structure of the domain • Relevant primitives and abstractions • Relations, features • Explicit expert knowledge 5
  • 6. DOMAIN SPECIFIC MODELLING LANGUAGES DSMLs need not be graphical… xText 6
  • 7. MODELS AND META-MODELS The abstract syntax of DSMLs is defined through a meta-model • Classes • Attributes • Relations 7 Factory meta-model Machine Part Conveyor Generator Assembler inps outs * * * parts Terminator 1..* 1..*
  • 8. MODELS AND META-MODELS The abstract syntax of DSMLs is defined through a meta-model • Classes • Attributes • Relations 8 «conforms to» c1:Conveyor g:Generator a:Assembler c2:Conveyor c3:Conveyor t:Terminator p2: Partp2: Partouts outs inps inps outs inps Factory meta-model Machine Part Conveyor Generator Assembler inps outs * * * parts Terminator 1..* 1..*
  • 9. OCL CONSTRAINTS 9 Object Constraint Language Well-formedness rules, which every model should satisfy Based on First-Order Logic g:Generator «conforms to» c:Conveyor Factory meta-model Machine Part Conveyor Generator Assembler inps outs * * * parts Terminator 1..* 1..* Factory meta-model Machine Part Conveyor Generator Assembler inps outs * * * parts Terminator 1..* 1..* context Generator inv: self.inps->isEmpty() and self.outs->size()>0 context Generator inv: self.inps->isEmpty() and self.outs->size()>0 context Terminator inv: self.outs->isEmpty() and self.inps->size()>0 context Assembler inv: self.inps->size()>0 and self.outs.size()>0 … inps
  • 10. MODELS AND META-MODELS Models are represented using concrete syntax • Visual • Textual No need for a 1-1 correspondence between abstract and concrete syntax elements 10 asse
  • 11. MODEL TRANSFORMATIONS Models need to be manipulated for • Simulation • Optimization/refactoring • Generating another model • Generating code in-place transformations 11 …
  • 12. MODEL TRANSFORMATIONS Models need to be manipulated for • Simulation • Optimization/refactoring • Generating another model • Generating code Source Target 12 model-to-model transformations
  • 13. MODEL TRANSFORMATIONS Models need to be manipulated for • Simulation • Optimization/refactoring • Generating another model • Generating code 13 MMsrc MMtar Msrc Mtar Transformation definition from to «conforms to» «conforms to» Transformation execution Transformation developer Final user model-to-model transformations
  • 14. MODEL TRANSFORMATIONS Models need to be manipulated for • Simulation • Optimization/refactoring • Generating another model • Generating code 14 Template languages query and model navigation
  • 16. SOME LIMITATIONS… Model-driven Engineering • Models are the principal artifacts • Models conform to a meta-model Objects are closed • Created using classes as templates • Slots, types, and constraints cannot be changed This rigidity makes some MDE scenarios difficult • Reuse of model transformations • Model extension • Multi-view modelling • … 16 Person fullName: String age: int female: boolean :Person fullName=“Homer ” age=36 female=false Meta-model Model «conforms»
  • 17. MOTIVATION: REUSE 17 Person fullName: String age: int female: boolean Address street: String city: String address spouse 0..1 Census :Person fullName=“Homer ” age=36 female=false Group Element quantity: int elems Metrics * operation Group avg(): Real { if (elems.isEmpty()) return 0; return elems.quantity.sum()/ elems.size(); } :Person fullName=“Todd” age=8 female=false … Springfield: Census «conforms» Calculate average age of all male adults in Springfield Can we reuse operation avg on Census models? • Retype some Persons as Elements • Create a Group containing all male adults
  • 18. MOTIVATION: MODEL EXTENSION 18 Person fullName: String age: int female: boolean Address street: String city: String address spouse 0..1 Census :Person fullName=“Homer ” age=36 female=false :Person fullName=“Todd” age=8 female=false … Springfield: Census «conforms» Employment Company name: String vatId: String employees * Owner name: String Employee name: String salary: double ssNumber: int active: boolean belongsTo minSalary inv: self.salary > 15000 reportsTo Can we extend existing Person objects with Employment info? • Retype some Persons as Employees or Owners • Add corresponding slots and constraints
  • 19. IN THIS TALK… New modelling mechanism: the facet • brings flexibility and dynamism to modelling • lightweight: facets are just objects Objects become open • can acquire and drop slots, types and constraints Facet laws • specify when objects acquire/drop facets Practical implementation • on top of metaDepth, a textual meta-modelling tool 19
  • 20. WHAT’S A FACET? A facet is an object • becomes part of another one(s), called the host object(s), • the slots of the facet become transparently accessible from the host, which also acquires the type and constraints of the facet. A host object can acquire and drop facets dynamically 20 homer :Person fullName= “Homer” age= 57 female= false emp: Employee name= “Homer” salary=47500 ssNumber=12345 active=true Springfield :Census emp: Employee[1] : Employment homer :Person :Employee age= 57 female= false fullName= name= “Homer” salary=47500 ssNumber=12345 active=true Springfield :Census :Employment emp: Employee host object facet
  • 21. WHAT’S A FACET? Object homer receives: • Slots (name, salary, ssNumber, active) • Type (Employee) • Constraints (minSalary) From its emp facet Host and facet slots may be synchronized • fullName and name • Changing either one modifies the other Slot name ambiguity • Resolved by facet name (homer.emp) Shared facets and several facets in hosts 21 homer :Person :Employee age= 57 female= false fullName= name= “Homer” salary=47500 ssNumber=12345 active=true Springfield :Census :Employment emp: Employee Employment Employee name: String salary: double ssNumber: int active: boolean minSalary inv: salary > 15000 … «conforms» Census … «conforms»
  • 22. FACET MANAGEMENT A DSL for adding/removing facets to objects 22 addFacet homer emp: Employment.Employee with { name = fullName [equality] salary = 22345 ssNumber = 12345 active = true } addFacet $Person.allInstances()→select(age>17)$ emp: Employment.Employee with {…} Explicit host selection Query-based host selection addFacet h:Person, w:Person where $h.spouse=w$ emp: Employment.Employee with {…} Pattern-based host selection Selection of host objects by id Selection of host objects by properties (similar commands for removing a facet)
  • 23. FACET MANAGEMENT 23 addFacet $Person.all()→select(age>17)$ emp: Employment.Employee with {…} reuse Facet shared among all selected host objects addFacet homer dayJob: Employment.Employee with { name = fullName [equality] salary = 15000 ssNumber = 12345 active = true } nightJob: Employment.Employee with { name = fullName [equality] salary = 16400 ssNumber = dayJob.ssNumber [equality] active = dayJob.active [equality] } Several facets in same host object One-to-many and many-to-one host/facet relations are supported
  • 24. REACTIVE FIELD ADAPTERS 24 addFacet homer emp: Employment.Employee with { ssNumber = 12345 // value semantics: literals salary = $100*self.age$ // value semantics: expressions name = fullName [equality] // reference semantics: bx synchronization active = [self.age < 65] // reference semantics: reactive field adapter } Coupled change dependencies • active = [self.age < 65]  When age changes, active is updated • name = fullName [equality]  Eq. to name = [fullName] [fullName=name] N-ary depedencies • salary = [100*self.age] [rich = self.salary > 10000] • ill-behaved: name = [fullName] [fullName = ’Mr. ’.concat(name)] • Safety policy: each field is evaluated once within a cycle
  • 25. MODEL SCENES 25 Springfield :Census :Employment homer :Person :Employee age=57 female=false fullName=“Homer” name=“Homer” dayJob, nightJob ssNumber=12345 dayJob, nightJob active=true dayJob, nightJob salary=15000 dayJob salary=16400 nightJob simsHome :Address street=“Evergreen Terrace” city=“Springfield” :address Different visualizations for a model • “Scenes” Total scene • Default visualization Total scene
  • 26. MODEL SCENES 26 Different visualizations for a model • “Scenes” Total scene • Default visualization Sliced scene • W.r.t. a given facet meta-model Springfield :Employment homer :Employee name=“Homer” dayJob, nightJob ssNumber=12345 dayJob, nightJob active=true dayJob, nightJob salary=15000 dayJob salary=16400 nightJob Scene sliced by Employment
  • 27. MODEL SCENES 27 Different visualizations for a model • “Scenes” Total scene • Default visualization Sliced scene • W.r.t. a given facet meta-model Granulated • Shows facets typed w.r.t. a certain meta- model Springfield :Employment nightJob :Employee name=“Homer” salary=16400 ssNumber=12345 active=true name=“Homer” salary=15000 ssNumber=12345 active=true dayJob :Employee Scene granulated by Employment
  • 28. FACET LAWS AND INTERFACES Opportunistic vs planned handling of facets Control which elements can be used as facets Declarative specification of conditions for acquiring/droping facets 28 :CMM :FMM FMMCMM Facet Interface «conformsto» «conformsto» Creation MM Facet MM model with facets Facet Law
  • 29. FACET INTERFACES Restricts how a meta-model can be used for facet-based modelling Declares • classes that can be used to create facets • allowed combinations • extra well-formedness constraints (eg., due to facet combination) 29 FacetInterface for Employment { public: all compatible: [Employee, Owner] constraints: Employee.repToIrreflexive= $self.reportsTo.excludes(self)$ }
  • 30. FACET LAWS Specs stating when host objects should acquire/drop a facet • must/may Can add additional constraints and set default values Setting homer.age:=16 makes homer drop the work facet 30 FacetLaws for Census with Employment { must extend <p:Person> where $p.age>17$ with work:Employee with { name = fullName [equality] salary = 24000 minLocalSalary: $ self.salary>16000 $ retirement: $ self.age>65 implies not self.active $ } }
  • 31. FACET LAWS Check manually issued addFacet/removeFacet commands • Should conform to the facet laws, if defined Check faceted models for consistency • Models should satisfy the laws To complete addFacet commands • Take default values and slot relations from the laws To constraint facets • By adding extra constraints To automate facet acquisition/loss • Via the “must” extension laws • addFacet/removeFacet automatically issued 31
  • 32. TOOL SUPPORT MetaDepth (http://metaDepth.org) • Textual multi-level modelling tool • Epsilon languages for model management (EOL, ETL, EGL) Facets, facet handling, interfaces, laws Mirror fields Triggered constraints (add/drop facets) 32 Model Census { Node Person{ name: String; age: int; female: boolean = true; spouse: Person[0..1]; address: Address[1]; } Node Address { street: String; city: String; } } var p : Person := new Person; p.age := 23; // implicitly creates an Employee facet (as p.age > 17) p.salary := 15100; // OK, as p has now an Employee facet p.age := 16; // p loses its Employee facet (as p.age <= 17) p.salary := 21000; // Error! p has no Employee facet EOL program Census meta-model
  • 33. EVALUATION Based on five scenarios • Integration of annotation models • Reuse of model management operations • Multi-view modelling • Multi-level modelling • Language product lines Comparison with solutions using alternative techniques • Cross-referencing, EMF profiles, a-posterioti typing • Model adaptation, a-posteriori typing, concepts, model typing • Central repository, OpenFlexo, OSM, Vitruvius • MetaDepth, Melanee, MultEcore, ML2 • Model templates, DeltaEcore, VML*, SmartAdapters, etc 33
  • 34. INTEGRATING ANNOTATION MODELS Annotation models widely used in MDE: • Concrete syntax (CS) representation, uncertainty, variability, access control, etc. 34 Model ConcreteSyntax { abstract Node GraphicalElem { x, y : int; label : String; linkedTo : GraphicalElem[∗]; } Node Rectangle : GraphicalElem { width, height : int; } Node Circle : GraphicalElem { radius : int; } } Graphical CS support • Meta-model • Simple visualizer • Facet laws to assign CS to domain meta-models We obtain for free: • Bidirectional synchronization textual/graphical CS. CS meta-model
  • 35. 35 FacetLaws for Census with ConcreteSyntax { must extend <p:Person> where $p.female$ with c:Circle with { label = name [equality] linkedTo = spouse [equality] radius = [2*age] [age = radius/2] } must extend <p:Person> where $not p.female$ with r:Rectangle with { label = name [equality] linkedTo = spouse [equality] height = age [equality] width = age [equality] } } CS FOR CENSUS Census Springfield { Person marge { fullName = "Marge"; age = 47; spouse = homer; address = simsHouse; } … } (scene sliced by Census) Synch.
  • 36. CAN WE DO THIS DIFFERENTY? 36 Cannot be used to fully solve this case study: Cross-referencing, EMF profiles • No direct support for conditional styles (different CS based on female) • No direct support for bidirectional changes A-posteriori typing • Cannot map slots like x and y [1] Langer, Wieland, Wimmer,Cabot. EMF profiles: a lightweight extension approach for EMF models. JOT 11,1(2012),1–29. [2] de Lara, Guerra. A posteriori typing for model-driven engineering: Concepts, analysis, and applications. ACM TOSEM 25, 4(2017),31:1–31:60. [1] [2]
  • 37. (DYNAMIC) PRODUCT LINES “SE methods for creating a collection of similar software systems from a shared set of software assets using a common means of production” (Dynamic) Language product lines 37 Model Components { abstract Node NamedElement { name : String; } Node Component : NamedElement { ports : Port[1..*]; } abstract Node Port : NamedElement ; Node InputPort : Port; Node OutputPort : Port { target : InputPort[1..*]; } } Base language definition // variability model Model ComponentFeatures { Node FeaturedElement { security : boolean = false; monitoring : boolean = true; } } Feature model Component Features security monitoring
  • 38. (DYNAMIC) PRODUCT LINES 38 Model ComponentFacets { // facet metamodel Node Cipher { // to be added to ports when security is selected blockSize : int; key : String; nRounds : int; } Node Monitor { // to be added to components when monitoring is selected activeRate : double = 0.0; powerConsumption : double = 0.0; } } Meta-model fragments to be added when the configuration changes
  • 39. (DYNAMIC) PRODUCT LINES 39 FacetLaws for Components with ComponentFeatures { must extend <n:NamedElement> with cfg: FeaturedElement with { security = false monitoring = true } reuse } All elements share a configuration FacetLaws for Components, ComponentFeatures with ComponentFacets { must extend <p:Port & FeaturedElement> where $p.security$ with c : Cipher with { blockSize = 32 key = "915F4619BE41B2516355A50110A9CE91" nRounds = 12 } must extend <c:Component & FeaturedElement> where $c.monitoring$ with m: Monitor with { … } reuse } Facets are added depending on the chosen configuration
  • 40. RELATED WORKS Role-based modelling (eg., Lodwick [1], CROM [2]) • Facets fulfill most typical features of role-based languages • Heavyweight (role, natural, compartment types) • Practical integration with MDE: inheritance, attribute/slot handling, OCL constraints, integration with model management languages A-posteriori typing • Can dynamically add/remove types • Cannot add slots or constraints 40 [1] Steimann. On the representation of roles in object-oriented and conceptual modelling. Data Knowl. Eng. 35,1(2000),83–106. [2] Kühn, Böhme, Götz,Aßmann. A combined formal model for relational context-dependent roles. In SLE’15. pp.:113–124. de Lara, Guerra. A posteriori typing for model-driven engineering: Concepts, analysis, and applications. ACM TOSEM 25, 4(2017),31:1–31:60.
  • 41. CONCLUSIONS AND FUTURE WORK Facets add flexibility and dynamicity to modelling • make objects open • acquire/drop slots, types and constraints dynamically • reactive synchronization of fields Facet interfaces and laws • property-based facet acquisition and drop Some scenarios where facets present advantages Implementation on top of metaDepth 41 Future work • Improve tooling • Interaction with behaviour specifications • Combine operations defined in host objects and facet • Static analysis