(no title)
TheMakeA | 10 years ago
In an attempt to help resolve this issue, I suggest that you think of it as ProductQL or ProductAPI instead.
It's not a storage layer. It's not really a query language. It's an alternative way to define an API that more closely matches the typical mental and product domains than REST.
It's critical to realize that you're implementing an API. GraphQL does not concern itself with sorting or fetching data as the name might lead you to initially believe. It has little to actually do with graphs (except they are more easily expressed). It is designed to be added on top of your application layer and business logic to provide a single, well defined API for your product and tools.
It primarily targets product developers. From the scheme/API side, it is up to the server developer to decide what to expose and how, based on the product and any technical considerations that need to be made.
dwenzek|10 years ago
Compared to SQL, this is done using an unusual manner, giving a shape of the data we want around some seed, but the approach is both expressive and efficient. In light of this query principle, it is perhaps unfortunate that GraphQL use a different syntax for the query and the response. To this regard, freebase's MQL is more pure (http://wiki.freebase.com/wiki/MQL).
About graph, I think the term applies too. Indeed, a GraphQL defines a subgraph to be extracted from a whole graph, even if the tree shape of the response forces to resort to ids to tie the loop.
Compared to a graph traversal query language like Gremlin (https://en.wikipedia.org/wiki/Gremlin_%28programming_languag...), I find the pattern approach of GraphQL simpler to grasp; and even easier to implement efficiently in a distributed setting. I implemented years ago a distributed graph database for Yahoo!; and the query language, based on shapes to be extracted around seeds, was a key design choice for an efficient architecture and short query delays.
TheMakeA|10 years ago
cbsmith|10 years ago
devit|10 years ago
You start with a root query object and then call a bunch of methods on it of the client's choice and put the results in a dictionary.
Then you do that recursively on the resulting objects until you have data consisting of nested dictionaries and lists containing only primitives, which is finally serialized as JSON and returned.
andy_ppp|10 years ago
1) Give me data in the right shape for my problem please server.
2) Server responds with data in a shape that matches what it was asked for.
3) Update the store of your frontend and trigger any updates to UI (react does this automatically).
Save countless hours of writing fine grained rest APIs to support various different ways of requesting data or munging data into the right format on the client.
And by the way we've made it super easy to bundle requests together in a nice way saving trips to the server.
adriancooney|10 years ago
TheMakeA|10 years ago
For sure. If I could still edit the post, I would probably change it to be something closer to "it's not really a general purpose query language like the name might imply"
It's definitely a query language, but folks start looking for the sorting/filtering/etc and get confused.
unknown|10 years ago
[deleted]
Amrinder12345|10 years ago
eggie|10 years ago
berntb|10 years ago
[deleted]