pranavtbhat / Graft.jl

Graph Toolkit for Julia
Other
30 stars 5 forks source link

Database backends for Graft.jl #25

Open pranavtbhat opened 8 years ago

pranavtbhat commented 8 years ago

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

pranavtbhat commented 8 years ago

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 commented 8 years ago

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.

rotten commented 7 years ago

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

Azzaare commented 7 years ago

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