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

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

That worked. Thank you!

1 Like