Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases

5,253 views

Published on

UMLtoGraphDB presentation at ER2016. Related article available online at https://hal.archives-ouvertes.fr/hal-01344015/document

Related post on modeling-languages.com: http://modeling-languages.com/uml-to-nosql-graph-database/

  • Very nice tips on this. In case you need help on any kind of academic writing visit website ⇒ www.HelpWriting.net ⇐ and place your order
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/36cXjBY ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating for everyone is here: ♥♥♥ http://bit.ly/36cXjBY ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases

  1. 1. UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases 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. 2. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 2 Introduction ● NoSQL – Scalability – Availability – Performance ● Graph Databases – Store highly interconnected data ● Vertices, edges, properties – Expressive query language ● Gremlin, Cypher – Social networks, data provenance analysis
  3. 3. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 3 Introduction ● Schemaless Flexible ● Non-uniform data ● Schema evolutions Implicit schema defined by data ● Need to acquire this knowledge ● Specific to each database ● Not formally described
  4. 4. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 4 Introduction Hard to integrate in code-generation architectures – Few options for mapping ER/UML to NoSQL – Data consistency challenge – Lack of support for integrity constraints → Goal: create a code generation framework – Map conceptual schemas to graph databases – Input: UML + OCL – Output: graph database + graph queries
  5. 5. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 5 UMLtoGraphDB ● MDA methodology – Platform Independent Model (PIM) ● Conceptual schema – Platform Specific Model (PSM) ● Refines PIM for a specific implementation – Code generation from PSM
  6. 6. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 6 UMLtoGraphDB – Starting Point ● Conceptual Schema – UML class diagram ● Concepts ● Data structure – OCL ● Business rules ● Invariants / Constraints
  7. 7. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 7 UMLtoGraphDB
  8. 8. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 8 UMLtoGraphDB
  9. 9. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 9 UMLtoGraphDB
  10. 10. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 10 Class2GraphDB Transformation
  11. 11. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 11 GraphDB Metamodel GraphSpecification + baseDB : DBType VertexDefinition EdgeDefinition PropertyDefinition + Key : String + Type : PrimitiveType GraphElement + label : String[*] <<Enumeration>> PrimitiveType Object Integer String Boolean <<Enumeration>> DBType Neo4j OrientDB vertices * inEdges * head 1 outEdges * tail 1 edges * properties *
  12. 12. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 12 Class2GraphDB ● (Subset of) UML class diagram to GraphDB – Non-abtract classes → VertexDefinition – Attribute → PropertyDefinition – Association (2 classes) → EdgeDefinition – Association (n classes) → VertexDefinition + EdgeDefinitions – Association class → VertexDefinition + EdgeDefinitions – Support for generalization / specialization
  13. 13. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 13 Client + name : String + address : String Order + shipmentDate : Date + deliveryDate : Date + paid : Boolean Product + name : String + price : Integer + description : String OrderLine + quantity : Integer + productPrice : Integer PrivateCustomer + cardNumber : String orders * 1..** Running Example context Product inv validPrice: self.price > 0 context Order inv validOrder: self.shipmentData < self.deliveryDate context Client inv maxUnpaidOrders: self.orders→select(o | not o.paid) →size() < 3 Running Example - PIM
  14. 14. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 14 Class2GraphDB Class mapping Product + name : String + price : Integer + description : String v1:VertexDefinition + label : String = "Product" p1:PropertyDefinition + key : String = "name" + type : PrimitiveType = String p3:PropertyDefinition + key : String = "description" + type : PrimitiveType = String p2:PropertyDefinition + key : String = "price" + type : PrimitiveType = Integer
  15. 15. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 15 Class2GraphDB Association mapping v3:VertexDefinition + label : String = "Order" v1:VertexDefinition + label : String = "Client" e1:EdgeDefinition + name : String = "orders" tail head Client Order orders*
  16. 16. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 16 Class2GraphDB Order Product OrderLine + quantity : Integer + productPrice : Integer 1..* * AssociationClass mapping v2:VertexDefinition + label : String = "Order" v3:VertexDefinition + label : String = "Product" v4:VertexDefinition + label : String = "OrderLine" e2:EdgeDefinition + name : String = "orderLine" e3:EdgeDefinition + name : String = "orderLine" p5:PropertyDefinition + key : String = "quantity" + type : PrimitiveType = Integer p4:PropertyDefinition + key : String = "productPrice" + type : PrimitiveType = Integer tail head head tail
  17. 17. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 17 UMLtoGraphDB
  18. 18. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 18 OCL2Gremlin Transformation
  19. 19. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 19 Gremlin Metamodel ● Gremlin language – Graph traversal DSL – Based on the Blueprints API – Generic query language for graph databases
  20. 20. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 20 Gremlin Metamodel GremlinScript InstructionTraversalElementStep OutEStep + label : String InEStep + label : String OutVStep InVStep FilterStep . . . EdgesStep + label : String VerticesStep + id : String instructions * next 0..1
  21. 21. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 21 OCL2Gremlin ● Adaptation of the Mogwaï* query framework – Gremlin metamodel definition – Map OCL expressions to Gremlin steps – Merge created steps into traversals – Generate query code from Gremlin AST * G. Daniel, G. Sunyé, and J. Cabot. Mogwaï: a Framework to Handle Complex Queries on Large Models. In RCIS 2016, Grenoble, FR,June 2016
  22. 22. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 22 OCL2Gremlin context Product inv validPrice: self.price > 0 context Order inv validOrder: self.shipmentData < self.deliveryDate context Client inv maxUnpaidOrders: self.orders→select(o | not o.paid) →size() < 3 // validPrice v.property(''price'') > 0; // validOrder v.property(''shipmentDate'') < v.property(''deliveryDate'') // maxUnpaidOrders v.outE(''orders'').inV .filter{it.property(''paid'') == false} .count() < 3
  23. 23. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 23 UMLtoGraphDB
  24. 24. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 24 Graph2Code
  25. 25. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 25 Graph2Code ● Generate Java beans – Adapter pattern ● Delegate to database objects ● Lightweight implementation – Bean factory ● Create new elements ● Reifies database objects
  26. 26. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 26 Graph2Code – Client Class public class Client extends BlueprintsBean { public Client(Vertex v, Graph graph, UMLModelFactory factory) { super(v,graph,factory); } public String getName() { return (String) this.vertex.property(''name'').value(); } public void setName(String newName) { this.vertex.property(''name'', newName); } public List<Order> getOrders() { Iterator<Vertex> otherEnd = this.vertex.vertices(Direction.OUT,"orders"); return new GremlinIterator<Order>(otherEnd, factory); } public void addOrder(Order newOrder) { this.vertex.addEdge(“orders”, newOrder.getVertex()); }
  27. 27. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 27 Graph2Code – Client Class [...] public boolean checkMaxUnpaidOrders() { return this.graph.traversal().V(this.vertex).out(''orders'').filter( v -> v.get().<Boolean>property(''paid'').value()) .count().is(P.lt(3)).hasNext(); } }
  28. 28. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 28 Tooling ● Set of open-source eclipse plugins – ATL: Model-to-model transformations ● ~ 110 rules / helpers – XTend: Code generation ● Full stack execution: less than 5 seconds
  29. 29. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 29 Conclusion ● Chain of model transformations – UML (class diagram) to GraphDB – OCL to Gremlin – Graph to code transformation ● GraphDB metamodel ● Future Work – Refactoring operations at the PSM level – Cover multiple database types – Reverse engineering
  30. 30. 17/11/2016 UMLtoGraphDB: Mapping Conceptual Schemas to Graph Databases - G. Daniel 30 Questions? Websites / Repositories UMLtoGraphDB: https://github.com/atlanmod/UML2NoSQL Mogwaï: https://github.com/atlanmod/Mogwai https://github.com/atlanmod Thank you for your attention! https://github.com/SOM-Research

×