Manipulating Graphs

In my earlier post on Graph Database I discussed two types of Graph Models – Property Graph Model and RDF Model.

In this post I will discuss the APIs standards that are available for manipulating graph model.

Property Graph API a.k.a Blueprint API

Blueprint API is seen as JDBC for Property Graph databases. It provides a collection of interfaces for graph databases providers to implement.

This API which is specified as part of the TinkerPop stack which is an open source software in the Graph space. The current version of Tinkerpop is 2.x.  The key supporters of Tinkerpop are Neo4J, Titan among others. http://www.tinkerpop.com/

Example using Blueprint API

Graph graph = new Neo4jGraph(“/tmp/my_graph”);
Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
a.setProperty(“name”,”marko”);
b.setProperty(“name”,”peter”);
Edge e = graph.addEdge(null, a, b, “knows”);
e.setProperty(“since”, 2006);
graph.shutdown();

The Tinkerpop stack is illustrated below.

tinkerpop

RDF API

Jena is a Java API which can be used to create and manipulate RDF graphs. Graph database providers, who support native or non-native graph store, implement Jena to support creating and manipulation of RDF graph.

Please refer to my post on RDF Serialization and Triplestores which discusses the many ways the RDF can be serialized and persisted.

A parallel framework to Jena is Sesame which is also open source Java framework for storage and querying of RDF data. Some providers implement Sesame also known as Open RDF – SAIL (Storage And Interface Layer).

Example using RDF API

String personURI = “http://somewhere/JohnSmith”;
String givenName = “John”;
String familyName = “Smith”;
String fullName = givenName + ” ” + familyName;

// create an empty Model
Model model = ModelFactory.createDefaultModel();

// create the resource
// and add the properties cascading style
Resource johnSmith
= model.createResource(personURI)
.addProperty(VCARD.FN, fullName)
.addProperty(VCARD.N,
model.createResource()
.addProperty(VCARD.Given, givenName)
.addProperty(VCARD.Family, familyName));

The following table illustrates a sample of vendors and their support for Graph APIs. Please check with the vendors on the exact version where the APIs are supported.

vendors

 

*Note – SAIL Graph which implement Blueprint interface ‘TransactionalGraph’ (turns a SAIL based RDF store into BluePrint Graph, alternatively, Graph SAIL turns any IndexableGraph implementation (another BluePrint interface) into RDF store (BluePrint refers to them ouplementations)

Advertisements

About atiru

Product Strategist and architect for harnessing value from data.
This entry was posted in Topics related to Graph Databases and Compute, Linked Data (RDF) and tagged , , . Bookmark the permalink.

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