AngkotCayley – Learning with Graph Databases

This post is long overdue, so the hell with it.

angkotcayley

I loved learning new stuff, especially ones that I never got the chance to learn at school and I got the chance to get an internship at Ebdesk office in Bandung.

One of my jobs is to build a software for analyzing public transportation in Bandung, especially that with angkot because there so many of them here. My boss require me to try Cayley https://github.com/cayleygraph/cayley

I had no introduction to graph databases or anything about it, so I research everything about it and blown away on how all of it works. All of my experiences with databases are basic SQL and to see how every node connected to form a graph.

My first step is to research on angkot lanes, angkot is much different than taxi’s or buses they stop whenever they like. this caused the problem since I planned to make a node on every time they stop.

10-01-05_peta-angkot_dasar

I decided that each road is a node that connected to the next road it passed through so I made this n-quads to connect the road.

I am from Indonesia and if you confused on some of the vocab this some to help you understood.

jalan – road, kode – code, trayek – route, nama – name

nquad1

nquad2

nquad3

And then I run cayley with the following query

g.V(‘/data/road/nama_jalan’).Tag(‘source’).Out(‘/data/angkot’).Tag(‘target’).All()

roadconnection

Cayley use javascript with some gremlin inspired graph object, so it felt at home if you use javascript or do web programming regularly.

Cayley also support visualization, after learning on how it works I was amazed on the result

g.V().Tag(‘source’).Both(‘/data/angkot’, null).Tag(‘target’).All()

visualization.png

In conclusion, Cayley is wonderful if you want to try visualizing data based on graph databases, even that I used Cayley built-in databases I able to produce the result that I wanted.

Next time, I will be talking on how I implemented this newly learned technology for end-user needs also what I learn about Graph Databases with TitanDB and it’s pure Gremlin Query Language.

Advertisements

Author: nerdv2

Just another programmer who eager to learn more.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s