/**
   * Deleting any type vertex. Goes over the complex attributes and removes the references
   *
   * @param instanceVertex
   * @throws AtlasException
   */
  protected void deleteTypeVertex(Vertex instanceVertex, boolean force) throws AtlasException {
    LOG.debug("Deleting {}", string(instanceVertex));
    String typeName = GraphHelper.getTypeName(instanceVertex);
    IDataType type = typeSystem.getDataType(IDataType.class, typeName);
    FieldMapping fieldMapping = getFieldMapping(type);

    for (AttributeInfo attributeInfo : fieldMapping.fields.values()) {
      LOG.debug("Deleting attribute {} for {}", attributeInfo.name, string(instanceVertex));
      String edgeLabel = GraphHelper.getEdgeLabel(type, attributeInfo);

      switch (attributeInfo.dataType().getTypeCategory()) {
        case CLASS:
          // If its class attribute, delete the reference
          deleteEdgeReference(
              instanceVertex, edgeLabel, DataTypes.TypeCategory.CLASS, attributeInfo.isComposite);
          break;

        case STRUCT:
          // If its struct attribute, delete the reference
          deleteEdgeReference(instanceVertex, edgeLabel, DataTypes.TypeCategory.STRUCT, false);
          break;

        case ARRAY:
          // For array attribute, if the element is struct/class, delete all the references
          IDataType elementType = ((DataTypes.ArrayType) attributeInfo.dataType()).getElemType();
          DataTypes.TypeCategory elementTypeCategory = elementType.getTypeCategory();
          if (elementTypeCategory == DataTypes.TypeCategory.STRUCT
              || elementTypeCategory == DataTypes.TypeCategory.CLASS) {
            Iterator<Edge> edges = GraphHelper.getOutGoingEdgesByLabel(instanceVertex, edgeLabel);
            if (edges != null) {
              while (edges.hasNext()) {
                Edge edge = edges.next();
                deleteEdgeReference(
                    edge, elementType.getTypeCategory(), attributeInfo.isComposite, false);
              }
            }
          }
          break;

        case MAP:
          // For map attribute, if the value type is struct/class, delete all the references
          DataTypes.MapType mapType = (DataTypes.MapType) attributeInfo.dataType();
          DataTypes.TypeCategory valueTypeCategory = mapType.getValueType().getTypeCategory();
          String propertyName = GraphHelper.getQualifiedFieldName(type, attributeInfo.name);

          if (valueTypeCategory == DataTypes.TypeCategory.STRUCT
              || valueTypeCategory == DataTypes.TypeCategory.CLASS) {
            List<String> keys = instanceVertex.getProperty(propertyName);
            if (keys != null) {
              for (String key : keys) {
                String mapEdgeLabel = GraphHelper.getQualifiedNameForMapKey(edgeLabel, key);
                deleteEdgeReference(
                    instanceVertex, mapEdgeLabel, valueTypeCategory, attributeInfo.isComposite);
              }
            }
          }
      }
    }

    deleteVertex(instanceVertex, force);
  }
 @Override
 public String getEdgeLabel(IDataType<?> dataType, AttributeInfo aInfo) throws AtlasException {
   return GraphHelper.getEdgeLabel(dataType, aInfo);
 }