Hi there, i am new to advanced queries in Logseq.
I found your hint for queries in namespaces and tried to apply it to my own example, but get no results.
This is my example. I try to get a query that shows the two tasks in the sub-pages of the namespace.
This goes from relatively simple to relatively complex pretty fast.
First of :block/refs doesnāt get what you need.
Also you want the block on the page and not the parent of the block, though in this case that is the same, but if your task is under a parent block you wonāt retrieve it.
Next getting a namespace is only 1 level deep, and hereās where the complexity comes from.
Iām going to assume you donāt want that to be static
So I use rules to create a recursive search to find all pages under project, no matter their dept.
Hereās the query I created:
Perfect! It works!
Now I really can draw the Power of Logseq for my purposes.
Thanks, mighty wizard.
I do not understand the magic yet, but can use it and am eager to learn more.
When i put āprojectā (or the final target string) in lowercase letters, it works as intentioned.
Next iāll try to filter on tasks with priority āAā.
Maybe i can do it without help from a magician.
Dear Siferiax, I do not want to be greedy but could you extend your helpful Query so that it Filters Namespace + Tasks + Priority āAā
As a beginner i still struggle a little with learning datalog.
Yes. :block/name is always lowercase. I forgot to mention, I generally add that for clarity!
Pages have 2 names, one is lowercase and stored in the attribute :block/name and the other is their original name case stored in :block/original-name.
I generally use :block/name so we donāt have to think how exactly we wrote the name of a page
For filtering priority we have the attribute :block/priority
So we will need to add the line: [?b :block/priority "A"] to the query.
Alternatively we can do this the same way as we did for the task itself.
Hi there @Siferiax , many thanks for the solution⦠its nearly perfect.
If you allow one last question:
Sometimes i would also note some tasks in the root layer of a namespace (āproject/ā¦ā).
Is it possible to include these tasks with priority into the query results?
Someone should develop a GPT based AI that can transform natural language queries into advanced logseq queries! I wonder if anyone is thinking about this?
Hi there,
i already found the great Query-Builder-Tool from adxsoft
but couldnāt figure out how to build a recursive query for the namespaces like the one @Siferiax provided. Maybe its just a matter of time learning the nuances of datalog.
For now the hints from Siferiax provides a very powerful solution for project management in Logseq.
But now Iām trying the following as the inverse - i.e. find all todos that donāt have any project tags, but itās finding no results (despite the fact that Iāve created some test todos without project tags). Any idea how I can fix this? Thanks very much in advance!