Help in creating a task query for children blocks under specific parent block

Hello, I am using logseq to (among other things) process academic papers in my reading list. The way I mark the process is by creating a block in the paper page with a TODO marker and the text “Preparation” and I have under it two child blacks “[[Highlighting]]” and “[[Note Structuring]]”.
image
I want to create a query to find all papers that are e.g. done with the Highlighting but the Note Structuring is “TODO” or “DOING”. I am very new to Datalog and I tried to create something on my own but without any success, any help would be much appreciated.

1 Like

Something like this:

#+BEGIN_QUERY
{:inputs [:today]
 :query [:find (pull ?b [*])
   :in $ ?today
   :where
     [?highlighting :block/original-name "Highlighting"]
     [?structuring :block/original-name "Note structuring"]
     [?c1 :block/refs ?highlighting]
     [?c1 :block/marker ?marker1]
     [(contains? #{"DONE"} ?marker1)]
     [?c1 :block/parent ?b]
     [?c2 :block/parent ?b]
     [?c2 :block/refs ?structuring]
     [?c2 :block/marker ?marker2]
     [(contains? #{"TODO" or "DOING"} ?marker2)]
 ]
}
#+END_QUERY