Advanced graph querying methods. E.g. exclude nodes connected to a specific node

I need to hide all files connected to a specific file or a file with a specific property in the graph view.

When I take notes on books I often create 1 note for the book and many (often 100s) of notes or blocks for different “concepts” in the book I found interesting. I make sure the all my “concept” notes are connected to the “book_name” note. So for example if I’m reading “Thinking fast and slow” I would create a page “Book/Thinking Fast and” where I would review and summarize the book. I would also have many floating pages like “Lizard brain”, “System 1” and “Anchoring” all linking to the book’s page.

The problem is that when I switch to graph view the huge number of “concept” nodes drown everything else, for example my work related notes. I can’t filter them out, because the only thing that’s particular about them is that they are all connected to a specific book. Besides that they are like my regular notes, they sit in a general folder and are not different than my daily notes or work or personal notes.

Is it possible to query against Logseq graph directly using any of the graph languages like SPARQL? If so I can see 2 types of queries I can use:

  1. I can exclude nodes based on explicit connection, e.g. “return all ?node where a node is not connected to [node_1, node_2 … node_n]”. [node_1, node_2 … node_n] is a list of my book_name files.
  2. I can exclude nodes based on an attribute (e.g. tag) of the book_name file. E.g. “return all ?node where a node is not connected to tag=”#book".

Is something like this possible with logseq or any of its plugins?