/*
  * Example with association:
  *
  * MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (e)
  * DELETE r
  *
  * Example with embedded collection:
  *
  * MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (e:EMBEDDED)
  * DELETE r, e
  *
  * Example with indexes:
  *
  * MATCH (n:ENTITY:table {id: {0}}) -[r:role {index: {1}}] - (e)
  * DELETE r
  */
 private static String initRemoveAssociationRowQuery(
     EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
   StringBuilder queryBuilder = new StringBuilder("MATCH ");
   queryBuilder.append("(n:");
   queryBuilder.append(ENTITY);
   queryBuilder.append(":");
   appendLabel(ownerEntityKeyMetadata, queryBuilder);
   appendProperties(ownerEntityKeyMetadata, queryBuilder);
   queryBuilder.append(") - ");
   queryBuilder.append("[r");
   queryBuilder.append(":");
   appendRelationshipType(queryBuilder, associationKeyMetadata);
   int offset = ownerEntityKeyMetadata.getColumnNames().length;
   boolean hasIndexColumns = associationKeyMetadata.getRowKeyIndexColumnNames().length > 0;
   if (hasIndexColumns) {
     appendProperties(queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset);
   }
   queryBuilder.append("] - (e");
   if (associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION) {
     queryBuilder.append(":");
     queryBuilder.append(EMBEDDED);
   }
   if (!hasIndexColumns) {
     appendProperties(
         queryBuilder,
         associationKeyMetadata
             .getAssociatedEntityKeyMetadata()
             .getEntityKeyMetadata()
             .getColumnNames(),
         offset);
   }
   queryBuilder.append(")");
   queryBuilder.append(" DELETE r");
   if (associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION) {
     queryBuilder.append(", e");
   }
   return queryBuilder.toString();
 }
 /*
  * Example with association:
  *
  * MATCH (n:ENTITY:table {id: {0}}) -[r:role] - ()
  * DELETE r
  *
  * Example with embedded:
  *
  * MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (e:EMBEDDED)
  * DELETE r, e
  */
 private static String initRemoveAssociationQuery(
     EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
   StringBuilder queryBuilder = new StringBuilder("MATCH ");
   queryBuilder.append("(n:");
   queryBuilder.append(ENTITY);
   queryBuilder.append(":");
   appendLabel(ownerEntityKeyMetadata, queryBuilder);
   appendProperties(ownerEntityKeyMetadata, queryBuilder);
   queryBuilder.append(") - ");
   queryBuilder.append("[r");
   queryBuilder.append(":");
   appendRelationshipType(queryBuilder, associationKeyMetadata);
   queryBuilder.append("]");
   if (associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION) {
     queryBuilder.append(" - (e:");
     queryBuilder.append(EMBEDDED);
     queryBuilder.append(") DELETE r, e");
   } else {
     queryBuilder.append(" - () DELETE r");
   }
   return queryBuilder.toString();
 }