Hi,
New to this and practicing creating subgraphs with gds.
My simple objective is to create a subgraph of recipes that have capers and are main courses. Per the documentation I need to define id, source and target. I am not completely clear how to assign target since in this query in the browser is
MATCH (:Ingredient{name:"capers"})-[:HAS_INGREDIENT]-(a:Dish)-[:DISH_TYPE]-(b:DishType{name:"main course"}) RETURN a
Works as intended.
I have tried to assign it more or less as a dummy variable since it is required. BUT this does not work.
with a failed to load relationship with unknown target-node id 3660.
CALL gds.graph.create.cypher('caper_main',
'Match (a:Dish) RETURN id(a) as id, a.name as recipe',
'MATCH (:Ingredient{name:"capers"})-[:HAS_INGREDIENT]-(a:Dish)-[:DISH_TYPE]-(b:DishType{name:"main course"}) RETURN id(a) AS source, id(b) AS target')
Hi,
Made a tweak but not sure what I am getting. Changed the node query to 'MATCH (a) RETURN id(a) AS id'
It returns a node count of 3682 which is all the nodes in the database and 134 relationships. When I run from the browser I get 134 nodes.
CALL gds.graph.create.cypher('capers', 'MATCH (a) RETURN id(a) AS id', 'MATCH (Ingredient{name:"capers"})-[:HAS_INGREDIENT]-(a:Dish)-[:DISH_TYPE]-(b:DishType{name:"main course"}) RETURN id(a) as source, id(b) AS target')
If I do this as the node query
'MATCH (a:Dish) RETURN id(a) AS id',
I get an error which references node id 3660.
If I do:
Match (a)
WHERE id(a)=3660
RETURN a
It returns the node for DishType{name:'main course}
Is this the correct expectation of how it should work? I am confused.
Andy