From dce99fa89005f20e23f58fbeed40f5298357e9af Mon Sep 17 00:00:00 2001 From: Abbas Cyclewala Date: Tue, 29 Jan 2019 14:23:22 +0530 Subject: [PATCH] fixed graph upsert --- package-lock.json | 2 +- package.json | 2 +- src/connectors/gremlin-connector.ts | 2 +- src/helpers/graphHelper.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31e2191..eaa0a50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "migrate-to-graph", - "version": "0.0.1", + "version": "0.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e311fbf..3f6125e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "migrate-to-graph", - "version": "0.0.1", + "version": "0.0.2", "description": "A tool to migrate existing database to a graph database", "license": "MIT", "repository": "https://github.com/Microsoft/MigrateToGraph", diff --git a/src/connectors/gremlin-connector.ts b/src/connectors/gremlin-connector.ts index 2edef96..2767983 100644 --- a/src/connectors/gremlin-connector.ts +++ b/src/connectors/gremlin-connector.ts @@ -125,7 +125,7 @@ export class GremlinConnector implements OutputConnector { } private vertexEdgeIterator(type: Etype, value: Vertex | Edge, callback: any) { - const id = value.properties ? value.properties.id : null; + const id = value.id; async.waterfall( [ diff --git a/src/helpers/graphHelper.ts b/src/helpers/graphHelper.ts index 2610de4..a11fece 100644 --- a/src/helpers/graphHelper.ts +++ b/src/helpers/graphHelper.ts @@ -8,13 +8,13 @@ export function getAddVertexQuery(vertexObj: Vertex): string { } export function getUpdateVertexQuery(vertexObj: Vertex): string { - const id = escapeSingleQuote(vertexObj.properties.id); + const id = escapeSingleQuote(vertexObj.id); const query = `g.V().hasId('${id}')`; return query + getPropertiesQuery(vertexObj); } export function getUpdateEdgeQuery(edgeObj: Edge): string { - const id = escapeSingleQuote(edgeObj.properties.id); + const id = escapeSingleQuote(edgeObj.id); const query = `g.E().hasId('${id}')`; return query + getPropertiesQuery(edgeObj); }