How do I to test an empty block

If some block are just created with a page name and nothing else such as [[jobs]], how do I to test it with advanced query? thank you in advance !!

I don’t fully understand your description, but try this:

 :query [:find (pull ?p [*])
     [?b :block/page ?p]
       [?o :block/page ?p]
       [?o :block/content ?c]
       [(!= ?c "")]

Thank you mentaloid. But why this codes won’t work the same as yours?

:query [:find (pull ?p [*])
     [?b :block/page ?p]
       [?o :block/page ?p]
       [?o :block/content ?c]
       [(= ?c "")]


  • Here is the meaning of:
    • your code:
                                ; (should have)
         [?o :block/page ?p]    ; (at least) one block
         [?o :block/content ?c] ; that its content
         [(= ?c "")]            ; is empty
    • my code:
       (not                     ; should have not
         [?o :block/page ?p]    ; (even) one block
         [?o :block/content ?c] ; that its content
         [(!= ?c "")]           ; is non-empty
  • Thus it is the difference between:
    • your code: “should have a block empty”
      • other ways to express the same:
        • “should have some empty block(s)”
        • “should not have only non-empty blocks”
        • “should not have all blocks non-empty”
      • Many pages contain some empty blocks.
    • my code: “should not have a block non-empty”
      • other ways to express the same:
        • “should not have any non-empty block(s)”
        • “should have only empty blocks”
        • “should have all blocks empty”
      • Few pages are totally empty.
  • Because we deal with the emptiness:
    • not of a single block with only two cases:
      • is empty
      • is non-empty
    • but of multiple blocks
      • any of them may or may not be empty, so the cases are:
        • none of them empty
        • some of them empty and some of them non-empty
          • this represents multiple cases in itself
        • all of them empty
  • Therefore, if you ask for “should have all blocks empty”, to achieve it we need three negations:
    • not have
      • the outer not( )
    • not even one
      • for datalog, one is always enough
        • it would be nice if datalog had a direct way to say “all
    • not empty
      • the != ""

Thank you so much for explaining that details. I read couple times to get with you. I have been using SQL for more than 10 years. Dadalog is quite different from it. The most cases just try and error to get to get done.