Queries for task management

Hi @Siferiax Thank you for sharing so much, it’s very much appreciated. I’ve finished going through https://www.learndatalogtoday.org/ but I’m still stuck on this advanced query to find all tasks that have an ancestor with the content “routine”. I’m curious if you can help.

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
        :in $ ?s %
        :where
        [?b :block/marker ?marker]
        [(contains? #{"TODO"} ?marker)]
        ;; ancestor is true when ?ancestor is an ancestor of b
        ((ancestor ?b ?ancestor)
             [?ancestor :block/content ?str]
             [(clojure.string/includes? ?str ?s)]
            )]
:inputs
    ["routine" [[[ancestor ?b ?ancestor]
                [?b :block/parent ?ancestor]]
                [[ancestor ?b ?ancestor]
                [?child :block/parent ?ancestor]
                (ancestor ?b ?child)]]]
        }
#+END_QUERY

Do you have any tips for debugging queries or any tools that allow for deep introspection and debugging?

Thank you!

Originally posted my question here: Advanced query to get all outstanding tasks with an ancestor that contains a string

1 Like