Struggling with a Datalog query that attempts to "join" two block "types"

I am trying to figure out what’s up with this query:

{:title “tasks”
:query [:find (pull ?b [*])
:in $
[task ?b “LATER”]
[page-ref ?b “task :construction:”]
(not [page-ref ?b “:brain: nexos”])
[?b :block/properties ?props]
[(get-else $ (get ?props :atom) :status “parked :arrow_down:︎”) ?status]
[(= “in progress :recycle:︎” ?status)]

Essentially, I have some block property structures that I attach to specific blocks. “Atoms” represent things from Tiago Forte’s PARA method. For example, you might have a Project, and Project atoms have a status property. “Tasks”, which are just standard Logseq tasks, are linked to Projects via their “atom” property.

So this query is looking at all of my tasks, and trying to filter to it to those related to Projects that are currently “in progress :recycle:︎”.

While there are currently dozens of these in my graph, the query returns nothing.

Any help would be greatly appreciated!

Unsure what this is suppose to do?

Right now, as far as I understand it you get tasks that are LATER. And that have a page reference task :construction:. But not a page ref :brain: nexos.
That block has proporties and you put that in the ?status variable which should be equal to in progress :recycle:.

As I understand it, the get-else clause is trying to fetch the block that is referenced by this task’s :atom property. It then returns the :status property value for THAT block, and if it doesn’t have a :status property, it returns “parked :arrow_down:︎”.

That return value is placed in the ?status variable.

Otherwise what you’re saying is correct, yes.

Alright. Unsure if that works though.
Do you have example data? Then I might try to figure out what doesn’t work and how to fix that :slight_smile:

Sure. Let me put something together.