Mogwaï: A Framework to Handle Complex Queries on Large Models
-
Upload
gwendal-daniel -
Category
Presentations & Public Speaking
-
view
794 -
download
0
Transcript of Mogwaï: A Framework to Handle Complex Queries on Large Models
Mogwaï: a Framework to Handle Complex Queries on Large Models
Jordi CabotICREA-UOC
Gwendal DanielInria - Mines Nantes & Lina
Gerson SunyéInria - Mines Nantes & Lina
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 2
Introduction
● Complex and large models
– Civil Engineering
– Biology– Reverse Engineering
● Need to provide solutions to
– Store them
– Query them efficiently
– Transform them
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 3
Model Persistence
● Default serialization mechanism: XMI
– Verbose● Large monolithic files
– Files have to be entirely parsed● Increases memory consumption
– No advanced features
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 4
Model Persistence
● Several solutions to overcome model persistence limitations
– CDO, Morsa, EMF-Fragment, NeoEMF
● Problems
– Low-level model handling APIs
– Fragmented queries on the database
– Intermediate objects
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 5
Model Persistence
• Introduction• Model Persistence• Mogwaï• Conclusion
A.allInstances().name
get(a1)get(a1,name)...get(an)get(an,name)
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 6
Model Persistence
● Why don't we query directly the database?
– Manually writing database-level queries is hard● Need to learn a new query language● Database expertise vs. Modeling expertise● Unknown model representation
● Solution: generate them!
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 7
Mogwaï
● Generate graph database queries from OCL expressions
● Bypass modeling framework API
● Single execution of the query
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 8
Mogwaï
● The OCL to express model queries
• Introduction• Model Persistence• Mogwaï• Conclusion
Package.allInstances()
p1.contents
p1.contents→select(e | e.name = 'c1')
// p1
// [ c1,c2 ]
// c1
p1 : Package
name : 'p1'
c1 : Class
name : 'c1'
c2 : Class
name : 'c2'
contents contents
Package
+ name : String
Class
+ name : String
contents
*
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 9
Mogwaï
● The Gremlin Language to express database queries
• Introduction• Model Persistence• Mogwaï• Conclusion
1class="Package"
4name="c1"
5name="c2"
2class="Class"
3name="p1"
instanceof
instanceof
instanceof
contents
contents
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 10
Mogwaï
● The Gremlin Language to express database queries
– Graph traversal DSL
– Composed of processing steps
– Generic query language for graph databases
• Introduction• Model Persistence• Mogwaï• Conclusion
g.idx(''metaclasses'')[[name:''Package'']].inE(''instanceOf'').outV
g.v(3).outE(''contents'').inV
g.v(3).outE(''contents'').inV.filter{it.name = ''c1''}
// v(1)
// [v(4),v(5)]
// v(4)
1class="Package"
4name="c1"
5name="c2"
2class="Class"
3name="p1"
instanceof
instanceof
instanceof
contents
contents
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 11
Mogwaï
• Introduction• Model Persistence• Mogwaï• Conclusion
● Translate OCL queries into Gremlin traversals
– Map OCL expressions to Gremlin steps
– Merge created steps into a (several) traversal(s)
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 12
Mogwaï
● Map OCL expressions to Gremlin steps
• Introduction• Model Persistence• Mogwaï• Conclusion
1class="Package"
4name="c1"
5name="c2"
2class="Class"
3name="p1"
instanceof
instanceof
instanceof
contents
contents
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 13
Mogwaï
● Merge created steps into a traversal
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 14
Mogwaï
• Introduction• Model Persistence• Mogwaï• Conclusion
● OCL Transformation Example
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 15
Mogwaï
● Query generation and execution
● Delegates query computation to the database
● Returns graph elements to the persistence layer
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 16
Mogwaï
● Benchmarks
– Model containing 2 million elements– Up to 20 times faster than other query approaches
– Consume up to 75 times less memory
• Introduction• Model Persistence• Mogwaï• Conclusion
A B0
50
100
150
200
250
300
350
Query Execution Time (s)
IncQuery
OCL
Mogwaï
A B0
100
200
300
400
500
600
Query Memory Consumption (MB)
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 17
Conclusion
● Model Persistence Frameworks
– Not designed to compute model queries efficiently
– Write manually database-level queries is hard
● Mogwaï Framework
– Translates OCL queries into Gremlin traversals
– Positive results
– Not adapted to small models
– Needs to be integrated
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 18
Conclusion
● Future Work
– Integration in state of the art tools
– Target other NoSQL databases / storage schema
– Use the Mogwaï to access graph databases using OCL
• Introduction• Model Persistence• Mogwaï• Conclusion
01/06/2016 Mogwaï: a Framework to Handle Complex Queries on Large Models - G. Daniel 19
Questions?
• Introduction• Model Persistence• Mogwaï• Conclusion
Websites / Repositories
NeoEMF: neoemf.com
Mogwaï: github.com/atlanmod/Mogwai
https://github.com/atlanmod
Thank you for your attention!
https://github.com/SOM-Research