Discussion Forum

GraphQL (instead of REST) support for Grakn Core / Graql linked to GraphQL - to use JavaScript Frontends / Webservices

I wonder if there will be support for GraphQL ? or will the Frontends such as:
http://graphql.org/

Graph-Visualization:
http://graphalchemist.github.io/Alchemy/#/
http://www.cytoscape.org/

be supported natively?

Plus in the sense of microservices in the Frontend → Node.JS and https://www.prisma.io/
(there I am hoping that Grakn.ai will have a tutorial/ native support soon ) could be a nice combination.
Of course could also be React + Apollo (check https://www.howtographql.com/ for further details)

Here the matching image (edited to visualize my question / concept from https://www.prisma.io/):

My dream combination would be that Graql and GraphQL are mapped so there is just no difference in using them.
Any thoughts on that?

Hi @ott.lukas.14, we don’t have any such plans for now, as it’s not possible to map Graql and GraphQL symmetrically and generically. Graql contains more expressive constructs that languages like GraqphQL doesn’t. Although mapping Graql to GraphQL would be possible, it will result in a more verbose GraphQL structure. And given that GraphQL only contains more primitive data structures, Mapping GraphQL to Graql would mean you don’t use the full expressivity of Graql, as GraphQL could not represent the Graql constructs.

However, there’s nothing stopping you from creating your own GraphQL converter, but it would be a very specific application for your own use case.

1 Like

Thank you for the answer. this is why i put on my concept Grakn Core not directly to GraphQL - instead I showed a linkage to Prisma.io which obviously seems to make more sense as Graql is closer to RDFS and Linked Open Data than just a query language for evolving REST services :slight_smile:

Actually it would be easy and beneficial to provide a GraphQL API for grakn. GraphQL makes no assumption about your types. It merely allows you to drill into Graphs and return just the relations and attributes you want using a common standard. The reasons you list why GrakQL and GraphQL could not work well together are not really true. Sure GraphQL is not going to be as expressive as GrakQL but it’s not trying to be either.

1 Like