-
Notifications
You must be signed in to change notification settings - Fork 18
Graph Querying Language
Sameer Singh edited this page Oct 14, 2015
·
16 revisions
Wiki page to document the syntax of the graph querying language. Most of these features will be unit tested in GraphQueriesTest.
Definition:
val n = node[A]
Get all the instances of a node:
n()
To start querying using a custom collection:
val coll: Iterable[A] = ...
n(coll)
Definition:
val n2 = node[B]
val e = edge(n,n2)
Get all neighbors of all instances of n
:
n() ~> e
Get all neighbors of some of the instances of n
:
n(coll) ~> e
Reverse Query, get all neighbors of all instances of n2
:
n2() ~> -e
Filter the instances of a node:
def f: A => Boolean = ...
n() filter f
Filter a collection of instances:
n(coll) filter f
Noe that this is different from n.filter(f)
or coll.filter(f)
since you can continue the graph query:
n(coll) filter f ~> e
val n1 = node[A]
val n2 = node [B]
val n3 = node[C]
val e1 = edge(n1, n2)
val e2 = edge(n2, n3)
n1()
n1() ~> e1 // = n2
n1() ~> e1 ~> e2 // = n3
n3() ~> -e2 // = n2
n3() ~> -e2 ~> -e1 // = n1