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.

Decyphering your graph model, Tech Marionette

GraphConnect Europe 2017
Dom Davis, Tech Marionette

  • Login to see the comments

Decyphering your graph model, Tech Marionette

  1. 1. Dom Davis @idomdavis Decyphering Your Graph Model
  2. 2. Dom Davis @idomdavis Decyphering Your Graph Model
  3. 3. Dom Davis @idomdavis Decyphering Your Graph Model
  4. 4. (graphs)-[:ARE]->(everywhere)
  5. 5. 2 3 1 4
  6. 6. hGps://en.wikipedia.org/wiki/Graph_(discrete_mathemaMcs) A directed graph or digraph is a graph in which edges have orientations. It is written as an ordered pair G = (V, A) (sometimes G = (V, E)) with • V a set whose elements are called vertices, nodes, or points; • A a set of ordered pairs of vertices, called arrows, directed edges (sometimes simply edges with the corresponding set named E instead of A), directed arcs, or directed lines. An arrow (x, y) is considered to be directed from x to y; y is called the head and x is called the tail of the arrow; y is said to be a direct successor of x and x is said to be a direct predecessor of y. If a path leads from x to y, then y is said to be a successor of x and reachable from x, and x is said to be a predecessor of y. The arrow (y, x) is called the inverted arrow of (x, y). A directed graph G is called symmetric if, for every arrow in G, the corresponding inverted arrow also belongs to G. A symmetric loopless directed graph G = (V, A) is equivalent to a simple undirected graph G′ = (V, E), where the pairs of inverse arrows in A correspond one-to-one with the edges in E; thus the number of edges in G′ is | E  | = | A  |/2, that is half the number of arrows in G.
  7. 7. (speaker)-[:GIVES]->(talk)
  8. 8. CREATE (s:Speaker { name: "Dom Davis" })-[:GIVES]->(Talk { title: "Decyphering your graph model" })
  9. 9. Noun Noun Verb
  10. 10. Graphs Everywhere Are
  11. 11. Speaker Talk Gives
  12. 12. Subject Object Verb
  13. 13. subject - verb - object
  14. 14. subject - object - verb
  15. 15. verb - subject - object
  16. 16. verb - object - subject
  17. 17. object - verb - subject
  18. 18. object - subject - verb
  19. 19. subject - verb - object
  20. 20. NOUNS
  21. 21. Speaker, Talk, Delegate, Room
  22. 22. VERBS
  23. 23. –Johnny Appleseed Speaker gives talk in room Delegate aGends talk in room
  24. 24. –Johnny Appleseed (:Speaker)-[:GIVES]->(:Talk)-[:IN]->(:Room) (:Delegate)-[:ATTENDS]->(:Talk)-[:IN]->(:Room)
  25. 25. –Johnny Appleseed Speaker has a name
  26. 26. –Johnny Appleseed Speaker has a name Room has a name
  27. 27. –Johnny Appleseed Speaker has a name Room has a name Talk has a Mtle
  28. 28. –Johnny Appleseed Speaker has a name Room has a name Talk has a Mtle Talk has a start Mme
  29. 29. –Johnny Appleseed Speaker has a name Room has a name Talk has a Mtle Talk has a start Mme Talk has an end Mme
  30. 30. –Johnny Appleseed Speaker has a name Room has a name Talk has a Mtle Talk has a start Mme Talk has a duraMon
  31. 31. –Johnny Appleseed How long did I spend in talks?
  32. 32. –Johnny Appleseed How long did I spend in talks? How long did I spend giving talks?
  33. 33. –Johnny Appleseed Will I be out of talk A in Mme for talk B?
  34. 34. –Johnny Appleseed Speaker has a company Speaker has a role
  35. 35. –Johnny Appleseed Speaker has role at company
  36. 36. –Johnny Appleseed Speaker has role at company Delegate has role at company
  37. 37. –Johnny Appleseed Company has a name Role has a Mtle
  38. 38. Speaker gives talk in room Delegate aGends talk in room Speaker has role at company Delegate has role at company
  39. 39. (:Speaker {name: "Dom Davis"})
  40. 40. (:Speaker)-[:HAS_NAME]->(:`Dom Davis`)
  41. 41. (:Speaker {name: "Dom Davis"}) -[:HAS_ROLE {type: "Primary"}]->(:Role {title: "CTO"}) -[:IN_COMPANY]->(:Company {name: "Tech Marionette"})
  42. 42. -[:HAS_ROLE {type: "Primary"}]->
  43. 43. (:Speaker {name: "Dom Davis"}) -[:HAS_PRIMARY_ROLE]->(:Role {title: "CTO"}) -[:IN_COMPANY]->(:Company {name: "Tech Marionette"})
  44. 44. (r:Role {title: "CTO"}), (:Speaker {name: "Dom Davis"})-[:HAS_ROLE]->(r) -[:IN_COMPANY]->(:Company {name: "Tech Marionette"}), (r)-[:TYPE]->(:Primary)
  45. 45. –Johnny Appleseed Drive the model from the language of the domain
  46. 46. –Johnny Appleseed Concepts, ProperMes, RelaMonships
  47. 47. (:Concept { property1: "some name", // : : : propertyN: "some other name" })
  48. 48. (:Concept { properties: ["A", "B", "C"] })
  49. 49. –Johnny Appleseed Concepts have properMes
  50. 50. (:Concept)-[:HAS]->(p:Property) SET p.Name = "A"
  51. 51. (:Instance)-[:HAS]->(v:Value) SET v.Name = "A", v.Data = "Foo"
  52. 52. (:Concept)-[:IN]->(:Schema)
  53. 53. (:Schema)-[:ALIAS]->(:Concept)
  54. 54. (s:Schema), (c:Concept {name: "Ticketing System"}), (s)-[:ALIAS {name: "JIRA"}]-(c), (s)-[:ALIAS {name: "Bugzilla"}]-(c), (s)-[:ALIAS {name: "Fogbugz"}]-(c)
  55. 55. –Johnny Appleseed Labels, Nodes, RelaMonships, ProperMes
  56. 56. –Johnny Appleseed Schemas, Concepts, ProperMes, RelaMonships, Instances, Values, Links
  57. 57. –Johnny Appleseed TickeMng system has Mckets raised by users
  58. 58. –Johnny Appleseed Schemas, Concepts, ProperMes, RelaMonships, Instances, Values, Links
  59. 59. –Johnny Appleseed Labels, Nodes, RelaMonships, ProperMes
  60. 60. –Johnny Appleseed Schemas, Concepts, ProperMes, RelaMonships, Instances, Values, Links
  61. 61. (g:Graph)-[:DESCRIBED_BY]-(g)

×