A Graph Database for Julia, built on top of SQLite.jl.
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.
- 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...)
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"))
insert!
will not replace an existing node or edge. Instead, use replace!
.
replace!(db, Node(2, "Movie"; title="Forest Gump", genre="Drama"))
SQLiteGraph is STRONGLY influenced (much has been copied verbatim) from https://github.com/dpapathanasiou/simple-graph.