Hacker News new | ask | show | jobs
by lexx 1502 days ago
I am also considering woriking with Neo4j for a project.

I am wondering why not build on top of their Http Api? You can send multiple Cypher statements over Http and correct me if I am totally wrong, but "stealing" the concept of graphql's persistent queries, you could make use of http caching also.

I would love read your thought's on that

1 comments

Just to make the conversation easier the use case I have is a network topology so you have things like routers, switches, ports etc. If you take it all the way up to Layer 7 (Application) you can have say web services etc. So you could in theory say link X was cut what is affected?

Anyways... my basic POC was exposing endpoints so I can do things like.

/devices/list /network/shortestPath?node1=<>&node2=<>

to get a list of all devices but I'm basically just writing custom Cipher code to do that query and the benefits of Neo4J basically go out the door. It still has some interesting Graph features but if all i'm doing is writing a custom endpoint for every use case it's mainly pointless.

You can do a simple POST statement which takes a Neo4J query and execute it with some caching on top of it for sure.

Either ways in order to make Neo4J worth it I need a way to make the queries more dynamic. So right now I'm thinking of:

- restQL http://restql.b2w.io/ - GraphQL https://graphql.org/

Or just having a dumb POST /custom/query that maybe only supports read operations. You can add a layer of auth but I'm not a big fan of just having some endpoint that's basically a Pipe to Neo4j. It feels just as bad as saying, typing any SQL here and we'll execute it on the server. If people know what they're doing that's fine..but at that point just setup phpMyAdmin/ pgAdmin. At that point you're trusting folks to know what they're doing and if folks accidently drop Bobby Tables (https://xkcd.com/327/) then it's an accepted risk.

If you just have a proxy to run any Cipher query, you might as well just provide users on Neo4J web instance and let them play there.

Anyways, still in early stages trying to figure out how to best leverage Neo4J

You could give a POST /custom/query with only read capabilities. Also you can give some custom "helper" operations along. And certainly you could give them some option to prettify the response. Because one thing is to query the correct things, another whole thing is how to structure the response according to your needs.

I didn't know Restql. thanks for the link

Yeah this was years ago but we had concept of 'hydrated' objects so you'd pass a flag to get back shallow object or the hydrated version that had all the relationship loaded as well.

Some flags for helpers that fetch additional data would be good.

btw restql seems dead