Exclude aliases in advanced queries

Hello,

I have a query that lists all pages that have been linked from some place, but dont have properties defined.
This helps me know which pages to complete.

{:title "Pages without properties"
:query [:find (pull ?p [*])
         :where
         [_ :block/path-refs ?p]
         [?p :block/journal? false]
         [(missing? $ ?p :block/properties)]
]
}

If I have an alias “Zelda” on the page “The Legend of Zelda”, it will appear on the list, even if the original page “The Legend of Zelda” already has properties.

How can I exclude aliases from this list ?

Welcome. Could try filtering on :block/alias .

Thank you.

For those who need this, the answer is a bit counter-intuitive : pages that have a “block/alias” attribute are aliases themselves. Meanwhile, the original page does not have this attribute.

The modified query is then :

#+BEGIN_QUERY
{:title "Pages without properties"
:query [:find (pull ?p [*])
         :where
         [_ :block/path-refs ?p]
         [?p :block/journal? false]
         [(missing? $ ?p :block/properties)]
         [(missing? $ ?p :block/alias)]
]
}

Yes. If it helps you should read it as I (?p) am an alias of this page.
I agree it is counter intuitive.