How to use the gremlin.SetGraph function in gremlin

To help you get started, we’ve selected a few gremlin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inolen / gremlin-node / examples / titanExample.js View on Github external
/*Titan specific Enums <<<<<*/
//console.log(TTC.LABEL.toString());
//console.log(TTC.KEY.toString());
//console.log(UniqCon.LOCK.toString());
//console.log(UniqCon.NO_LOCK.toString());

var BaseConfiguration = g.java.import('org.apache.commons.configuration.BaseConfiguration');

conf = new BaseConfiguration();
conf.setPropertySync("storage.backend","cassandra");
conf.setPropertySync("storage.hostname","127.0.0.1");
conf.setPropertySync("storage.keyspace","titan");

var TitanFactory = g.java.import('com.thinkaurelius.titan.core.TitanFactory');
var gt = TitanFactory.openSync(conf);
g.SetGraph(gt);

gt.makeTypeSync().nameSync("foo").dataTypeSync(Type.String.class).indexedSync(Type.Vertex.class)
 	.uniqueSync(Direction.BOTH, UniqCon.NO_LOCK).makePropertyKeySync();

// var vertex = gt.addVertexSync(null);
// vertex.setPropertySync('name', 'Frank');
// gt.commitSync();

//g.v(8, 12).consoleOut();
// g.E().has('weight', T.gt, g.Float(0.2)).property('weight').consoleOut();
// g.V('name','Frank').consoleOut();
g.V().consoleOut();
console.log("All good!");
github NextCenturyCorporation / EVEREST / services / database / titan_graph.js View on Github external
var AlphaReportService = require('./alpha_report.js');
var gremlin = require('gremlin');
var async = require('async');
var TitanFactory = gremlin.java.import('com.thinkaurelius.titan.core.TitanFactory');
var graphDB = TitanFactory.openSync('titan/assertions');	//from same dir as app.js?
//var graphDB = TitanFactory.openSync('/titan/assertions');	//root directory alternative
gremlin.SetGraph(graphDB);

var indexOfId = function(array, id){
	for (var i = 0; i < array.length; i++ ){
		if (id === JSON.parse(array[i]).item_id){
			return i;
		}
	}
	return -1;
};

module.exports = function(models, io, logger) {
	var me = this;
	var alphaReportService = new AlphaReportService(models, io, logger);
	
	me.list = function(config, callback) {
		var verts = gremlin.V().toJSON();
github NextCenturyCorporation / EVEREST / services / database / titan-graph.js View on Github external
var AlphaReportService = require('./alpha_report.js');
var actionEmitter = require('../action_emitter.js');
var paramHandler = require('../list_default_handler.js');

var gremlin = require('gremlin');
var TitanFactory = gremlin.java.import('com.thinkaurelius.titan.core.TitanFactory');
var graphDB = TitanFactory.openSync('/home/user/Documents/titan/databases/assertions-2000');
gremlin.SetGraph(graphDB);

var indexOfId = function(array, id){
	for (var i = 0; i < array.length; i++ ){
		if (id === JSON.parse(array[i]).item_id){
			return i;
		}
	}
	return -1;
}

module.exports = function(models, io, logger) {
	var me = this;
	var alphaReportService = new AlphaReportService(models, io, logger);
	
	me.listVertices = function(config, callback){
		var all = {};