Skip to content

JuliaComputing/SQLiteGraph.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status Codecov

SQLiteGraph

A Graph Database for Julia, built on top of SQLite.jl.



Definitions

SQLiteGraph.jl uses the Property Graph Model of the Cypher Query Language (PDF).

  • A Node describes a discrete object in a domain.
  • Nodes can have 0+ labels that classify what kind of node they are.
  • An Edge describes a directional relationship between nodes.
  • An edge must have a type that classifies the relationship.
  • Both edges and nodes can have additional key-value properties that provide further information.



Edges and Nodes

  • Nodes and Edges have a simple representation:
struct Node
    id::Int
    labels::Vector{String}
    props::EasyConfig.Config
end

struct Edge
    source::Int
    target::Int
    type::String
    props::EasyConfig.Config
end
  • With simple constructors:
Node(id, labels...; props...)

Edge(source_id, target_id, type; props...)



Adding Elements to the Graph

using SQLiteGraph

db = DB()

insert!(db, Node(1, "Person", "Actor"; name="Tom Hanks"))

insert!(db, Node(2, "Movie"; title="Forest Gump"))

insert!(db, Edge(1, 2, "Acts In"))



Editing Elements

insert! will not replace an existing node or edge. Instead, use replace!.

replace!(db, Node(2, "Movie"; title="Forest Gump", genre="Drama"))



✨ Attribution ✨

SQLiteGraph is STRONGLY influenced (much has been copied verbatim) from https://github.com/dpapathanasiou/simple-graph.