https://github.com/ihoro/rough-rx-gremlin
The simplest RxJS wrapper around gremlin lib
https://github.com/ihoro/rough-rx-gremlin
gremlin javascript nodejs reactive-extensions rxjs tinkerpop wrapper
Last synced: 22 days ago
JSON representation
The simplest RxJS wrapper around gremlin lib
- Host: GitHub
- URL: https://github.com/ihoro/rough-rx-gremlin
- Owner: ihoro
- License: mit
- Created: 2019-02-07T00:54:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-17T20:29:40.000Z (11 months ago)
- Last Synced: 2025-03-25T06:01:57.632Z (about 1 month ago)
- Topics: gremlin, javascript, nodejs, reactive-extensions, rxjs, tinkerpop, wrapper
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The simplest RxJS wrapper around gremlin lib
[](https://travis-ci.com/ihoro/rough-rx-gremlin)
[](https://badge.fury.io/js/%40rough%2Frx-gremlin)Rough implementation of [rxified](https://npmjs.com/rxjs) wrapper of [gremlin](https://npmjs.com/gremlin) lib.
## Usage examples
```js
const { tap } = require('rxjs/operators');
const RxGremlin = require('@rough/rx-gremlin');const gremlin = new RxGremlin('ws://gremlin-server:8182/gremlin');
gremlin.traverse(g => g.V().hasLabel('Person').valueMap(true).next())
.pipe(
tap(({ value }) => console.log(value))
)
// .subscribe ...
```Also, each `g` instance has handy shortcuts as follows:
```js
g.T = gremlin.process.t;
g.G = gremlin.process.statics;
g.P = gremlin.process.P;
g.TextP = gremlin.process.TextP;
g.C = gremlin.process.cardinality;
g.O = gremlin.process.order;
```What can be used right away without additional imports:
```js
// ...
g => g.V()
.has(g.T.label, g.P.within('Entity', 'Person'))
.has('description', g.P.not(g.TextP.containing(['word1', 'word2'])))
.where(g.G.not(g.G.outE('parent')))
.order().by('updated_at', g.O.desc)
.valueMap(true)
.toList()
// ...
```## Configuration
For connection options see official [DriverRemoteConnection class](https://tinkerpop.apache.org/jsdocs/3.6.0/DriverRemoteConnection.html).
You may pass such options as the second parameter of the constructor, e.g. in order to switch from default GraphSON to GraphBinary protocol you would do the following:
```js
new RxGremlin('ws://gremlin-server:8182/gremlin', { mimeType: 'application/vnd.graphbinary-v1.0' });
```