This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-03
Channels
- # announcements (3)
- # asami (4)
- # aws (1)
- # babashka (22)
- # beginners (111)
- # calva (3)
- # cider (1)
- # clj-kondo (55)
- # clj-on-windows (9)
- # cljsrn (1)
- # clojure (13)
- # clojure-europe (35)
- # clojure-losangeles (3)
- # clojure-nl (2)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (5)
- # clojurescript (51)
- # conjure (5)
- # cursive (5)
- # datascript (1)
- # datomic (27)
- # deps-new (8)
- # depstar (41)
- # emacs (4)
- # fulcro (24)
- # graphql (4)
- # gratitude (8)
- # helix (36)
- # jobs (2)
- # leiningen (2)
- # lsp (11)
- # off-topic (24)
- # pathom (23)
- # pedestal (2)
- # polylith (27)
- # re-frame (12)
- # reagent (7)
- # reitit (1)
- # releases (3)
- # remote-jobs (1)
- # rewrite-clj (4)
- # sci (1)
- # shadow-cljs (27)
- # spacemacs (12)
- # tools-deps (31)
- # web-security (2)
Hi all, wondering if someone can help me understand how pull works with recursion when the recursive refs are not using the same cardinality and or the same keys? Here is an example. The first call doesn’t return the desired results. The second call is closer to what I need to achieve, but I need to allow for unbounded recursion.
(d/pull @dsdb '[:node/name {:node/children [{:edge/child ...}]}] [:node/name "Chorizo Wrap"])
;; => #:node{:name "Chorizo Wrap"}
(d/pull @dsdb '[:node/name { :node/children
[{:edge/child
[:node/name {:node/children
[{:edge/child [:node/name]}]}]}]}] [:node/name "Chorizo Wrap"])
;; => #:node{:name "Chorizo Wrap",
;; :children
;; [#:edge{:child
;; #:node{:name "Sauce",
;; :children [#:edge{:child #:node{:name "Salt"}} #:edge{:child #:node{:name "Pepper"}}]}}]}
The schema
{:edge/child #:db{:cardinality :db.cardinality/one :valueType :db.type/ref}
:edge/parent #:db{:cardinality :db.cardinality/one :valueType :db.type/ref}
:node/name #:db{:unique :db.unique/identity}
:node/children #:db{:valueType :db.type/ref :cardinality :db.cardinality/many}
:node/parents #:db{:valueType :db.type/ref :cardinality :db.cardinality/many}}