Graph Definition Language (GDL)
Inspired by the Neo4j Cypher query language, GDL allows the simple definition of property graphs. GDL contains a parser and simple structs that represent the property graph and its elements. The Rust implementation is inspired by my Java implementation.
Property graph data model
A property graph consists of nodes and relationships. Nodes have zero or more labels, relationships have zero or one relationship type. Both, nodes and relationships have properties, organized as key-value-pairs. Relationships are directed, starting at a source node and pointing at a target node.
Quickstart example
use ;
use Rc;
let gdl_string = "(alice:Person { age: 23 }),
(bob:Person { age: 42 }),
(alice)-[r:KNOWS { since: 1984 }]->(bob)";
let graph = from.unwrap;
assert_eq!;
assert_eq!;
let alice = graph.get_node.unwrap;
assert_eq!;
let relationship = graph.get_relationship.unwrap;
assert_eq!;
More GDL language examples
Define a node:
let g = from.unwrap;
assert_eq!;
Define a node and assign it to variable alice:
let g = from.unwrap;
assert!;
Define a node with label User and a single property:
let g = from.unwrap;
assert_eq!;
assert!;
Define an outgoing relationship:
let g = from.unwrap;
assert_eq!;
Define an incoming relationship:
let g = from.unwrap;
assert_eq!;
Define a relationship with type KNOWS, assign it to variable r1 and add a property:
use Rc;
let g = from.unwrap;
assert!;
assert_eq!;
Define multiple outgoing relationships from the same source node (i.e. alice):
let g = from.unwrap;
assert_eq!;
assert_eq!;
Define paths (four nodes and three relationships are created):
let g = from.unwrap;
assert_eq!;
assert_eq!;
Paths can be comma separated to express arbitrary complex patterns:
let g = from.unwrap;
assert_eq!;
assert_eq!;
License
Apache 2.0 or MIT