No :block/properties - bug or my fault?

Hi,

I’m quite fresh Logseq user so my problem can be a result of the lack of knowledge, anyway - I have recently noticed that only part of my Tasks is filtered in queries I made (I have separate queries for my own and delegated tasks for which I use property owner:: ).
Searching for possible reasons I found that some of my Tasks has no :block/properties section in block data - you can find an example below:

{:block/uuid #uuid "67bb00ed-5a0b-4b99-a74e-30d37c93af7c",
 :block/left {:db/id 127},
 :block/refs [{:db/id 4}],
 :block/scheduled 20250224,
 :block/format :markdown,
 :block/content
 "TODO some task to be done \nSCHEDULED: <2025-02-24 Mon>",
 :db/id 126,
 :block/path-refs [{:db/id 4} {:db/id 115}],
 :block/parent {:db/id 120},
 :block/page {:db/id 115}, 
 :block/marker "TODO"}

Editing that kind of task (pressing enter between task and scheduled date) resolves problem (:block/properties {} appears in block data).

  1. Is there any specific reason for such a behaviour (I mean my fault) or can that be kind of bug (I’m not able to reproduce that)?
  2. How can I find tasks with that missing (in my opinion) :block/properties section ?

Thanks

1 Like

Welcome.

  • Try a query based on this one:
    #+BEGIN_QUERY
    {
     :query [:find (pull ?b [*])
       :where
         [?b :block/marker]
         (not [?b :block/properties])
     ]
    }
    #+END_QUERY
    
  • It is not clear when :block/properties should be missing instead of empty.
  • If you share your queries, we can possibly adjust them to cover all cases.

Hi,

Your query works fine, thank you.

I assumed that :block/properties should be an element of each block so I’m filtering block based on the following queries:
Delegated

 :query [:find (pull ?b [*])
		  :where
		  (or 
 		     [?b :block/scheduled ?d] 
 		     [?b :block/deadline ?d]
          ) 
          [?b :block/marker ?marker]
		  [(contains? #{"NOW" "LATER"  "TODO" "DOING" "WAITING"} ?marker)]
		  [?b :block/properties ?prop]
		  [(get ?prop :owner)]
		  ]

and my own (in this case today’s tasks) where I don’t use owner:: property:

:query [:find (pull ?block [*]) 
 		              :in $ ?today 
 		              :where 
 		              (or 
 		                   [?block :block/scheduled ?d] 
 		                   [?block :block/deadline ?d]
                       ) 
 		               [?block :block/marker ?marker]  
 		               [(contains? #{"NOW" "LATER"  "TODO" "DOING" "WAITING"} ?marker)]
                       [?block  :block/properties ?props]
                       (not [(get ?props :owner)])
                       [(= ?d ?today)]] 

Thanks

This one should be as simple as moving :block/properties inside (not ...) , i.e.:

(not
  [?block :block/properties ?props]
  [(get ?props :owner)]
)
1 Like

Hi,

Definitely I need to practice queries syntax much more…
Just one tweak makes it all works fine.

With your simple solution it is not important if :block/properties section exists or not - but just to satisfy my curiosity: are there any “rules” when logseq inserts empty :block/properties or doesn’t insert it at all?

Thanks a lot !

1 Like

That’s characteristic of Datalog. Small (and often accidental) modifications cause big (and often frustrating) differences.

Only the codebase.

1 Like