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);
Edge e = graph.addEdge(null, a, b, “knows”);
The Tinkerpop stack is illustrated below.
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
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.
*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)