Graft.jl icon indicating copy to clipboard operation
Graft.jl copied to clipboard

Database backends for Graft.jl

Open pranavtbhat opened this issue 8 years ago • 4 comments

This is to scope the work required to integrate Graft.jl with relational databases/ graph databases.

pranavtbhat avatar Aug 22 '16 10:08 pranavtbhat

RDMBS

The use of JDBC or ODBC should make this fairly straightforward.

The current graph definition is:

type Graph
   nv::Int
   ne::Int
   indxs::SparseMatrixCSC{Int,Int}
   vdata::AbstractDataFrame
   edata::AbstractDataFrame
   lmap::LabelMap
end

After adding a layer of abstraction for type of DB in use, this should look like:

abstract GraphDataStore

# Current implementation
immutable TableStore <: GraphDataStore
   vdata::AbstractDataFrame
   edata::AbstractDataFrame
end   

# RDMBS implementation (two tables: Vertex and Edge)
immutable RelationalStore <: GraphDataStore
   dbconn:: JConnection
end

# Metadata access should look something like this:
function getvprop(x::RelationalStore, vs::VertexList, prop::Symbol)
   # set @VLIST
   DataFrames.readtable(executeQuery(createStatement(x.dbconn), "SELECT $prop FROM Vertex WHERE ROWNUM in @VLIST")
end

type Graph
   nv::Int
   ne::Int
   indxs::SparseMatrixCSC{Int,Int}
   propgraph::GraphDataStore
   lmap::LabelMap
end

pranavtbhat avatar Aug 22 '16 11:08 pranavtbhat

GraphDB

There seems to be a wrapper for Neo4j already : https://github.com/glesica/Neo4j.jl. Neo4j.jl uses HTTP requests to interface with the Neo4j server. This is quite slow, and returns text data that needs to be parsed.

There is an officially supported python driver that uses a faster BOLT protocol. We can either call this from within Julia or try replicating it. Neo4j supports a bunch of other languages too, maybe we can add Julia?

Update : writing a bolt driver for Julia should be straightforward. This tutorial is pretty informative. I will start experimenting with the socket API soon.

pranavtbhat avatar Aug 22 '16 11:08 pranavtbhat

fwiw, it looks like the bolt driver info moved to here: https://github.com/neo4j-contrib/boltkit

rotten avatar Oct 25 '16 17:10 rotten

Just checking if one of you have made progress on the matter of bolt driver for julia withn last year.

Azzaare avatar Sep 11 '17 03:09 Azzaare