Exploring Graphs with Elixir
Connect Data with Native Graph Libraries and Graph Databases
by Tony Hammond
Data is everywhere—it’s just not very well connected, which makes it
super hard to relate dataset to dataset. Using graphs as the underlying
glue, you can readily join data together and create navigation paths
across diverse sets of data. Add Elixir, with its awesome power of
concurrency, and you’ll soon be mastering data networks. Learn how
different graph models can be accessed and used from within Elixir and
how you can build a robust semantics overlay on top of graph data
structures. We’ll start from the basics and examine the main graph
paradigms. Get ready to embrace the world of connected data!
Printed in full color.
Graphs provide an intuitive and highly flexible means for organizing and
querying huge amounts of loosely coupled data items. These data
networks, or graphs in math speak, are typically stored and queried
using graph databases. Elixir, with its noted support for fault
tolerance and concurrency, stands out as a language eminently suited to
processing sparsely connected and distributed datasets.
Using Elixir and graph-aware packages in the Elixir ecosystem, you’ll
easily be able to fit your data to graphs and networks, and gain new
information insights. Build a testbed app for comparing native graph
data with external graph databases. Develop a set of applications under
a single umbrella app to drill down into graph structures. Build graph
models in Elixir, and query graph databases of various stripes—using
Cypher and Gremlin with property graphs and SPARQL with RDF graphs.
Transform data from one graph modeling regime to another. Understand why
property graphs are especially good at graph traversal
problems, while RDF graphs shine at integrating different semantic
models and can scale up to web proportions.
Harness the outstanding power of concurrent processing in Elixir to work
with distributed graph datasets and manage data at scale.
What You Need
To follow along with the book, you should have Elixir 1.10+ installed.
The book will guide you through setting up an umbrella application for a
graph testbed using a variety of graph databases for which Java SDK 8+
is generally required. Instructions for installing the graph databases
are given in an appendix.
Resources
Releases:
2022/11/08
P1.0
First printing.
2022/08/30
B6.0
*Reworked two sections in Chapter 7, Graphing Globally with
RDF.
*Replaced use case in Chapter 8, Querying
RDF with
SPARQL.
*Simplified worked example in Chapter 11, Transforming Graph Models.
*Added Appendix 1, Project Setups.
*Added Appendix 2, Database Setups.
*Added Appendix 3, Graph Anatomy.
*Addressed errata.
*Added complete project code listing.
*Content-complete and headed to production
2021/09/13
B5.0
*Added Chapter 12, Processing the Graph.
*Addressed errata.
2021/07/15
B4.0
*Added Chapter 11, Transforming Graph Models.
*Addressed errata.
- Preface

- Graphs Everywhere
- Engaging with Graphs
excerpt
- First Contact
- Coding a Hello World Graph
- Modeling a Book Graph
- Our Plan of Action
- Wrapping Up
- Getting Started
- General Project Outline
- Creating the Umbrella and Child Projects
- Packaging Graphs and Queries
- Building a Graph Store
- Defining a Graph Service API
- Wrapping Up
- Getting to Grips with Graphs
- Managing Graphs Natively with Elixir
- Creating the NativeGraph Project
- Basic Workout
- Storing Graphs in the Graph Store
- Visualizing Graphs
- Wrapping Up
- Exploring Graph Structures
- A Worked Example
- Modeling the Book Graph
- Generating Graphs
- Wrapping Up
- Navigating Graphs with Neo4j
extract
- Property Graph Model
- Creating the PropertyGraph Project
- Querying with Cypher and APOC
- Trying Out the Bolt Driver
- Setting Up a Graph Service
- Wrapping Up
- Querying Neo4j with Cypher
- Getting Started with Cypher
- Modeling the Book Graph
- Recalling the ARPANET
- Passing Parameters to Queries
- Schemas and Types in Cypher
- Wrapping Up
- Graphing Globally with RDF
excerpt
- What’s Different About RDF?
- RDF Model
- Creating the RDFGraph Project
- Modeling the Book Graph
- Building an RDF Graph
- Setting Up a Graph Service
- Wrapping Up
- Querying RDF with SPARQL
- Getting Started with SPARQL
- Querying the Local RDF Service
- Case #1: Tokyo Metro
- Querying a Remote RDF Service
- Case #2: Graph Walk (Querying)
- Browsing Linked Data
- Case #3: Graph Walk (Browsing)
- Wrapping Up
- Traversing Graphs with Gremlin
- Using Gremlin
- Creating the TinkerGraph Project
- Querying with Gremlin
- Setting Up a Graph Service
- Creating the Book Graph
- Wrapping Up
- Delivering Data with Dgraph
- GraphQL and DQL
- Dgraph Model
- Creating the DGraph Project
- Setting Up a Graph Service
- Modeling the Book Graph
- Reaching Back to the ARPANET
- Wrapping Up
- Graph to Graph
- Transforming Graph Models
- Serializing Graphs
- Importing RDF with n10s—A Neo4j Plugin
- A Graph-to-Graph Example
- Stage 1: Getting RDF into an LPG Store
- Stage 2: Getting RDF out of an LPG Store
- Federated Querying
- Wrapping Up
- Processing the Graph
- Creating the GraphCompute Project
- Adding a Supervision Tree (or Two)
- Building a Dynamic Process Graph
- Restoring the State for a Node
- Recovering the Graph
- Simulating a Network
- Wrapping Up
Author
Tony Hammond is a longtime data professional with a wide experience
of linked data architecture, public identifier management, and knowledge
representation and engineering. He has worked on both sides of the
information supply chain, from international research centers to leading
academic publishers, and more recently is employed in the financial
sector. He is especially interested in using graph databases and
ontologies to build out integrated systems over distributed datasets.