November 2022
Intermediate to advanced
294 pages
5h 58m
English
In this section, we’re going to use Gremlin to query over the book graph we’ve been using as our reference graph. We’ll also see how that differs from the other query languages we’ve seen.
As Gremlin models a property graph, we can expect our graph model to be pretty much the same as the one we modeled earlier with Cypher—see Modeling the Book Graph, for a reminder of how that looked.
We can simply create our book graph in Gremlin, using the addVertex and addEdge steps on our graph instance and listing out the properties on both nodes and edges:
| | // Book 1 |
| | adopting_elixir = graph.addVertex(label, 'Book', |
| | 'id', 'adopting_elixir', |
| | 'date', '2018-03-14', |
| | 'format', 'Paper', |
| | 'isbn', '978-1-68050-252-7', |
| | 'title', ... |
Read now
Unlock full access