5 ms·
I rather like Cypher, easy to get into with the (node)-[edge]->(node) construction, difficult in the middle (until you realise that WITH is very different to SQ
by jjgreen 7y ago
I rather like Cypher, easy to get into with the (node)-[edge]->(node) construction, difficult in the middle (until you realise that WITH is very different to SQL's), then a delight. Gremlin, so they let Java's horrible camelCase leak into their syntax? Oh my ...
- FillardMillmore 7y agoGranted, Java was one of the first programming languages I seriously learned (in university no less). The camelCase syntax became somewhat of a second nature to me, and indeed, I even internalized the idea that it simply looked better that way. I understand that syntax preferences and capitalization are mostly just preference, but are there strong arguments against the use of camelCase, or rather, in favor of something different?
- mcv 7y agoI've been using Cypher (neo4j) for a bit over a year now, and I low it. We'd need a dozen JOINs to do some of our queries in SQL, but in Cypher it's very natural to write complex relationships. Overuse of WITH does make it a bit more imperative, but also makes it easy to shape the result in the form you want it in. Cypher has been a joy to work with. Gremlin, by comparison, does not attract me at all.
- spmallette 7y agoYou write Gremlin in the programming language of your choice and with that comes the idioms of that language. For Java that means, camelCased syntax as that is what Java developers expect. So a function like hasLabel("person") looks right to them. In C#, that same function is HasLabel("person") and in Clojure it is (has-label :person) and so on. Gremlin isn't meant to be an embedded string within your programming language. It is actual code within your programming language.
- jjgreen 7y agoWell I stand corrected. I was judging from the examples in the linked article, so will have another look ...
- prashnts 7y agoIf you have any opinions on GraphQL vs Cypher, I’d really appreciate it! Context: In web app usage scenario the tooling available for GraphQL seems more popular (with react libraries) than Cypher.
- frant-hartm 7y agoCompletely different use case and purpose. Cypher is a graph query language. GraphQL is an API query language to query tree like structures (trees...), nothing to do with graphs actually.
- henryfjordan 7y agoGraphQL can be totally be used to represent and query true graphs, not just trees. The data gets materialized into nested JSON (which can be thought of as a tree) but that doesn't mean it doesn't represent a graph. Other than that though, you are quite correct, the two do not serve the same purpose. Neo4j has an extension that exposes a GraphQL API that converts the queries to Cypher (https://neo4j.com/developer/graphql/#neo4j-graphql-java https://neo4j.com/developer/graphql/#neo4j-graphql-java). I've used it for some basic things but for anything complex you need to be careful and inspect the queries it produces.
- frant-hartm 7y agoHow would you query for a path or cycle of arbitrary length in GraphQL?
- henryfjordan 7y agoYou cannot do that directly out-of-the box, but you can write your server to include directives for that. See some discussion here: https://github.com/graphql/graphql-spec/issues/91 https://github.com/graphql/graphql-spec/issues/91 Also just because you cannot query at arbitrary depths doesn't mean that GraphQL doesn't work with graphs, just that it might be a poor choice of tool for that work.
- loopz 7y agocamelCase makes sense in golang's "Go Way", as minimizing variable name within its scope is promoted. Then, using underscores makes for more difficult read (words separated). CamelCase names are exported by language semantic. So it doesn't need to be bad necessarily, if code follows the same conventions.