Filter for notes that have a…
Link to the current file:
file.hasLink(this)
Link to a link to the current file:
file.links.filter(value.asFile().hasLink(this))
Third-degree link to the current file:
file.links.filter(value.asFile().links.filter(value.asFile().hasLink(this)))
Fourth-degree link to the current file:
file.links.filter(value.asFile().links.filter(value.asFile().links.filter(value.asFile().hasLink(this))))