Skip to content

Commit

Permalink
Issue #157 feat: minor bug with node labelling
Browse files Browse the repository at this point in the history
  • Loading branch information
steotia committed Jul 6, 2018
1 parent e831d9b commit 6058edd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6058edd

Please sign in to comment.