How can I have can I divide a single query (Cypher) in three distinct queries (Select part, Insert part And Update part)

时间:2021-08-02 00:49:45

I mean, instead of having a single query for a given input would give me a result, I would have three queries. (e.g query(input) = result) The first one is for choosing the result, select(input) = result The second one is for creating some elements from the result, create(result) = creation And the third one, is for updates on the "input", update(result) = updatedResult

我的意思是,不是给定输入的单个查询会给我一个结果,我会有三个查询。 (例如查询(输入)=结果)第一个用于选择结果,选择(输入)=结果第二个用于从结果创建一些元素,创建(结果)=创建而第三个用于更新在“输入”上,更新(结果)= updatedResult

My query in cypher look something like that

我在cypher中的查询看起来像那样

------Select Part-------
Match (a:Node)-[*..]-(), (b:Node), (c:Node)
Where a.name = 'John', (c)-[*]-(b) ....
-------End of Select Part------------
------Create part--------------
Create (n:Town {name:a.name+'Town'})-[:isConnected]->(....)
-------End of create part-------------
------Update part-----------
Set a.name = b.name etc....
----End of update
Return a, b, c

As this query, I would be able to divide each part in their own query, not running them all at once. How could I do that?

作为这个查询,我可以在他们自己的查询中划分每个部分,而不是一次运行它们。我怎么能这样做?

Thank you!

1 个解决方案

#1


0  

I want three queries that when processed in serie would have the same effect as the query above. I want a query that makes the select part, the with the result from that select, those results will be updated with the update query, and the create query will also use the result from the select part in order to create some items (nodes and relationships).

我想要三个在serie中处理的查询与上面的查询具有相同的效果。我想要一个查询使得选择部分,使用该选择的结果,这些结果将使用更新查询更新,并且创建查询也将使用选择部分的结果来创建一些项目(节点和关系)。

It's not a problem about web application, control at distance, but a programming problem, how can I have three queries when excecuted sequentially (select, create, update) is equivalent to the query above.

这不是Web应用程序,远程控制的问题,而是一个编程问题,如果按顺序排序(选择,创建,更新),我怎么能有三个查询等同于上面的查询。

Thanks

#1


0  

I want three queries that when processed in serie would have the same effect as the query above. I want a query that makes the select part, the with the result from that select, those results will be updated with the update query, and the create query will also use the result from the select part in order to create some items (nodes and relationships).

我想要三个在serie中处理的查询与上面的查询具有相同的效果。我想要一个查询使得选择部分,使用该选择的结果,这些结果将使用更新查询更新,并且创建查询也将使用选择部分的结果来创建一些项目(节点和关系)。

It's not a problem about web application, control at distance, but a programming problem, how can I have three queries when excecuted sequentially (select, create, update) is equivalent to the query above.

这不是Web应用程序,远程控制的问题,而是一个编程问题,如果按顺序排序(选择,创建,更新),我怎么能有三个查询等同于上面的查询。

Thanks