Using libgraph for graph data structures

Photo by Francisco Moreno on Unsplash

I’ve previously looked at how we can query graph databases using Elixir. But now if we want to generate graph data structures natively, how can we do that? Well, turns out that there is the excellent libgraph package by Paul Schoenfelder that allows us to do just that.

The libgraph project page provides a rationale for why this package was developed. Basically it addresses a number of shortcomings in the earlier Erlang module digraph, both as regards performance and extensibility.

We’re going to give a quick introduction here to libgraph, talk about serializing and visualizing libgraph graphs, import a libgraph

Moving data between semantic and property graphs

Photo by Maarten van den Heuvel on Unsplash

In earlier posts I’ve shown how to access and manipulate RDF graphs using Elixir and separately also how to access and manipulate labeled property graphs (or LPG graphs). What I’d like to focus on here is conversions from one graph form to another in Elixir.

But first a quick recap on why.

Why graphs? Because graphs are everywhere. Because graphs are about connected data. Because graphs are essentially about large-scale data integration.

We heard recently at the London leg of the Neo4j GraphTour about the relationship between graphs and ML. Expect to see graphs figure more prominently in ML solutions.

Accessing Neo4j from Elixir with Bolt and Cypher

Photo by Alisa Anton on Unsplash

Previously in this series I have been looking at how to access RDF graphs from Elixir. But this is only one side of the graph story. There is also a whole other world of property graphs to consider.

Property graphs – also known as ‘labeled’ property graphs – are more generic than RDF graphs in that both nodes and edges may be attributed properties, and edges may be directed or undirected. That said, property graphs typically employ local names and have a weak data model and so do not support any common semantics.

See here for a nice exposition by…

Using IElixir in JupyterLab with the SPARQL.Client package

“white bridge with lights” by Tyler Easton on Unsplash

Now one can’t really claim to be a bona fide data scientist these days if one isn’t brandishing some flavour of notebook to save and run one’s calculations. And arguably one of the best known names in this breed of application is the Jupyter Notebook which is an excellent vehicle for data processing with Python. And Python as a language has become almost synonymous with data wrangling.

But these days there’s much more to Jupyter than the original name begetting trio of languages – Julia, Python, and R. And also notebooks themselves are useful for much more than just data…

Managing fault tolerance in Elixir with supervision trees

“flock of birds” by Barth Bailey on Unsplash

In this post I aim to provide some reasons for why Elixir (and under the hood Erlang) ushers in a whole new paradigm for distributed compute and how it makes this both simple and fun to master for semantic web applications.

(And just to anticipate any comment on the figure above signifying some kind of distributed compute pattern, check out the note at the end of this post.)

1. Review process model of Erlang (and Elixir)

The essence of distributed compute is embedded deep within the genes of the language. Erlang was by design developed by Ericsson to manage telephony applications and to provide for fault tolerant processing…

Applying SPARQL.ex to RDF shapes

“brown and black wall decor” by Callum Wale on Unsplash

Following up on my last post about querying RDF using the Elixir SPARQL.ex and SPARQL.Client.ex libraries from Marcel Otto, I wanted to focus here on a simple use case with SHACL and an RDF shape used to provide a template description for the result graph. That is, instead of using a specific SPARQL query we will generate SPARQL queries from the RDF shape that defines the valid result graphs. And in doing so we will also bump up against some limitations with the current SPARQL.ex implementation and show how we might work around those.

NOTE (2018-11-13): See the two comments…

Using SPARQL.ex to query over RDF datastores

“worms eye view of buildings” by Alex wong on Unsplash

In my last post I talked about the RDF.ex package by Marcel Otto for RDF processing in Elixir. Now Marcel has also added a SPARQL.ex package for querying RDF datastores with SPARQL. So let’s have a look at that. In fact there are two separate packages: SPARQL.ex for querying in-memory RDF models, and SPARQL.Client.ex for dispatching queries to remote RDF models. So let’s first deal with local (in-memory) models and then go on to remote models. (And again a special thanks to Marcel for reviewing this post and making super-useful comments as well as suggesting improvements.)

1. Create a ‘TestQuery’ project

First off, let’s create…

Using RDF.ex to work with RDF vocabularies in Elixir

Photo by Steve Johnson on Unsplash

I’ve recently begun to look at Elixir again. This time though in a little more detail. I had been aware of this elegant new language some years back when it was still shiny and new but then other things intervened and it all got pushed back. And Erlang too I had earlier played with and was also very struck with. But now seemed like a pretty good time to take up this exploring again and to get a better handle on the language and see what it could actually do for me.

I won’t say too much about Elixir itself…

Tony Hammond

Distributed data, distributed compute – the graph! | #writing, #workseeking

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store