Query all linked references that are not already on the page

Im looking for a query syntax for all the linked references that are not already on the page.

Use Case:
I would like to have a query on my Maps of Content-Page (e.g. western philosophy) that shows all the unprocessed linked references (= all the backlinks that are not already used on the page western philosophy)

I’m failing to make sense of your description. Could you provide specific examples for:

  • a “processed linked reference”
  • an “unprocessed linked reference”

Shure, @mentaloid :

For Example: On the Page “Aristotle” there is a link to the Page “western philosophy”.
Now “Aristotle” shows up as linked reference on the “western philosophy”-Page…

I’m looking for a query that shows me all the linked references that are not already on the “western philosophy”-page directly: The query should exclude “Aristotle”, as soon I use it on the “western philosophy”-Page → e.g. “[[Aristotle]] was an Ancient Greek philosopher”

This query would be useful for me, because in my workflow I try to re-order all the linked references of a Map of Content (e.g. “western philosophy”). The query should show all the linked reference that are not already integrated in the MOC/Structure Note

Something like this:

{:inputs [:current-page]            ; name of moc page, e.g. current page
 :query [:find (pull ?p [*])        ; pages found
   :in $ ?moc-name                  ; above name of moc page
     [?moc-p :block/name ?moc-name] ; moc page of the above name
     [?p-b :block/refs ?moc-p]      ; linked/referred by any block
     [?p-b :block/page ?p]          ; inside any pages
     (not                           ; which are not
       [?moc-b :block/refs ?p]      ; already referred by any block
       [?moc-b :block/page ?moc-p]  ; inside the above moc page

Thanks for your answer @mentaloid !
Since I’m a beginner with queries, I have no idea how to use this. Could you give me any hints?

You copy the query as plain text in a block on your western philosophy page.
It will then give you your results when you go out of edit mode.

1 Like

I would suggest you to watch some videos on advanced queries (e.g. this one).

1 Like

Thanks for your help!