Matt,

GraphQL/Falcor are absolutely QBE languages.

Satisfying GraphQL queries directly from a TP3 graph without having to
write all of the binding logic would be useful.  Satisfying these queries
is way too tedious right now.

Here is one example of a way TP3 could help (there are others):

Suppose I have two domain objects and a simple in-memory map of both based
on ID for my data store:

data class Person(val id: Int, val name: String, val livesAt: Address)
data class Address(val id: Int, val street: String, val city: String)

This query is easy to satisfy with one index lookup, because Person already
has a pointer to Address:

{ person(id: 123) { name, addressLivesAt { street, city } } }

The reverse requires an index lookup and a linear scan of all Persons to
find the matching Address:

{ address(id: 456) { street,
city, personLivesAt { name } } }

Of course we could augment our data model as follows:

data class Address(val id: Int, val street: String, val city: String, *val
livesAt: Person*)

Or we could store a separate Map<Address, Person> and cheapen the lookup
somewhat.  Either way, we have to manage this separately.  If both models
are stored in a graph, e.g...

( Person ) --- livesAt ---> ( Address )

... then both queries are satisfiable with a single index lookup and
index-free adjacency.  Also, there is no need to alter the structure of
Addresses to answer a new query.

Jon



On Sat, Oct 10, 2015 at 11:50 AM Matt Frantz <[email protected]>
wrote:

> I would love to understand the relationship between GraphQL and TinkerPop,
> and to participate in any calls that happen.  I watched a video back when
> GraphQL was announced and discussed briefly on this list.  I don't
> understand exactly why they call this "Graph Query Language", as it seems
> like a Query-By-Example (QBE) language, i.e. here's the structure of the
> result I expect.  The GraphQL data model seems to be hierarchical, and thus
> not necessarily well-suited to general graph queries.  It made me curious
> about "graph literals", and whether there was a similarly terse syntax for
> indicating the schema of a graph.  GraphQL feels like JSON without any
> values, i.e. keys only.  That's only an approximation, but the ability to
> specify a graph schema by value-erasure of a graph literal is appealing.
>
> On Sat, Oct 10, 2015 at 10:12 AM, Marko Rodriguez <[email protected]>
> wrote:
>
> > Hello TinkerPoppers,
> >
> > Please see this:
> >         https://facebook.github.io/relay/docs/thinking-in-graphql.html
> >
> > GraphQL seems to be popping up more and more. It would be great if
> someone
> > in their community built a compiler to Gremlin's instruction set so that
> > GraphQL (like Kupptiz's SPARQL-Gremlin) worked over TinkerPop-enabled
> graph
> > systems. Does anyone have any insights into how the GraphQL community
> > functions and who to talk to to try and get some collaboration between
> > TinkerPop and GraphQL?
> >
> > Thanks,
> > Marko.
> >
> > http://markorodriguez.com
> >
> >
>

Reply via email to