Giter VIP home page Giter VIP logo

gremlin-node-orientdb's Introduction

Gremlin-node-orientdb

Gremlin-node-orientdb is a javascript wrapper around the Gremlin API using Rexster.

Rexster

Rexster provides a RESTful shell to any Blueprints-complaint graph database. This HTTP web service provides: a set of standard low-level GET, POST, and DELETE methods, a flexible extension model which allows plug-in like development for external services (such as ad-hoc graph queries through Gremlin), and a browser-based interface called The Dog House.

A graph database hosted in the OrientDB can be configured in Rexster and then accessed using the standard RESTful interface powered by the Rexster web server.

Installation

You can get the latest stable release of Rexster from its Download Page. The latest stable release when this page was last updated was 2.5.0.

Or you can build a snapshot by executing the following Git and Maven commands:

$ git clone https://github.com/tinkerpop/rexster.git
$ cd rexster
$ mvn clean install

Configuration

In order to configure Rexster to connect to your OrientDB graph, locate the rexster.xml in the Rexster directory and add the following snippet of code:

<rexster>
  ...
  <graphs>
    ...
    <graph>
      <graph-enabled>true</graph-enabled>
      <graph-name>orientdbsample</graph-name>
      <graph-type>com.tinkerpop.rexster.OrientGraphConfiguration</graph-type>
      <graph-location>{{ DATABASE'S LOCATION }}</graph-location>
      <extensions>
        <allows>
           <allow>tp:gremlin</allow>
        </allows>
      </extensions>
      <properties>
        <username>{{ USERNAME }}</username>
        <password>{{ PASSWORD }}</password>
      </properties>
    </graph>
  ...
  </graphs>
</rexster>

For instance, for local database, replace {{ DATABASE'S LOCATION }} by remote:localhost/{{ DATABASE'S NAME }}.

Run

Locate the BIN folder in the Rexster directory, and enter this command line :

$ ./rexster.sh -s -c ../config/rexster.xml 

Installation

$ git clone [email protected]:atefzed/gremlin-node-orientdb.git
$ cd gremlin-node-orientdb && npm install

To run your app, you need to run these step by step :

  1. Orientdb server.
  2. Rexster server.
  3. Node.js application.

Examples

Using sails-orientdb

var orientAdapter = require('sails-orientdb');

require('{{ PATH TO GRAPH.JS }}')(orientAdapter);

module.exports = {
  	// Setup Adapters
  	// Creates named adapters that have have been required
	adapters: {
	   'default': orientAdapter,
	   orient: orientAdapter,
	},

	// Build Connections Config
	// Setup connections using the named adapter configs
	connections: {
	   myLocalOrient: {
		   adapter: 'orient',
		   host: 'localhost',
		   port: {{ PORT }},
		   user: '{{ USERNAME }}',
		   password: '{{ PASSWORD }}',
		   database: "{{ DATABASE'S NAME }}"
	   }
	},

	defaults: {
	   migrate: 'safe'
	}
}

Simple request :

  var o = app.models.{{ COLLECTION NAME }};
  o.inV('id', '#12:0', function(err, resp) {
    if (err) throw err;
    console.log(resp);
  });

Nested request :

  var o = app.models.{{ COLLECTION NAME }};
  o.inV('id', '#12:0', function(error, resp) {
    if (error) throw error;
    o.dedup(resp, function(e, r){
      if (e) throw e;
      o.count(r, function(err, c){
        if (err) throw err;
        console.log(c);
      });
    });
  });

Without sails-orientdb

var Graph = require('{{ PATH TO GRAPH.JS }}');
var g = new Graph();
g.filter('', '{{ COLLECTION NAME }}', {
  'lastname': 'test',
  'familySituation': 'single'
}, function(err, res) {
    if (err) throw err;
    console.log(res);
});

Tests

All tests are written with mocha and should be run with npm:

  $ npm test

Contributing

Contributions to the project are most welcome, so feel free to fork and improve.

gremlin-node-orientdb's People

Contributors

atefzed avatar hamdipro avatar heythm avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hamdipro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.