Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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!");
me.deleteAll = function(callback) {
var vertices = gremlin.V().iterator();
var element;
var count = 0;
while (vertices.hasNextSync()) {
element = vertices.nextSync();
element.removeSync();
count++;
}
graphDB.commitSync();
callback(null, {deleted_count: count});
};
};
me.list = function(config, callback) {
var verts = gremlin.V().toJSON();
var edges = gremlin.E().toJSON();
var error = verts.error || edges.error;
callback(error, verts.concat(edges));
};
me.listVertices = function(config, callback) {
var all = {};
var keys = Object.keys(config);
if (keys.length === 1) {
var field = keys[0];
if ( config[field] === 'alpha report' || config[field] === 'target event' ){
all = gremlin.V().has(field, config[field]).toJSON();
} else {
all = gremlin.V().has(field, config[field]).outE().has("label","metadata of").inV().toJSON();
}
} else {
all = gremlin.V().toJSON();
}
callback(all.error, all);
};
me.compareToAll = function(ar_id){
var alphas = gremlin.V().has('name', 'alpha report').toJSON();
var a_json = gremlin.v(ar_id).toJSON()[0];
//gremlin.v(ar_id).iterator().nextSync().setPropertySync('comparedTo', []);
//graphDB.commitSync();
var comparedTo = a_json.comparedTo;
alphas.forEach(function(d){
var score = 0.0;
var d_json = gremlin.v(d._id).toJSON()[0];
//gremlin.v(d._id).iterator().nextSync().setPropertySync('comparedTo', []);
//graphDB.commitSync();
var d_comparedTo = d_json.comparedTo;
if (indexOfId(comparedTo, d._id) === -1){
var ar_nodes = gremlin.v(ar_id).inE().outV().toJSON();
var d_nodes = gremlin.v(d._id).inE().outV().toJSON();