Select blocks either without marker or with marker != DONE

I need to select blocks that are either:

  1. not using any marker
  2. or they’re using marker and this marker is not DONE

I try this query:

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
         :where
         (or-join
           (and
             [?b :block/marker ?marker]
             [(not= ?marker "DONE")])
           (not [?b :block/marker]))
]}
#+END_QUERY

but it results to an error:

Cannot parse var, expected symbol starting with ?, got: and

Many errors in that one. Datalog queries should be built step-by-step, checking after each step that they are still valid. Here is one without errors:

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
   :where
     [?b :block/uuid]
     (or-join [?b]
       (and
         [?b :block/marker ?marker]
         (not [(= ?marker "DONE")])
       )
       (not [?b :block/marker])
     )
]}
#+END_QUERY

Could also use this line:

         [(!= ?marker "DONE")]