Find all TODOs without a namespace on the block

I have TODOs throughout my graph and I usually try and assign each one to a namespace.

What I would like to do is have a query that finds all the TODOs that do not have a namespace on the TODO block.

Maybe try with this one, previously shared by @Siferiax in Cleaning Up a Messy Graph - Questions & Help - Logseq

{:title [:b "Tasks without tag"]
 :query [:find (pull ?b [*])
   [?b :block/marker ?mark]
   [(contains? #{"TODO" "LATER"} ?mark)]
   [?m :block/original-name ?mark]
     [?b :block/refs ?r]
     [(!= ?m ?r)]
   [?b :block/page ?p]
   [?p :block/journal? true]
 :breadcrumb-show? false
1 Like

That worked. Thank you!

1 Like