deleteSampleRelatedLinks(params, userName) {
    const sampleName = params.key.value;
    const parsedSampleName = parseName(sampleName);
    const aspectName = parsedSampleName.aspect.name;
    const now = new Date().toISOString();
    let currSampObj;
    let aspectObj;
    return redisOps.getHashPromise(sampleType, sampleName)
    .then((sampObj) => {
      if (!sampObj) {
        throw new redisErrors.ResourceNotFoundError({
          explanation: 'Sample not found.',
        });
      }

      currSampObj = sampObj;
      return redisOps.getHashPromise(aspectType, aspectName);
    })
    .then((aspObj) => {
      if (!aspObj) {
        throw new redisErrors.ResourceNotFoundError({
          explanation: 'Aspect not found.',
        });
      }

      aspectObj = sampleStore.arrayObjsStringsToJson(
        aspObj, constants.fieldsToStringify.aspect
      );

      return checkWritePermission(aspectObj, userName);
    })
    .then(() => {
      let updatedRlinks = [];
      if (params.relName) { // delete only this related link
        const currRlinks = JSON.parse(currSampObj.relatedLinks);
        updatedRlinks = u.deleteAJsonArrayElement(
          currRlinks, params.relName.value
        );
      }

      // if no change in related links, then return the object.
      if (JSON.stringify(updatedRlinks) ===
        JSON.stringify(currSampObj.relatedLinks)) {
        Promise.resolve(cleanAddAspectToSample(currSampObj, aspectObj));
      }

      const hmsetObj = {};
      hmsetObj.relatedLinks = updatedRlinks;
      hmsetObj.updatedAt = now;

      // stringify arrays
      constants.fieldsToStringify.sample.forEach((field) => {
        if (hmsetObj[field]) {
          hmsetObj[field] = JSON.stringify(hmsetObj[field]);
        }
      });

      return redisOps.setHashMultiPromise(sampleType, sampleName, hmsetObj);
    })
    .then(() => redisOps.getHashPromise(sampleType, sampleName))
    .then((updatedSamp) => cleanAddAspectToSample(updatedSamp, aspectObj));
  }
/**
   * Delete sample related links
   * @param  {Object} params - Request parameters
   * @param {String} userName - The user performing the write operation
   * @returns {Promise} - Resolves to a sample object
   */
Delete sample related links
@param  {Object} params - Request parameters
@param {String} userName - The user performing the write operation
@returns {Promise} - Resolves to a sample object
Delete sample related links @param { Object } params - Request parameters @param { String } userName - The user performing the write operation @returns { Promise } - Resolves to a sample object
deleteSampleRelatedLinks(params, userName) {
    const sampleName = params.key.value;
    const parsedSampleName = parseName(sampleName);
    const aspectName = parsedSampleName.aspect.name;
    const now = new Date().toISOString();
    let currSampObj;
    let aspectObj;
    return redisOps.getHashPromise(sampleType, sampleName)
    .then((sampObj) => {
      if (!sampObj) {
        throw new redisErrors.ResourceNotFoundError({
          explanation: 'Sample not found.',
        });
      }
      currSampObj = sampObj;
      return redisOps.getHashPromise(aspectType, aspectName);
    })
    .then((aspObj) => {
      if (!aspObj) {
        throw new redisErrors.ResourceNotFoundError({
          explanation: 'Aspect not found.',
        });
      }
      aspectObj = sampleStore.arrayObjsStringsToJson(
        aspObj, constants.fieldsToStringify.aspect
      );
      return checkWritePermission(aspectObj, userName);
    })
    .then(() => {
      let updatedRlinks = [];
      if (params.relName) { 
        const currRlinks = JSON.parse(currSampObj.relatedLinks);
        updatedRlinks = u.deleteAJsonArrayElement(
          currRlinks, params.relName.value
        );
      }
      if (JSON.stringify(updatedRlinks) ===
        JSON.stringify(currSampObj.relatedLinks)) {
        Promise.resolve(cleanAddAspectToSample(currSampObj, aspectObj));
      }
      const hmsetObj = {};
      hmsetObj.relatedLinks = updatedRlinks;
      hmsetObj.updatedAt = now;
      constants.fieldsToStringify.sample.forEach((field) => {
        if (hmsetObj[field]) {
          hmsetObj[field] = JSON.stringify(hmsetObj[field]);
        }
      });
      return redisOps.setHashMultiPromise(sampleType, sampleName, hmsetObj);
    })
    .then(() => redisOps.getHashPromise(sampleType, sampleName))
    .then((updatedSamp) => cleanAddAspectToSample(updatedSamp, aspectObj));
  }
deleteSampleRelatedLinks ( params , userName ) { const sampleName = params . key . value ; const parsedSampleName = parseName ( sampleName ) ; const aspectName = parsedSampleName . aspect . name ; const now = new Date ( ) . toISOString ( ) ; let currSampObj ; let aspectObj ; return redisOps . getHashPromise ( sampleType , sampleName ) . then ( ( sampObj ) => { if ( ! sampObj ) { throw new redisErrors . ResourceNotFoundError ( { explanation : 'Sample not found.' , } ) ; } currSampObj = sampObj ; return redisOps . getHashPromise ( aspectType , aspectName ) ; } ) . then ( ( aspObj ) => { if ( ! aspObj ) { throw new redisErrors . ResourceNotFoundError ( { explanation : 'Aspect not found.' , } ) ; } aspectObj = sampleStore . arrayObjsStringsToJson ( aspObj , constants . fieldsToStringify . aspect ) ; return checkWritePermission ( aspectObj , userName ) ; } ) . then ( ( ) => { let updatedRlinks = [ ] ; if ( params . relName ) { const currRlinks = JSON . parse ( currSampObj . relatedLinks ) ; updatedRlinks = u . deleteAJsonArrayElement ( currRlinks , params . relName . value ) ; } if ( JSON . stringify ( updatedRlinks ) === JSON . stringify ( currSampObj . relatedLinks ) ) { Promise . resolve ( cleanAddAspectToSample ( currSampObj , aspectObj ) ) ; } const hmsetObj = { } ; hmsetObj . relatedLinks = updatedRlinks ; hmsetObj . updatedAt = now ; constants . fieldsToStringify . sample . forEach ( ( field ) => { if ( hmsetObj [ field ] ) { hmsetObj [ field ] = JSON . stringify ( hmsetObj [ field ] ) ; } } ) ; return redisOps . setHashMultiPromise ( sampleType , sampleName , hmsetObj ) ; } ) . then ( ( ) => redisOps . getHashPromise ( sampleType , sampleName ) ) . then ( ( updatedSamp ) => cleanAddAspectToSample ( updatedSamp , aspectObj ) ) ; }
Delete sample related links
 @param  {Object} params - Request parameters
 @param {String} userName - The user performing the write operation
 @returns {Promise} - Resolves to a sample object
Delete sample related links @param { Object } params - Request parameters @param { String } userName - The user performing the write operation @returns { Promise } - Resolves to a sample object
// delete only this related link // if no change in related links, then return the object. // stringify arrays