I am new to neo4j and the graph I'm shaping will be used by third party applications for some fixed (cypher) queries - we can think about the classical "Who is friend of Alice?" question.
I'd like these queries to be easily requested from the other applications - that can be developed in different languages - while not having them reimplement each query nor putting too many layers between the client application and the neo4j engine (that to me would slow down responses).
These questions are, of course, totally answered by Cypher queries or anyway using only resources from the neo4j database itself.
So the graph should act as a service to other applications: what is the best way to provide such functionality? I'm aiming at two goals: a) centralize query contents; b) minimize layers overhead.
A couple of solution ideas came to mind:
- Add a service layer in front of the graph database, written in one language, that clients may send request to
So the path would be client (i.e. Node.js) -> (Rest perhaps?) -> service layer (Python?) -> Cypher (over Bolt) -> neo4j
- neo4j UDF: so client (i.e. Node.js) -> function over Bolt -> neo4j
I didn't understand whether these would perform similar to native functions
- Client (i.e. Node.js) --> Cypher over Bol -> neo4j
Of course this would duplicate query logic in each client and potentially generate errors
- Other options I haven't found / thought about?
If this was an SQL database, I'd have writted stored functions for everything and clients could just do
SELECT fx(data) - but this being neo4j, I'd like to hear some advices.
Solution #2 seems to be the best for me - I don't care if that leaves clients the chance to issue other queries; maybe I can block them with permissions. Of course if another graph database offers today better support for my needs, I'll evaluate that too.