Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Datalog: Biting the Silver Bullet

Datalog: Biting the Silver Bullet

Norbert Wójtowicz

March 15, 2018
Tweet

More Decks by Norbert Wójtowicz

Other Decks in Programming

Transcript

  1. D A T A Ȑ | 1 D,T 2 A

    DATA Information Systems
  2. D A T A Ȑ | 1 D,T 2 A

    DATA Information Systems
  3. Entity · Attribute · Value [entity attribute value] {:user/name “richhickey”}

    {:user/name “tonsky”} {:user/name “pithyless”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  4. Entity · Attribute · Value [entity attribute value] {:user/name “richhickey”}

    {:user/name “tonsky”} {:user/name “pithyless”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  5. Entity · Attribute · Value [entity attribute value] {:user/name “richhickey”}

    {:user/name “tonsky”} {:user/name “pithyless”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  6. Pattern Matching - Constants [11 _ _] [_ _ “pithyless”]

    [_ :user/name _] [22 :user/name “tonsky”] [11 :user/name “tonsky”] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  7. Pattern Matching - Constants [11 _ _] [_ _ “pithyless”]

    [_ :user/name _] [22 :user/name “tonsky”] [11 :user/name “tonsky”] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  8. Pattern Matching - Constants [11 _ _] [_ _ “pithyless”]

    [_ :user/name _] [22 :user/name “tonsky”] [11 :user/name “tonsky”] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  9. Pattern Matching - Constants [11 _ _] [_ _ “pithyless”]

    [_ :user/name _] [22 :user/name “tonsky”] [11 :user/name “tonsky”] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  10. Pattern Matching - Constants [11 _ _] [_ _ “pithyless”]

    [_ :user/name _] [22 :user/name “tonsky”] [11 :user/name “tonsky”] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  11. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  12. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  13. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  14. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  15. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  16. Pattern Matching - Bindings [?e _ _] [_ ?a _]

    [_ _ ?v] [?e ?a _] [?e _ ?v] [?e ?a ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  17. Pattern Matching - Mix & Match [?e :user/name “pithyless”] [11

    :user/name ?v] [?e :user/name ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  18. Pattern Matching - Mix & Match [?e :user/name “pithyless”] [11

    :user/name ?v] [?e :user/name ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  19. Pattern Matching - Mix & Match [?e :user/name “pithyless”] [11

    :user/name ?v] [?e :user/name ?v] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  20. Basic Query [:find ?name :where [11 :user/name ?name]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  21. Basic Query [:find ?name :where [11 :user/name ?name]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  22. Basic Query e a v 11 :user/name richhickey 22 :user/name

    tonsky 33 :user/name pithyless [:find ?name :where [11 :user/name ?name]] ∈{[“richhickey”]}
  23. Basic Query [:find ?id :where [?id :user/name “tonsky”]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  24. Basic Query [:find ?id :where [?id :user/name “tonsky”]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  25. Basic Query [:find ?id :where [?id :user/name “tonsky”]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless ∈{[22]}
  26. Sets [:find ?name :where [_ :user/name ?name]] e a v

    11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  27. Sets [:find ?name :where [_ :user/name ?name]] e a v

    11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  28. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless [:find ?name :where [_ :user/name ?name]] ∈{[“richhickey”] [“tonsky”] [“pithyless”]} Sets
  29. Sets [:find ?attr :where [_ ?attr _]] e a v

    11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  30. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless ∈{[:user/name]} Sets [:find ?attr :where [_ ?attr _]]
  31. Sets · Lists · Scalars [:find ?name :where [_ :user/name

    ?name]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  32. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless [:find ?name :where [_ :user/name ?name]] ∈{[“richhickey”] [“tonsky”] [“pithyless”]} Sets · Lists · Scalars
  33. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless [:find [?name ...] :where [_ :user/name ?name]] [“richhickey” “tonsky” “pithyless”] Sets · Lists · Scalars
  34. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless [:find ?name . :where [_ :user/name ?name]] “tonsky” Sets · Lists · Scalars
  35. Multiple Bindings [:find ?id ?name :where [?id :user/name ?name]] e

    a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  36. Multiple Bindings [:find ?id ?name :where [?id :user/name ?name]] e

    a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  37. Multiple Bindings [:find ?id ?name :where [?id :user/name ?name]] e

    a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  38. ∈{[11 “richhickey”] [22 “tonsky”] [33 “pithyless”]} [:find ?id ?name :where

    [?id :user/name ?name]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless Multiple Bindings
  39. Entity {:user/name “richhickey” :user/email “[email protected]”} {:user/name “tonsky” :user/email “[email protected]"} {:user/name

    “pithyless” :user/email “[email protected]”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected]
  40. Entity {:user/name “richhickey” :user/email “[email protected]”} {:user/name “tonsky” :user/email “[email protected]"} {:user/name

    “pithyless” :user/email “[email protected]”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected]
  41. Entity {:user/name “richhickey” :user/email “[email protected]”} {:user/name “tonsky” :user/email “[email protected]"} {:user/name

    “pithyless” :user/email “[email protected]”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected]
  42. Entity {:user/name “richhickey” :user/email “[email protected]”} {:user/name “tonsky” :user/email “[email protected]"} {:user/name

    “pithyless” :user/email “[email protected]”} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected]
  43. Join e a v 11 :user/name richhickey 22 :user/name tonsky

    33 :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]]
  44. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]] Join
  45. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]] Join
  46. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]] Join
  47. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]] ∈{[“[email protected]”]} Join
  48. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?name :where [?id :user/name ?name] [?id :user/email “[email protected]”]] ∈{[“richhickey”]} Join
  49. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?name :where [?id :user/name ?name] [?id :user/email “fake”]] ∈{} Join
  50. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 11 :user/email [email protected] 22 :user/email [email protected] 33 :user/email [email protected] [:find ?name ?email :where [?id :user/name ?name] [?id :user/email ?email]] ∈{[“richhickey” “[email protected]”] [“tonsky” “[email protected]”] [“pithyless” “[email protected]”]} Join
  51. Reference {:org/name “clojure”} {:repo/slug "clojure/clojure" :repo/owner 44} {:repo/slug "tonsky/datascript" :repo/owner

    22} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  52. Reference {:org/name “clojure”} {:repo/slug "clojure/clojure" :repo/owner 44} {:repo/slug "tonsky/datascript" :repo/owner

    22} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  53. Reference {:org/name “clojure”} {:repo/slug "clojure/clojure" :repo/owner 44} {:repo/slug "tonsky/datascript" :repo/owner

    22} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  54. Reference {:org/name “clojure”} {:repo/slug "clojure/clojure" :repo/owner 44} {:repo/slug "tonsky/datascript" :repo/owner

    22} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  55. Reference - Ident e a v 11 :user/name richhickey 22

    :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 {:org/name “clojure”} {:repo/slug "clojure/clojure" :repo/owner [:org/name “clojure”]} {:repo/slug "tonsky/datascript" :repo/owner [:user/name “tonsky"]}
  56. Follow References [:find ?repo :where [?p :user/name “tonsky”] [?r :repo/owner

    ?p] [?r :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  57. [:find ?repo :where [?p :user/name “tonsky”] [?r :repo/owner ?p] [?r

    :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 Follow References
  58. [:find ?repo :where [?p :user/name “tonsky”] [?r :repo/owner ?p] [?r

    :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 Follow References
  59. [:find ?repo :where [?p :user/name “tonsky”] [?r :repo/owner ?p] [?r

    :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 Follow References
  60. [:find ?repo :where [?p :user/name “tonsky”] [?r :repo/owner ?p] [?r

    :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 ∈{[“tonsky/datascript”]} Follow References
  61. [:find ?name :where [?p :user/name ?name] [?r :repo/owner ?p] [?r

    :repo/slug “tonsky/datascript”]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 ∈{[“tonsky”]} Follow References - Reverse
  62. Polymorphic References [:find ?name ?repo :where [?p :user/name ?name] [?r

    :repo/owner ?p] [?r :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 ∈{[“tonsky” “tonsky/datascript”]}
  63. Polymorphic References [:find ?name ?repo :where [?p :org/name ?name] [?r

    :repo/owner ?p] [?r :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 ∈{[“clojure” “clojure/clojure”]}
  64. Polymorphic References [:find ?name ?repo :where (or [?p :org/name ?name]

    [?p :user/name ?name]) [?r :repo/owner ?p] [?r :repo/slug ?repo]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 ∈{[“tonsky” “tonsky/datascript”] [“clojure” “clojure/clojure”]}
  65. Rules [:find ?name ?repo :where [(repo-owner ?p ?name)] [?r :repo/owner

    ?p] [?r :repo/slug ?repo]] [[(repo-owner ?p ?name) [?p :org/name ?name]] [(repo-owner ?p ?name) [?p :user/name ?name]]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22
  66. Circular References {:repo/slug “pithyless/datascript" :repo/owner [:user/name “pithyless"] :repo/fork [:repo/slug "tonsky/datascript"]}

    e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  67. Circular References {:repo/slug “pithyless/datascript" :repo/owner [:user/name “pithyless"] :repo/fork [:repo/slug "tonsky/datascript"]}

    e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  68. Find forks [:find ?repo :where [?r :repo/slug ?repo] [?r :repo/fork

    _]] ∈{[“pithyless/datascript”]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  69. Find originals [:find ?repo :where [?r :repo/slug ?repo] [(missing ?r

    :repo/fork)]] ∈{[“clojure/clojure”] [“tonsky/datascript”]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  70. List forks [:find ?orig ?fork :where [?orig-id :repo/slug ?orig] [?fork-id

    :repo/slug ?fork] [?fork-id :repo/fork ?orig-id]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  71. List forks [:find ?orig ?fork :where [?orig-id :repo/slug ?orig] [?fork-id

    :repo/slug ?fork] [?fork-id :repo/fork ?orig-id]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  72. List forks [:find ?orig ?fork :where [?orig-id :repo/slug ?orig] [?fork-id

    :repo/slug ?fork] [?fork-id :repo/fork ?orig-id]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  73. List forks [:find ?orig ?fork :where [?orig-id :repo/slug ?orig] [?fork-id

    :repo/slug ?fork] [?fork-id :repo/fork ?orig-id]] ∈{[“tonsky/datascript” “pithyless/datascript”]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 44 :org/name clojure 55 :repo/slug clojure/clojure 55 :repo/owner 44 66 :repo/slug tonsky/datascript 66 :repo/owner 22 77 :repo/slug pithyless/datascript 77 :repo/owner 33 77 :repo/fork 66
  74. Multiple Values {:repo/slug "clojure/clojure" :repo/lang [“clojure” “java”]} {:repo/slug "tonsky/datascript" :repo/lang

    [“clojure” “javascript”]} {:repo/slug "pithyless/datascript" :repo/lang [“clojure” “javascript”]} e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 55 :repo/lang clojure 55 :repo/lang javascript 55 :repo/lang clojure 55 :repo/lang javascript
  75. Multiple Values {:repo/slug "clojure/clojure" :repo/lang [“clojure” “java”]} {:repo/slug "tonsky/datascript" :repo/lang

    [“clojure” “javascript”]} {:repo/slug "pithyless/datascript" :repo/lang [“clojure” “javascript”]} e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 55 :repo/lang clojure 55 :repo/lang javascript 55 :repo/lang clojure 55 :repo/lang javascript
  76. Multiple Values {:repo/slug "clojure/clojure" :repo/lang [“clojure” “java”]} {:repo/slug "tonsky/datascript" :repo/lang

    [“clojure” “javascript”]} {:repo/slug "pithyless/datascript" :repo/lang [“clojure” “javascript”]} e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 55 :repo/lang clojure 55 :repo/lang javascript
  77. Multiple Values {:repo/slug "clojure/clojure" :repo/lang [“clojure” “java”]} {:repo/slug "tonsky/datascript" :repo/lang

    [“clojure” “javascript”]} {:repo/slug "pithyless/datascript" :repo/lang [“clojure” “javascript”]} e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  78. Multiple Values e a v 55 :repo/slug clojure/clojure 66 :repo/slug

    tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript [:find ?lang :where [_ :repo/lang ?lang]]
  79. Multiple Values e a v 55 :repo/slug clojure/clojure 66 :repo/slug

    tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript [:find ?lang :where [_ :repo/lang ?lang]]
  80. Multiple Values e a v 55 :repo/slug clojure/clojure 66 :repo/slug

    tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript [:find ?lang :where [_ :repo/lang ?lang]] ∈{[“clojure”] [“java”] [“javascript”]}
  81. Multiple Values [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r

    :repo/lang ?lang]] e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  82. Multiple Values [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r

    :repo/lang ?lang]] e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  83. Multiple Values [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r

    :repo/lang ?lang]] e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  84. Multiple Values [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r

    :repo/lang ?lang]] e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  85. Multiple Values [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r

    :repo/lang ?lang]] e a v 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript
  86. Multiple Values e a v 55 :repo/slug clojure/clojure 66 :repo/slug

    tonsky/datascript 77 :repo/slug pithyless/datascript 55 :repo/lang clojure 55 :repo/lang java 66 :repo/lang clojure 66 :repo/lang javascript 77 :repo/lang clojure 77 :repo/lang javascript [:find ?repo ?lang :where [?r :repo/slug ?repo] [?r :repo/lang ?lang]] ∈{[“clojure/clojure” “clojure”] [“clojure/clojure” “java”] [“tonsky/datascript” “clojure”] [“tonsky/datascript” “javascript”] [“pithyless/datascript” “clojure”] [“pithyless/datascript” “javascript”]}
  87. Multiple References {:user/name "richhickey" :user/stars [[:repo/slug “clojure/clojure"]]} {:user/name "tonsky" :user/stars

    [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} {:user/name “pithyless" :user/stars [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  88. Multiple References {:user/name "richhickey" :user/stars [[:repo/slug “clojure/clojure"]]} {:user/name "tonsky" :user/stars

    [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} {:user/name “pithyless" :user/stars [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  89. Multiple References {:user/name "richhickey" :user/stars [[:repo/slug “clojure/clojure"]]} {:user/name "tonsky" :user/stars

    [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} {:user/name “pithyless" :user/stars [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  90. Multiple References {:user/name "richhickey" :user/stars [[:repo/slug “clojure/clojure"]]} {:user/name "tonsky" :user/stars

    [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} {:user/name “pithyless" :user/stars [[:repo/slug "clojure/clojure"] [:repo/slug “tonsky/datascript"]]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  91. Aggregations [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p

    :user/stars ?r]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  92. Aggregations [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p

    :user/stars ?r]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  93. Aggregations [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p

    :user/stars ?r]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  94. Aggregations [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p

    :user/stars ?r]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  95. Aggregations [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p

    :user/stars ?r]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66
  96. Aggregations e a v 11 :user/name richhickey 22 :user/name tonsky

    33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript 11 :user/stars 55 22 :user/stars 55 22 :user/stars 66 33 :user/stars 55 33 :user/stars 66 ∈{[“clojure/clojure” 3] [“tonsky/datascript” 2]} [:find ?repo (count ?p) :where [?r :repo/slug ?repo] [?p :user/stars ?r]]
  97. Predicates [:find ?repo :where [_ :repo/slug ?repo] [(.startsWith ?repo “c”)]]

    e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  98. Predicates [:find ?repo :where [_ :repo/slug ?repo] [(.startsWith ?repo “c”)]]

    e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  99. Predicates [:find ?repo :where [_ :repo/slug ?repo] [(.startsWith ?repo “c”)]]

    e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  100. Predicates ∈{[“clojure/clojure”]} e a v 11 :user/name richhickey 22 :user/name

    tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript [:find ?repo :where [_ :repo/slug ?repo] [(.startsWith ?repo “c”)]]
  101. Fulltext Search [:find ?repo ?score :where [(fulltext :repo/slug “clojure”) [[?r

    ?repo _ ?score]]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  102. Fulltext Search [:find ?repo ?score :where [(fulltext :repo/slug “clojure”) [[?r

    ?repo _ ?score]]] ∈{[“clojure/clojure” 0.99]} e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  103. e a v 11 :user/name richhickey 22 :user/name tonsky 33

    :user/name pithyless 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript Databases as Indices
  104. Key / Value [:find ?repo :where [_ :repo/slug ?repo]] a

    v e :repo/slug clojure/clojure 55 :repo/slug pithyless/datascript 77 :repo/slug tonsky/datascript 66 :user/name pithyless 33 :user/name richhickey 11 :user/name tonsky 22 :user/stars 55 11 :user/stars 55 22 :user/stars 55 33 :user/stars 66 22 :user/stars 66 33
  105. Row [:find ?name :where [11 :user/name ?name]] e a v

    11 :user/name richhickey 11 :user/stars 55 22 :user/name tonsky 22 :user/stars 55 22 :user/stars 66 33 :user/name pithyless 33 :user/stars 55 33 :user/stars 66 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  106. Column [:find ?p (count ?p) :where [?p :user/stars _]] a

    e v :repo/slug 55 clojure/clojure :repo/slug 66 tonsky/datascript :repo/slug 77 pithyless/datascript :user/name 11 richhickey :user/name 22 tonsky :user/name 33 pithyless :user/stars 11 55 :user/stars 22 55 :user/stars 22 66 :user/stars 33 55 :user/stars 33 66
  107. Document [:find ?repo :where [11 :user/stars ?r] [?r :repo/slug ?repo]

    e a v 11 :user/name richhickey 11 :user/stars 55 22 :user/name tonsky 22 :user/stars 55 22 :user/stars 66 33 :user/name pithyless 33 :user/stars 55 33 :user/stars 66 55 :repo/slug clojure/clojure 66 :repo/slug tonsky/datascript 77 :repo/slug pithyless/datascript
  108. Graph [:find ?e :where [?e :user/stars ?r] [?r :repo/slug “clojure/clojure”]

    v a e 55 :user/stars 11 55 :user/stars 22 55 :user/stars 33 66 :user/stars 22 66 :user/stars 33 clojure/clojure :repo/slug 55 pithyless :user/name 33 pithyless/datascript :repo/slug 77 richhickey :user/name 11 tonsky :user/name 22 tonsky/datascript :repo/slug 66
  109. Databases as Indices Structure Index key/value A · V ·

    E row E · A · V column A · E · V document E · A · V graph V · A · E search inverted-index
  110. Reified Attributes 11 :user/name richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  111. Reified Attributes 11 2 richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  112. Reified Attributes 11 2 richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  113. Reified Attributes 11 2 richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  114. Reified Attributes 11 2 richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  115. Reified Attributes 11 2 richhickey 2 :db/ident :user/name 2 :db/valueType

    :db.type/string 2 :db/doc “GitHub username” 2 :db/unique :db.unique/identity 2 :db/fulltext true
  116. Transactions [entity attribute value] e a v 11 :user/name richhickey

    22 :user/name tonsky 33 :user/name pithyless
  117. Transactions [entity attribute value transaction operation] e a v tx

    op 11 :user/name richhickey 1000 true 22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true
  118. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true 99 :user/name awkay 3000 true Transactions · Assert
  119. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true 22 :user/name tonsky 3000 false Transactions · Retract
  120. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true 22 :user/name tonsky 3000 false 22 :user/name nikita 3000 true Transactions · Update
  121. Reified Transactions e a v tx 33 :user/name pithyless 2000

    2000 :db/txInstant 2018-03-… 2000 2000 :tx/author Norbert 2000 2000 :tx/source GitHub import … 2000
  122. Reified Transactions e a v tx 33 :user/name pithyless 2000

    2000 :db/txInstant 2018-03-… 2000 2000 :tx/author Norbert 2000 2000 :tx/source GitHub import … 2000
  123. Reified Transactions e a v tx 33 :user/name pithyless 2000

    2000 :db/txInstant 2018-03-… 2000 2000 :tx/author Norbert 2000 2000 :tx/source GitHub import … 2000
  124. Reified Transactions e a v tx 33 :user/name pithyless 2000

    2000 :db/txInstant 2018-03-… 2000 2000 :tx/author Norbert 2000 2000 :tx/source GitHub import … 2000
  125. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  126. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  127. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  128. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  129. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  130. Time Traveling (as-of db 3000) (as-of db #inst “2018-03-16”) (since

    db #inst “2018-03-16”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  131. Components e a v 66 :repo/slug tonsky/datascript 110 :commit/sha aaaaaa

    110 :commit/title Release 0.16.2 110 :commit/email [email protected] 66 :git/commits 110 {:repo/slug “tonsky/datascript" :git/commits [{:commit/sha "aaaaaa" :commit/title "Release 0.16.2" :commit/email "[email protected]"}]}
  132. Components e a v 66 :repo/slug tonsky/datascript 110 :commit/sha aaaaaa

    110 :commit/title Release 0.16.2 110 :commit/email [email protected] 66 :git/commits 110 {:repo/slug “tonsky/datascript" :git/commits [{:commit/sha "aaaaaa" :commit/title "Release 0.16.2" :commit/email "[email protected]"}]}
  133. Components {:repo/slug "clojure/clojure" :git/commits [{:commit/sha "bbbbbb" :commit/title "Release 1.8.0" :commit/email

    "[email protected]"} {:commit/sha "cccccc" :commit/title "Release 1.9.0” :commit/email "[email protected]"} {:commit/sha "dddddd" :commit/title "Fix bugs" :commit/email “[email protected]"}]} e a v 55 :repo/slug clojure/clojure 120 :commit/sha bbbbbb 120 :commit/title Release 1.8.0 120 :commit/email [email protected] 55 :git/commits 120 130 :commit/sha cccccc 130 :commit/title Release 1.9.0 130 :commit/email [email protected] 55 :git/commits 130 140 :commit/sha dddddd 140 :commit/title Fix bugs 140 :commit/email [email protected] 55 :git/commits 140
  134. Components {:repo/slug "clojure/clojure" :git/commits [{:commit/sha "bbbbbb" :commit/title "Release 1.8.0" :commit/email

    "[email protected]"} {:commit/sha "cccccc" :commit/title "Release 1.9.0” :commit/email "[email protected]"} {:commit/sha "dddddd" :commit/title "Fix bugs" :commit/email “[email protected]"}]} e a v 55 :repo/slug clojure/clojure 120 :commit/sha bbbbbb 120 :commit/title Release 1.8.0 120 :commit/email [email protected] 55 :git/commits 120 130 :commit/sha cccccc 130 :commit/title Release 1.9.0 130 :commit/email [email protected] 55 :git/commits 130 140 :commit/sha dddddd 140 :commit/title Fix bugs 140 :commit/email [email protected] 55 :git/commits 140
  135. Components {:repo/slug "clojure/clojure" :git/commits [{:commit/sha "bbbbbb" :commit/title "Release 1.8.0" :commit/email

    "[email protected]"} {:commit/sha "cccccc" :commit/title "Release 1.9.0” :commit/email "[email protected]"} {:commit/sha "dddddd" :commit/title "Fix bugs" :commit/email “[email protected]"}]} e a v 55 :repo/slug clojure/clojure 120 :commit/sha bbbbbb 120 :commit/title Release 1.8.0 120 :commit/email [email protected] 55 :git/commits 120 130 :commit/sha cccccc 130 :commit/title Release 1.9.0 130 :commit/email [email protected] 55 :git/commits 130 140 :commit/sha dddddd 140 :commit/title Fix bugs 140 :commit/email [email protected] 55 :git/commits 140
  136. Entity (q [:find ?repo ?sha :where [11 :repo/slug ?repo] [11

    :repo/commits ?c] [?c :commit/sha ?sha]] db)
  137. Entity (q [:find ?repo ?sha ?title :where [11 :repo/slug ?repo]

    [11 :repo/commits ?c] [?c :commit/sha ?sha] [?c :commit/title ?title]] db)
  138. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  139. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  140. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  141. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  142. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  143. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  144. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  145. Pull API [:find (pull ?e query) :where [?e :repo/slug “clojure/clojure”]]

    [:repo/slug :repo/langs {:repo/owner [:user/name :org/name {:repo/_owner [(:repo/langs :limit 1) {:repo/commits [:commit/sha]}]}]}] [{:repo/slug "clojure/clojure" :repo/langs ["clojure" "java"] :repo/owner {:org/name "clojure" :repo/_owner [{:repo/langs ["clojure"] :repo/commits [{:commit/sha "bbbbbb"} {:commit/sha "cccccc"} {:commit/sha “dddddd"} ]}]}}]
  146. Parameterized Query · Template (q [:find ?name :in $ ?id

    :where [?id :user/name ?name]] (db conn) 11)
  147. Parameterized Query · Template (q [:find ?name :in $ [?id

    ...] :where [?id :user/name ?name]] (db conn) [11 22 33])
  148. Parameterized Query · Template (q [:find ?name :in $ ?id

    ?name :where [?id :user/name ?name]] (db conn) 11 “richhickey”)
  149. Parameterized Query · Rules (q [:find ?name :in $ %

    :where [(repo-owner ?p ?name)]] db [[(repo-owner ?p ?name) [?p :org/name ?name]] [(repo-owner ?p ?name) [?p :user/name ?name]]])
  150. Parameterized Query · Database (q [:find ?name (count ?id) :where

    [?id :user/name ?name] [?id :user/stars _] (since (db conn) #inst “2018-03-01”))
  151. Parameterized Query · Database (q [:find ?name (count ?id) :in

    $db $since :where [$db ?id :user/name ?name] [$since ?id :user/stars _] (db conn) (since (db conn) #inst “2018-03-01”)
  152. {:db-before {:database-id "58a47389-f1ab-4d81-85b6-715cecde9bac", :t 1000, :next-t 1001, :history false}, :db-after

    {:database-id "58a47389-f1ab-4d81-85b6-715cecde9bac", :t 1001, :next-t 1005, :history false}, :tx-data [ #datom[13194139534317 50 #inst “2017-02-15T19:28:52.270-00:00" 13194139534317 true] #datom[17592186045422 63 "The Goonies" 13194139534317 true] #datom[17592186045422 64 "action/adventure" 13194139534317 true] #datom[17592186045422 65 1985 13194139534317 true] #datom[17592186045423 63 "Commando" 13194139534317 true] #datom[17592186045423 64 "action/adventure" 13194139534317 true] #datom[17592186045423 65 1985 13194139534317 true] ], :tempids {-9223301668109598138 17592186045422, -9223301668109598137 17592186045423, -9223301668109598136 17592186045424}} Transaction Report
  153. Sort (let [initial (q [:find ?e ?c :where [?e :repo/slug

    ?c]] db) sorted (map first (sort-by second initial)) result (pull-many db ‘[*] sorted)] result)
  154. Sort (let [initial (q [:find ?e ?c :where [?e :repo/slug

    ?c]] db) sorted (map first (sort-by second initial)) result (pull-many db ‘[*] sorted)] result)
  155. Sort (let [initial (q [:find ?e ?c :where [?e :repo/slug

    ?c]] db) sorted (map first (sort-by second initial)) result (pull-many db ‘[*] sorted)] result)