}
VisibilityJson visibilityJson = GraphUtil.updateVisibilitySourceAndAddWorkspaceId(null, visibilitySource, workspaceId);
LumifyVisibility lumifyVisibility = visibilityTranslator.toVisibility(visibilityJson);
Concept concept = ontologyRepository.getConceptByIRI(conceptId);
Vertex artifactVertex = graph.getVertex(artifactId, authorizations);
ElementMutation<Vertex> resolvedVertexMutation;
Map<String, Object> metadata = new HashMap<String, Object>();
LumifyProperties.VISIBILITY_JSON.setMetadata(metadata, visibilityJson);
Vertex resolvedVertex;
if (graphVertexId == null || graphVertexId.equals("")) {
resolvedVertexMutation = graph.prepareVertex(lumifyVisibility.getVisibility());
LumifyProperties.CONCEPT_TYPE.setProperty(resolvedVertexMutation, concept.getTitle(), metadata, lumifyVisibility.getVisibility());
LumifyProperties.TITLE.setProperty(resolvedVertexMutation, title, metadata, lumifyVisibility.getVisibility());
resolvedVertex = resolvedVertexMutation.save(authorizations);
auditRepository.auditVertexElementMutation(AuditAction.UPDATE, resolvedVertexMutation, resolvedVertex, "", user, lumifyVisibility.getVisibility());
GraphUtil.addJustificationToMutation(resolvedVertexMutation, justificationText, sourceInfo, lumifyVisibility);
resolvedVertex = resolvedVertexMutation.save(authorizations);
auditRepository.auditVertexElementMutation(AuditAction.UPDATE, resolvedVertexMutation, resolvedVertex, "", user, lumifyVisibility.getVisibility());
LumifyProperties.VISIBILITY_JSON.setProperty(resolvedVertexMutation, visibilityJson, metadata, lumifyVisibility.getVisibility());
graph.flush();
workspaceRepository.updateEntityOnWorkspace(workspace, resolvedVertex.getId(), false, null, user);
} else {
resolvedVertex = graph.getVertex(graphVertexId, authorizations);
resolvedVertexMutation = resolvedVertex.prepareMutation();
}
Edge edge = graph.addEdge(artifactVertex, resolvedVertex, artifactContainsImageOfEntityIri, lumifyVisibility.getVisibility(), authorizations);
LumifyProperties.VISIBILITY_JSON.setProperty(edge, visibilityJson, metadata, lumifyVisibility.getVisibility(), authorizations);
auditRepository.auditRelationship(AuditAction.CREATE, artifactVertex, resolvedVertex, edge, "", "", user, lumifyVisibility.getVisibility());
ArtifactDetectedObject artifactDetectedObject = new ArtifactDetectedObject(
x1,
y1,
x2,
y2,
concept.getIRI(),
"user",
edge.getId(),
resolvedVertex.getId(),
originalPropertyKey);
String propertyKey = artifactDetectedObject.getMultivalueKey(MULTI_VALUE_KEY_PREFIX);