operationalizing GraphQL queries

47 views
Skip to first unread message

AdrianP

unread,
Jun 7, 2022, 12:25:47 PM6/7/22
to TopBraid Suite Users
We're working to more formally adopt GraphQL as a way to consume data from EDG for various integration reasons.

I see a way in the GraphiQL UI to save a named query but is there a way to call saved queries by name? And pass in parameters?

When I look 'under the hood' (using the browser's dev tools) at the request that is being made when I execute a saved query it is just running the query itself. This has disadvantages, like having to spread the query across multiple consuming clients such that if something changes the updates need to happen in multiple places. Making a single change to the saved query that is being called by name by the consuming clients is preferred (assuming the contract isn't changing in a breaking way).

This is a similar paradigm to a stored proc in the relational database world.

An added nice feature would be the ability to automate deployments of saved queries.  Is that possible?

thx...
Adrian Pfisterer.

Holger Knublauch

unread,
Jun 8, 2022, 11:23:41 PM6/8/22
to topbrai...@googlegroups.com

Hi Adrian,

the GraphQL servlet itself doesn't have a way to invoke saved queries instead. So you could potentially develop your own way of managing/storing/sharing your queries either in EDG itself (e.g. in some Data Graph) or store them outside in your client applications.

If you want to "hide" the details of GraphQL queries, you could turn them into ADS JavaScript and wrap those scripts into web services. ADS includes a function graph.ql() that can be used to invoke a GraphQL query including parameter passing:

graph.ql(`{ cities { uri } }`)

Such web services could, of course, also query the available GraphQL queries from a graph, including the TCH graphs where the current instances of <http://teamwork.topbraidlive.org/graphql.search#rawGQLQuery> are stored when you press the save query button.

Maybe this gives you some ideas?

Holger
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/25e48173-21fd-485a-b4cb-0dfa7b9c3a8en%40googlegroups.com.

AdrianP

unread,
Jun 21, 2022, 12:20:52 PM6/21/22
to TopBraid Suite Users
Thanks, Holger.  Yes, this gives me some ideas.  I think I can get where I need to go.

Adrian.

Reply all
Reply to author
Forward
0 new messages