Setting Up a Graph Service
We can do graph management of our Neo4j instance using Cypher queries over Bolt.Sips to add and delete graphs. But we’d ideally like to bring this under our common graph services API so we can operate at a higher level of abstraction, which will make for less context switching when swapping between graph services.
Let’s set up a graph service for our PropertyGraph project now:
| defmodule PropertyGraph.Service do |
| @behaviour GraphCommons.Service |
| |
| # ... |
| |
| end |
Note that this module is going to implement the GraphCommons.Service behaviour so we use the module attribute @behaviour.
Graph API
We’ll first need to set up our Cypher queries for deleting all nodes and relationships and for reading them:
Get Exploring Graphs with Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.