From 6058eddfe4bc101dc67d150561665d1a3aa801ab Mon Sep 17 00:00:00 2001 From: Shashank Teotia Date: Fri, 6 Jul 2018 09:35:11 +0530 Subject: [PATCH] Issue #157 feat: minor bug with node labelling --- .../opensaber/registry/dao/impl/RegistryDaoImpl.java | 4 ++-- .../registry/dao/impl/RegistryDaoImplTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java b/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java index f3185b030..3b2442658 100644 --- a/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java +++ b/java/registry/src/main/java/io/opensaber/registry/dao/impl/RegistryDaoImpl.java @@ -191,7 +191,7 @@ private String addOrUpdateVerticesAndEdges(Graph dbGraph, throw new RecordNotFoundException(Constants.ENTITY_NOT_FOUND); } logger.info(String.format("Creating entity with label {}", rootLabel)); - Vertex newVertex = dbGraph.addVertex(); + Vertex newVertex = dbGraph.addVertex("Entity"); newVertex.property(internalPropertyKey("label"),generateNamespacedLabel(rootLabel)); label = generateNamespacedLabel(newVertex.id().toString()); // newVertex.property(internalPropertyKey("label"),label); @@ -286,7 +286,7 @@ private void addOrUpdateVertexAndEdge(Vertex sourceVertex, Vertex dbVertex, Grap throw new RecordNotFoundException(Constants.ENTITY_NOT_FOUND); } String label = generateBlankNodeLabel(label(sourceInVertex)); - Vertex newDBVertex = dbGraph.addVertex(label);//dbGraph.addVertex(label); + Vertex newDBVertex = dbGraph.addVertex("Entity");//dbGraph.addVertex(label); newDBVertex.property(internalPropertyKey("label"),label); setAuditInfo(sourceInVertex, true); logger.debug(String.format("RegistryDaoImpl : Adding vertex with label {} and adding properties", label(newDBVertex))); diff --git a/java/registry/src/test/java/io/opensaber/registry/dao/impl/RegistryDaoImplTest.java b/java/registry/src/test/java/io/opensaber/registry/dao/impl/RegistryDaoImplTest.java index a54267ab6..19b157658 100644 --- a/java/registry/src/test/java/io/opensaber/registry/dao/impl/RegistryDaoImplTest.java +++ b/java/registry/src/test/java/io/opensaber/registry/dao/impl/RegistryDaoImplTest.java @@ -295,9 +295,9 @@ public void test_adding_shared_nodes_with_new_properties() throws DuplicateRecor Model newRdfModel = getNewValidRdf(); updateNodeLabel(newRdfModel, "http://example.com/voc/teacher/1.0.0/IndianUrbanPostalAddress"); - String addressLabel = databaseProvider.getGraphStore().traversal().clone().V() + String addressLabel = String.valueOf(databaseProvider.getGraphStore().traversal().clone().V() .has(internalPropertyKey("label"), "http://example.com/voc/teacher/1.0.0/IndianUrbanPostalAddress") - .next().vertices(Direction.IN).next().label(); + .next().vertices(Direction.IN).next().property(internalPropertyKey("label")).value()); // Add a new property to the existing address node Resource resource = ResourceFactory.createResource(addressLabel); @@ -338,9 +338,9 @@ public void test_adding_shared_nodes_with_updated_properties() throws DuplicateR updateNodeLabel(newRdfModel, "http://example.com/voc/teacher/1.0.0/IndianUrbanPostalAddress"); removeStatementFromModel(newRdfModel, ResourceFactory.createProperty("http://example.com/voc/teacher/1.0.0/municipality")); - String addressLabel = databaseProvider.getGraphStore().traversal().clone().V() + String addressLabel = String.valueOf(databaseProvider.getGraphStore().traversal().clone().V() .has(internalPropertyKey("label"), "http://example.com/voc/teacher/1.0.0/IndianUrbanPostalAddress") - .next().vertices(Direction.IN).next().label(); + .next().vertices(Direction.IN).next().property(internalPropertyKey("label")).value()); // Add a new property to the existing address node Resource resource = ResourceFactory.createResource(addressLabel); @@ -816,9 +816,9 @@ public void savingMetaProperties() throws DuplicateRecordException, RecordNotFou } private void updateNodeLabel(Model rdfModel, String nodeLabel) { - String labelForUpdate = databaseProvider.getGraphStore().traversal().clone().V() + String labelForUpdate = String.valueOf(databaseProvider.getGraphStore().traversal().clone().V() .has(internalPropertyKey("label"), nodeLabel) - .next().vertices(Direction.IN).next().label(); + .next().vertices(Direction.IN).next().property(internalPropertyKey("label")).value()); RDFUtil.updateRdfModelNodeId(rdfModel, ResourceFactory.createResource(nodeLabel), labelForUpdate); }