joshsh / jig

A JavaScript-based interface for graph traversal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jig logo|width=107px|height=100px

Jig (JavaScript-based interface for graph traversal) is a graph-based programming language in the spirit of Gremlin or Ripple, but specifically geared towards AllegroGraph and using JavaScript syntax.

All Jig expressions are valid JavaScript which are passed into AllegroGraph's JavaScript API. Behind the scenes, they are compiled to Allegro Common Lisp, which executes as efficiently as possible in the AllegroGraph server environment. In this way, you can easily explore a graph or incrementally build up simple programs at the REPL, but you also have the power of the Lisp compiler if you need it for more complex and computationally intensive tasks.

Starting a Jig session:

Syntax reference:

Here is an example of a Jig program:

// Name of the triple store
store.name

// Number of triples in the store
store.size

// Look at a few triples
g.triples.limit(10)

// Labels (predicates) only
g.triples.limit(10).label

// Find more labels
g.triples.limit(100000).label.distinct

// Pick out a single label (rdf:type in this case)
type = g.triples.limit(100000).label.distinct[6]

// Find distinct types
g.triples(null, type, null).head.limit(100000).distinct

// Let's look at the "drugs" type
drugs = g.triples(null, type, null).head.limit(100000).distinct[1]

// Here are some instances of "drugs"
d = g.V(drugs).inE(type).limit(10).tail

// Pick a drug at random, find its neighborhood as a ranked list
d0 = g.V(d[0]).nearby(2).aggr

// Do the same for another node
d9 = g.V(d[9]).nearby(2).aggr

// Find the intersection (entry-wise product) of the two neighborhoods.
// These are nodes "nearby" to both nodes in the graph
intersect(d0, d9)

See also an intro to Jig on YouTube

About

A JavaScript-based interface for graph traversal

License:Other


Languages

Language:JavaScript 57.1%Language:Java 36.4%Language:CSS 3.5%Language:HTML 2.3%Language:Shell 0.7%