Creating a named graph from the main Neo4j Graph is documented. Beside, one also knows how to list, drop, check if a named graph already exists, e.g. CALL gds.graph.exists('my-store-graph') YIELD exists;
However, I wonder if there is any method for cypher-query against the just created named graph?
One workaround is to push this named graph into an offline/empty Neo4j Graph, i.e. CALL gds.beta.graph.export('my-graph', { dbName: 'mydatabase' })
. However, this method is less convenient because we often want to check if the named graph is projected correcly before applying, e.g. PageRank on it. And the projection can be a trial-and-error cycle.
There is currently no other way of querying the named graph other than the workaround you already found.
However, there are additional functions, e.g. gds.util.nodeProperty
that allow you to access a node property in the named graph without writing it back to Neo4j. An example for querying a score
property could look like this:
CALL gds.graph.create('my-graph', 'User', 'LINK');
CALL gds.pageRank.mutate('my-graph', { mutateProperty: 'score' });
MATCH (user:User)
WHERE user.name = 'Alice'
RETURN
user.name AS name,
gds.util.nodeProperty('my-graph', id(user), 'score') AS score
Could you maybe elaborate why your projections are "trial-and-error" cycles. Maybe an option is to run your validation queries on the subgraph you want to project?