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( "[a" );
		queryBuilder.append( ":" );
		appendRelationshipType( queryBuilder, associationKeyMetadata );
		queryBuilder.append( "]" );
		if ( associationKeyMetadata.getAssociationKind() == AssociationKind.EMBEDDED_COLLECTION ) {
			queryBuilder.append( " - (e:" );
			queryBuilder.append( EMBEDDED );
			queryBuilder.append( ")" );
			queryBuilder.append( " WITH a,e" );
			queryBuilder.append( "  MATCH path=(e) -[*0..]-> (:EMBEDDED) " );
			queryBuilder.append( "  FOREACH ( r IN relationships(path) | DELETE r )" );
			queryBuilder.append( "  FOREACH ( e IN nodes(path) | DELETE e )" );
			queryBuilder.append( "  DELETE a" );
		}
		else {
			queryBuilder.append( " - () DELETE a" );
		}
		return queryBuilder.toString();
	}
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 ( "[a" ) ; queryBuilder . append ( ":" ) ; appendRelationshipType ( queryBuilder , associationKeyMetadata ) ; queryBuilder . append ( "]" ) ; if ( associationKeyMetadata . getAssociationKind ( ) == AssociationKind . EMBEDDED_COLLECTION ) { queryBuilder . append ( " - (e:" ) ; queryBuilder . append ( EMBEDDED ) ; queryBuilder . append ( ")" ) ; queryBuilder . append ( " WITH a,e" ) ; queryBuilder . append ( "  MATCH path=(e) -[*0..]-> (:EMBEDDED) " ) ; queryBuilder . append ( "  FOREACH ( r IN relationships(path) | DELETE r )" ) ; queryBuilder . append ( "  FOREACH ( e IN nodes(path) | DELETE e )" ) ; queryBuilder . append ( "  DELETE a" ) ; } else { queryBuilder . append ( " - () DELETE a" ) ; } return queryBuilder . toString ( ) ; }
/*
Example with association:

MATCH (n:ENTITY:table {id: {0}}) -[r:role] - ()
DELETE r

Example with an embedded association:

MATCH (n:ENTITY:table {id: {0}}) -[a:role] - (e:EMBEDDED)
WITH a, e MATCH path=(e) -[*0..]-> (:EMBEDDED)
FOREACH (r IN relationships(path) | DELETE r)
FOREACH (e IN nodes(path) | DELETE e)
DELETE a