References in a page with a specific property value in their pages

I am reading a book about art history. In annotations I created references to artists and to concepts. The artists are distinguished because on their page they have the property type:: artist . Now I created a namespace like Book/artists where I want to create a special query to list all the artists that are referenced on the book, so it means all references from the book page whose pages have the property value type:: artist . How can I do this?

Another way of saying it: I want to list only the type:: artist that are being referenced in the page “my Book”.

Something like this:

#+BEGIN_QUERY
{
 :query [:find (pull ?artist [*])
   :where
     [?book :block/original-name "my Book"] ; I am reading a book
     [?b :block/page ?book]                 ; that in its annotations
     [?b :block/refs ?artist]               ; I reference artists
     [?artist :block/properties ?props]     ; which on their page have a property
     [(get ?props :type) ?type]             ; of name type
     [(= ?type "artist")]                   ; and value artist
 ]
}
#+END_QUERY
1 Like

It worked amazing, thank you very much :))