2

it would be appreciated to if anyone can answer that is there any way to add an LOOP function to cypher? i can find loops in graph by use of traversal. but i want to know is there anyway to pass obtained result to a customized user defined Cypher function?

mehdi
  • 912
  • 7
  • 20
  • 1
    It's possible that what you are trying to accomplish can be done in Cypher without a `LOOP` function. You may want to post a new question with the problem you are trying to solve. – cybersam Nov 22 '17 at 18:58

3 Answers3

2

Not yet. They're talking about UDFs (User Defined Functions) in an upcoming release of Neo4j, though. You might consider refining your use case and asking for it as a feature of Cypher itself in github issues, as well.

Eve Freeman
  • 32,467
  • 4
  • 86
  • 101
1

Until UDFs are possible with Cypher, you might consider using unmanaged extensions.

Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
0

It seems that you are asking two different questions.

About whether you can use loops in Cypher, yes you can, with FOREACH or UNWIND, depending on what you want to achieve. This is a good resource for when you don't quite know which is the right one for your case. It compares the two and tries them with different example queries.

As for whether you can write user defined function, as of Neo4j 3.0, you can. They are however written in Java. Look into this link for more details: https://neo4j.com/developer/procedures-functions/

Antimony
  • 2,230
  • 3
  • 28
  • 38