So after you can change the 0 by the componentId you want:
MATCH (n)
WHERE n.componentId = 0
WITH collect(n) AS nodes
CALL apoc.refactor.cloneSubgraph(nodes)
YIELD input, output, error
RETURN input, output, error;
If you know which nodes you want to duplicates, you can change the WHERE clause in the previous query to select only the nodes you want.
Hey Cobra, thank you for your answers!
I only have the apoc library my version of neo4j is 3.5.30
so I tried to create a new graph, a simple one that looks loke this:
MATCH (n)
WHERE n.name = "Graph1" AND WHERE ID(type) ="CellType"
AND WHERE ID(type)="Function" AND WHERE ID(type) = "cellInstance" And WHERE ID(type) ="Connection"
AND WHERE ID(type) = "Variable"
WITH collect(n) AS nodes
CALL apoc.refactor.cloneSubgraph(nodes,[rel in relationships Where type(rel) = âFrom_Graphâ AND Where type(rel) =âFROM_TYPEâ Where type(rel) = âCELL_TYPE_FUNCTIONâ AND Where type(rel) = âFROM_CELLâ AND Where type(rel) = âFUNCTION_INPUT_VARIABLEâ AND Where type(rel)= âTO_CELLâ,AND Where type(rel) = âFunctions_VARSâ ])
YIELD input, output, error
RETURN input, output, error;
still doesn't work for me :(
any suggestions?
Isn't there any other way to do it with this query you offered and use apoc only?
MATCH (n)
WHERE n.name = "Graph1"
WITH collect(n) AS nodes
CALL apoc.refactor.cloneSubgraph(nodes)
YIELD input, output, error
RETURN input, output, error;
Ok, so i'll try to upgrade it and use the queries you offered. i'll let you know if I succeeded
Cobra thank you so much for trying to help me I really
appriciate it.
have a lovely weekend!