Gephi Visual Tool
Introduction
Gephi is a visual tool to manipulate and analyze graphs. http://gephi.org is an Open Source project. Take a look at the amazing features.
Gephi can be used to analyze graphs extracted from OrientDB. There are 2 level of integration:
- the Streaming plugin that calls OrientDB server via HTTP. OrientDB exposes the new "/gephi" command in HTTP GET method that executes a query and returns the result set in "gephi" format.
- Gephi importer for Blueprints
In this mini guide we will take a look at the first one: the streaming plugin.
For more information:
Getting started
Before to start assure you've OrientDB 1.1.0-SNAPSHOT or greater.
Download and install
- To download Gephi goto: http://gephi.org/users/download/
- Install it, depends on your OS
- Run Gephi
- Click on the menu Tools -> Plugins
- Click on the tab Available Plugins
- Select the plugin Graph Streaming, click on the Install button and wait the plugin is installed
Import a graph in Gephi
Before to import a graph assure a OrientDB server instance is running somewhere. For more information watch this video.
- Go to the Overview view (click on Overview top left button)
- Click on the Streaming tab on the left
- Click on the big + green button
- Insert as Source URL the query you want to execute. Example:
http://localhost:2480/gephi/demo/sql/select%20from%20v/100
(below more information about the syntax of query) - Select as Stream type the JSON format (OrientDB talks in JSON)
- Enable the Use Basic Authentication and insert the user and password of OrientDB database you want to access. The default user is "admin" as user and password
- Click on OK button
Executing a query
The OrientDB's "/gephi" HTTP command allow to execute any query. The format is:
http://<host>:<port>/gephi/<database>/<language>/<query>[/<limit>]
Where:
host
is the host name or the ip address where the OrientDB server is running. If you're executing OrientDB on the same machine where Gephi is running use "localhost"port
is the port number where the OrientDB server is running. By default is 2480.database
is the database namelanguage
query
, the query text following the URL encoding rules. For example to use the spaces use%20
, so the queryselect from v
becomesselect%20from%20v
limit
, optional, set the limit of the result set. If not defined 20 is taken by default.-1
means no limits
SQL Graph language
To use the OrientDB's SQL language use sql
as language. For more information look at the SQL-Syntax.
For example, to return the first 1,000 vertices (class V) with outgoing connections the query would be:
SELECT FROM V WHERE out.size() > 0
Executed on "localhost" against the "demo" database + encoding becomes:
http://localhost:2480/gephi/demo/sql/select%20from%20V%20where%20out.size()%20%3E%200/1000
GREMLIN language
To use the powerful GREMLIN language to retrieve the graph or a portion of it use gremlin
as language. For more information look at the GREMLIN syntax.
For example, to return the first 100 vertices:
g.V[0..99]
Executed on "localhost" against the "demo" database + encoding becomes:
http://localhost:2480/gephi/demo/gremlin/g.V%5B0..99%5D/-1