gremlin-v3
Advanced tools
Comparing version 0.0.19 to 0.0.20
@@ -36,2 +36,24 @@ 'use strict'; | ||
// Create a GraphSONMapper (promise) that preserves types. | ||
GraphWrapper.prototype._newGraphSONMapper = function () { | ||
var callStaticMethod = Q.nbind(this.java.callStaticMethod, this.java); | ||
return callStaticMethod('com.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper', 'build') | ||
.then(function (builder) { | ||
var embedTypes = Q.nbind(builder.embedTypes, builder); | ||
return embedTypes(true); | ||
}) | ||
.then(function (builder) { | ||
var create = Q.nbind(builder.create, builder); | ||
return create(); | ||
}); | ||
}; | ||
// Create a GraphSONMapper that preserves types. | ||
GraphWrapper.prototype._newGraphSONMapperSync = function () { | ||
var builder = this.java.callStaticMethodSync('com.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper', 'build'); | ||
builder.embedTypesSync(true); | ||
var mapper = builder.createSync(); | ||
return mapper; | ||
}; | ||
// Loads the graph as GraphSON, and returns promise to the graph (for fluent API). | ||
@@ -45,2 +67,9 @@ GraphWrapper.prototype.loadGraphSON = function (filename, callback) { | ||
.then(function (builder) { | ||
return self._newGraphSONMapper() | ||
.then(function (mapper) { | ||
var mapperQ = Q.nbind(builder.mapper, builder); | ||
return mapperQ(mapper); | ||
}); | ||
}) | ||
.then(function (builder) { | ||
var create = Q.nbind(builder.create, builder); | ||
@@ -62,2 +91,4 @@ return create(); | ||
var builder = this.java.callStaticMethodSync('com.tinkerpop.gremlin.structure.io.graphson.GraphSONReader', 'build'); | ||
var mapper = this._newGraphSONMapperSync(); | ||
builder.mapperSync(mapper); | ||
var reader = builder.createSync(); | ||
@@ -76,2 +107,9 @@ reader.readGraphSync(stream, this.graph); | ||
.then(function (builder) { | ||
return self._newGraphSONMapper() | ||
.then(function (mapper) { | ||
var mapperQ = Q.nbind(builder.mapper, builder); | ||
return mapperQ(mapper); | ||
}); | ||
}) | ||
.then(function (builder) { | ||
var create = Q.nbind(builder.create, builder); | ||
@@ -93,2 +131,4 @@ return create(); | ||
var builder = this.java.callStaticMethodSync('com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter', 'build'); | ||
var mapper = this._newGraphSONMapperSync(); | ||
builder.mapperSync(mapper); | ||
var writer = builder.createSync(); | ||
@@ -106,2 +146,9 @@ writer.writeGraphSync(stream, this.graph); | ||
.then(function (builder) { | ||
return self._newGraphSONMapper() | ||
.then(function (mapper) { | ||
var mapperQ = Q.nbind(builder.mapper, builder); | ||
return mapperQ(mapper); | ||
}); | ||
}) | ||
.then(function (builder) { | ||
var create = Q.nbind(builder.create, builder); | ||
@@ -133,2 +180,4 @@ return create(); | ||
var builder = this.java.callStaticMethodSync('com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter', 'build'); | ||
var mapper = this._newGraphSONMapperSync(); | ||
builder.mapperSync(mapper); | ||
var writer = builder.createSync(); | ||
@@ -135,0 +184,0 @@ writer.writeGraphSync(stream, this.graph); |
{ | ||
"name": "gremlin-v3", | ||
"description": "Gremlin for graph databases which implement the TinkerPop3 property graph data model.", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "gremlin", |
160775
3877