This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-22
Channels
- # babashka (106)
- # beginners (29)
- # biff (29)
- # calva (9)
- # cider (6)
- # clj-kondo (24)
- # clojure (40)
- # clojure-europe (94)
- # clojure-japan (1)
- # clojure-nl (1)
- # clojure-norway (45)
- # clojure-uk (13)
- # clojuredesign-podcast (5)
- # clojurescript (12)
- # clr (4)
- # community-development (2)
- # conjure (13)
- # cryogen (4)
- # cursive (4)
- # deps-new (1)
- # fulcro (18)
- # hugsql (2)
- # hyperfiddle (67)
- # jobs (1)
- # malli (47)
- # meander (2)
- # missionary (34)
- # off-topic (1)
- # podcasts-discuss (1)
- # polylith (24)
- # reagent (19)
- # reitit (9)
- # sci (7)
- # shadow-cljs (3)
- # testing (28)
- # tools-deps (1)
- # xtdb (9)
I am attempting to create a query that returns a list of all children grouped by their parent. The query below isn't returning results and I'm unsure what I don't understand. Is this incorrect, assuming an :entry/parent attribute exists and has the id of some parent?
query '{:find [e child-id]
:where [[e :xt/id]
(child-of e ?child)
[child? :xt/id child-id]]
:rules [[(child-of [?p] ?c)
[?c :entry/parent ?p]]
[(child-of [?p] ?c)
[?c :entry/parent ?t]
(child-of ?p ?t)]]}
that clause should also be unnecessary, just {:find [e ?child] :where [(child-of e ?child)] …}
should be enought I think
Thx @U11SJ6Q0K .. making those changes gives Index 0 out of bounds for length 0 .. which is different.
Removing the second rule returns results. I'm unsure why it would give an error so would like to understand that, but I don't need the children of children yet (which is what I think that rule is for). Eliminate that and it returns results look correct ... need to verify ofc. ... verified. Works.
@US893PCLF could you post the working query, please?
@UDQE4G9B2 https://gitlab.com/engrammicai/ixi-services/services/ixi/snippets/3602506.git That should be accessible, if not let me know.
There is likely a better way to do this (and pull those properties in one go and project them into :entry/children) but haven't discovered that yet.