@hammerbot/gremlin

3.5.0-alpha1 • Public • Published

JavaScript Gremlin Language Variant

Apache TinkerPop™ is a graph computing framework for both graph databases (OLTP) and graph analytic systems (OLAP). Gremlin is the graph traversal language of TinkerPop. It can be described as a functional, data-flow language that enables users to succinctly express complex traversals on (or queries of) their application's property graph.

Gremlin-Javascript implements Gremlin within the JavaScript language and can be used on Node.js.

npm install gremlin

Gremlin-Javascript is designed to connect to a "server" that is hosting a TinkerPop-enabled graph system. That "server" could be Gremlin Server or a remote Gremlin provider that exposes protocols by which Gremlin-Javascript can connect.

A typical connection to a server running on "localhost" that supports the Gremlin Server protocol using websockets looks like this:

const gremlin = require('gremlin');
const traversal = gremlin.process.AnonymousTraversalSource.traversal;
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;

const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));

Once "g" has been created using a connection, it is then possible to start writing Gremlin traversals to query the remote graph:

g.V().hasLabel('person').values('name').toList()
  .then(names => console.log(names));

const names = await g.V().hasLabel('person').values('name').toList();
console.log(names);

Please see the reference documentation at Apache TinkerPop for more information.

NOTE that versions suffixed with "-rc" are considered release candidates (i.e. pre-alpha, alpha, beta, etc.) and thus for early testing purposes only.

Package Sidebar

Install

npm i @hammerbot/gremlin

Weekly Downloads

0

Version

3.5.0-alpha1

License

Apache-2.0

Unpacked Size

139 kB

Total Files

27

Last publish

Collaborators

  • coderhammer
  • elmatella