Stream: implementers
Topic: GraphQL vs CQL
Simone Heckmann (Dec 06 2017 at 09:23):
Can someone help me sorting GraphQL and CQL?
What's the difference? Which is better and why? Are the use cases the same?
Which one should I prefer... etc.
All insights are appreciated...
Ewout Kramer (Dec 06 2017 at 14:01):
Hi Simone, from my point of view, they cover totally different usecases.
GraphQL is good at collecting a coherent set of resources by traversing across resource references thus compiling a graph, which can then be turned into a search result, document etc, as a collection of resources. Since it is focused on walking graphs, it has limited capabilities to do queries. It was designed for the Facebook API and allows you to compose, in one fetch, a set of related records and properties in those records to be able to populate your UI. E.g. this would fetch from a "table" hero the heroes name, then traverse to his friends, and fetch the name of the heroes friends:
{ hero { name friends { name } } }
CQL is human-readable query language to define quality measures and decision support rules. It focuses on defining criteria for concepts in these quality measures, formulated as a query. E.g.:
define "Encounters with overlapping Warfarin and Parenteral Therapies" = from "Encounters" E, "Warfarin Therapy" W, "Parenteral Therapy" P where W. whenGiven starts during E. period and P.whenGiven starts during E. period and duration in days of (W.whenGiven intersect P.whenGiven) 5
Simone Heckmann (Dec 07 2017 at 20:01):
Thanks for the clarification, @Ewout Kramer
I got confused with all the ...QLs floating around :)
Last updated: Apr 12 2022 at 19:14 UTC