Today we added a plug-in to the 2.1 version of the community edition of GraphDB which is called “FastImport”. It’s basically a bulk import plug-in which takes a proprietary XML format as input and imports vertices and edges into a running GraphDB instance.
In order to use this new plug-in and import feature you need to know that an import basically splits into a two-stage process:
scheme setup
fast-import
So first you’ll have to define which vertex and edge types get imported by the following step 2 – you normally do this using the GraphQL and specifying several vertex types. For demonstration purposes we take a small social network with only one vertex type:
CREATEVERTEXTYPE User ATTRIBUTES (String Name, Int64 Age, Set<User> Friends)
After having set-up the scheme the only thing left is to actually call the import plug-in using another short GraphQL query:
IMPORTFROM ‘file:\\100k_import.xml’ FORMAT FastImport
This will, for example, take the 100.000 user dataset and import it into the current GraphDB instance. Of course we did that already for you so here are the comparison results between a GraphQL and FastImport and the persistent and In-Memory version of GraphDB:
Of course you can also download the data-sets used in this small benchmark here:
With version 2.0 of sones GraphDB we introduced an enhanced graph model we call Property Hypergraph.
In this Property Hypergraph model there are some standard edge types:
single-edge: an edge between two vertices
multi-edge: an edge splitting up into single-edges of the same edge type pointing towards the same vertex type.
hyper-edge: an edge to a subgraph made up by all possible types of vertices
In order to create different vertex types since version 1.0 of sones GraphDB the GraphQL command “CREATEVERTEXTYPE” is available to users. In version 2.0 we introduced edge types but those were only useable if you would use the API to interact with the GraphDB instance.
In version 2.1 we’ve now added a full edge type management to be used either through GraphDBs new edge-type API and of course through the new GraphQL extensions which add edge-type handling.
So for example let’s say you want to create an edge type “User” and insert a bunch of those. And you want those users to be connected by a specific edge type which comes with it’s own attributes – something like this:
The GraphQL Queries to create the above scheme would be these:
CREATEEDGETYPE UserLink ATTRIBUTES (Double weight, String priority, LIST<String> tags) COMMENT = ‘This is my edge type named UserLink.’ CREATEVERTEXTYPE User ATTRIBUTES (String name, SET<User(UserLink)> friends) INSERTINTO User VALUES (name = ‘UserA’) INSERTINTO User VALUES (name = ‘UserB’, friends = SETOF(name = ‘UserA’ : (weight = 15.5, priority = ‘high’, tags = LISTOF(‘best friend’, ‘mate’))))
As you can see it’s easy to actually create edge types and add attributes to the relationships these edges represent. It even gets better: you can also use the inheritance mechanisms you are already used to on vertex types as well as undefined (schemeless) attributes.
If you want to dive deeper into edge types you won’t have to wait until the release of GraphDB 2.1 at the end of this year. You can just grab the current source code on github and get started.
Additional documentation and examples are available in our documentation wiki. Here are some places you will find more information:
Not long ago we showed off the new capabilities of GraphDB 2.1 (to be released at the end of 2011) regarding the visualization of data. Now we extended that capabilities and added another Output Plug-In to the Community Edition. It’s called GraphVis.
And you can download it now with our source-code package from our GitHub repository.
The best way to show-off the new functionality is by literally showing it:
A good start for the documentation of the new visualization options is our ever growing wiki.
There is a new example available for all the developers out there who want to start using GraphDB.
This tutorial describes and shows the simplicity of setting up a GraphDB by using the sones GraphDB CommunityEdition. It shows how to create your own database by using the sones GraphDB C# API and how to use GraphDB to create your own graph scheme (in not one but two different approaches).
If you are using the GraphQL please read our GraphQL Cheatsheet there you can find the description of all available statements and some additional examples.
The tutorial itself will show you how to:
create user defined types, add structured properties, add unknown/schemeless properties
create outgoing and incoming edges on a vertex type
create an index on a specified property in 3 different ways
set constraints on properties (like “unique” and “mandatory”)