The document introduces Mogwaï, a framework for efficiently querying large models stored in graph databases. It generates queries in Gremlin, a graph traversal language, from queries written in OCL. This allows complex queries to be executed directly on the database without loading the entire model into memory. The framework maps OCL expressions to Gremlin steps and merges the steps into a traversal. Benchmarks show Mogwaï can execute queries up to 20 times faster and use up to 75 times less memory compared to other approaches. Future work includes integrating Mogwaï into modeling tools and supporting additional databases.
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Mogwaï Framework Handles Complex Queries on Large Models
1. Mogwaï: a Framework to Handle
Complex Queries on Large Models
Jordi Cabot
ICREA-UOC
jordi.cabot@icrea.cat
Gwendal Daniel
Inria - Mines Nantes & Lina
gwendal.daniel@inria.fr
Gerson Sunyé
Inria - Mines Nantes & Lina
gerson.sunye@inria.fr
2. 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
3. 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
4. 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
5. 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)
6. 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
7. 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
8. 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
*
9. 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
1
class="Package"
4
name="c1"
5
name="c2"
2
class="Class"
3
name="p1"
instanceof
instanceof
instanceof
contents
contents
10. 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)
1
class="Package"
4
name="c1"
5
name="c2"
2
class="Class"
3
name="p1"
instanceof
instanceof
instanceof
contents
contents
11. 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)
12. 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
1
class="Package"
4
name="c1"
5
name="c2"
2
class="Class"
3
name="p1"
instanceof
instanceof
instanceof
contents
contents
13. 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
14. 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
15. 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
16. 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 B
0
50
100
150
200
250
300
350
Query Execution Time (s)
IncQuery
OCL
Mogwaï
A B
0
100
200
300
400
500
600
Query Memory Consumption (MB)
17. 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
18. 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
19. 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