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

Datalog: Data All Truth · Append Log · Obtain G...

Datalog: Data All Truth · Append Log · Obtain Graph

Norbert Wójtowicz

June 18, 2018
Tweet

More Decks by Norbert Wójtowicz

Other Decks in Programming

Transcript

  1. Datalog Data All Truth · Append Log · Obtain Graph

    Norbert Wójtowicz · @pithyless
  2. D A T A ! " # 1 D,T 2

    A DATA Information Systems
  3. D A T A ! " # 1 D,T 2

    A DATA Information Systems
  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. 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
  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 - 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
  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 - 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
  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. 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
  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 [:find ?name :where [11 :user/name ?name]] e a

    v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  23. 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”]}
  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
  26. 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]}
  27. Sets [:find ?name :where [_ :user/name ?name]] e a v

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

    11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  29. 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
  30. Sets [:find ?attr :where [_ ?attr _]] e a v

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

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

    ?name]] e a v 11 :user/name richhickey 22 :user/name tonsky 33 :user/name pithyless
  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]] [“richhickey” “tonsky” “pithyless”] Sets · Lists · Scalars
  35. 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
  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. 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
  39. ∈{[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
  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. 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]
  44. 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]]
  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]] 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 ?email :where [?id :user/name “richhickey”] [?id :user/email ?email]] ∈{[“[email protected]”]} 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 “[email protected]”]] ∈{[“richhickey”]} 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 :where [?id :user/name ?name] [?id :user/email “fake”]] ∈{} Join
  51. 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
  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 {: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
  56. 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"]}
  57. 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
  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 Follow References
  61. [: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
  62. [: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
  63. 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”]}
  64. 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”]}
  65. 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”]}
  66. 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
  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. 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
  69. 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
  70. 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
  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]] 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. 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
  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 55 :repo/lang clojure 55 :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 55 :repo/lang clojure 55 :repo/lang javascript
  78. 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
  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. 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]] Multiple Values
  81. 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”]} Multiple Values
  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. [: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 Multiple Values
  84. [: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 Multiple Values
  85. [: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 Multiple Values
  86. [: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 Multiple Values
  87. 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”]}
  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. 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
  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. [: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 Aggregations
  94. [: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 Aggregations
  95. [: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 Aggregations
  96. [: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 Aggregations
  97. 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]]
  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. [: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 Predicates
  100. 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
  101. 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”)]]
  102. 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
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. 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
  110. 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
  111. 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
  112. 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
  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. 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
  117. 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
  118. Transactions [entity attribute value] e a v 11 :user/name richhickey

    22 :user/name tonsky 33 :user/name pithyless
  119. 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
  120. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true Transactions · Assert
  121. 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
  122. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true Transactions · Retract
  123. 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
  124. e a v tx op 11 :user/name richhickey 1000 true

    22 :user/name tonsky 1000 true 33 :user/name pithyless 2000 true Transactions · Update
  125. 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
  126. Reified Transactions e a v tx 33 :user/name pithyless 2000

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

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

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

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

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

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

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

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

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

    db #inst “2018-04-17”) (history db) (filter db #(not= :user/password (:a %))) (with db [{:user/name “awkay”}])
  136. 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]"}]}
  137. 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]"}]}
  138. 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
  139. 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
  140. 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
  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. 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"} ]}]}}]
  147. 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"} ]}]}}]
  148. 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"} ]}]}}]
  149. Parameterized Query · Template (q [:find ?name :in $ ?id

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

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

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

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

    [?id :user/name ?name] [?id :user/stars _] (since (db conn) #inst “2018-04-01”))
  154. 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-04-01”)
  155. {: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
  156. 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)
  157. 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)
  158. 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)