Problem detecting links to blocks in Dataview query

What I’m trying to do

Write a dataview query listing unreciprocated backlinks to the current note.

i.e. Write a query that lists all the notes that link to the current note, but excluding any notes linked to in the current note.

I have a near solution (see next section), but it doesn’t exclude notes where the current note links to a block within that note.

If, for example, the current note links to a block in the note Foo.md like this: [[Foo#^bar]], then I would not want the note Foo.md to appear in the list. But it does.

Things I have tried

The query I have been using (which works fine except in the case of block links described above) is:

LIST
FROM [[]]
WHERE !contains(this.file.outlinks, link(file.name))
SORT file.name asc

Very close.

link(file.name)file.inlinks

LIST
FROM [[]]
WHERE !contains(this.file.outlinks, file.inlinks)
.
.
.

EDIT: this isn’t quite correct, I will update

LIST
FROM [[]]
WHERE !contains(file.inlinks, this.file.link)

List all inlinks whose inlinks don’t list this file (the current file does not link to the current file’s backlinks).

Thanks. That works.

Glad to help :v:
This is my first time on the forum but I’m assuming you need to close the topic and choose the correct solution.