diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java index f91276b..8ce078f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java @@ -516,8 +516,18 @@ public class EntityManagementImpl implements EntityManagement { UUID targetUUID = targetHeader.getUUID(); String entityType = getClassProperty(target); - targetVertex = getEntity(orientGraph, targetUUID, entityType, + try { + targetVertex = getEntity(orientGraph, targetUUID, entityType, targetClass); + }catch(FacetNotFoundException e){ + /* Facet does not exist. Going to create it */ + targetVertex = createVertexEntity(orientGraph, + getClassProperty(target), Facet.class, + target.toString()); + + } catch (ResourceRegistryException e) { + throw e; + } } return targetVertex;