outline/userInput.js
function deleteTriple (selectedTd, isBackOut) {
    // ToDo: complete deletion of a node
      UI.log.debug('deleteTriple entered')

        // allow a pending node to be deleted if it's a backout sent by SPARQL update callback
      if (!isBackOut && selectedTd.className.indexOf(' pendingedit') !== -1) {
        console.log('The node you attempted to edit has a request still pending.\n' +
                  'Please wait for the request to finish (the text will turn black)\n' +
                  'before editing this node again.')
        outline.walk('up')
        return
      }
      var removedTr
      // var afterTr
      var s = this.getStatementAbout(selectedTd)
      if (!isBackOut &&
            !kb.whether(s.object, rdf('type'), UI.ns.link('Request')) &&
            // Better to check whether provenance is internal?
            !kb.whether(s.predicate, rdf('type'), UI.ns.link('Request')) &&
            !kb.whether(s.subject, rdf('type'), UI.ns.link('Request'))) {
        UI.log.debug('about to send SPARQLUpdate')
        try {
          UI.store.updater.update([s], [], function (uri, success, errorBody) {
            if (success) {
              removefromview()
            } else {
                        // removedTr.AJAR_statement=kb.add(s.subject,s.predicate,s.object,s.why);
              console.log('Error occurs while deleting ' + s + '\n\n' + errorBody)
              selectedTd.className = selectedTd.className.replace(/ pendingedit/g, '')
            }
          })
          selectedTd.className += ' pendingedit'
        } catch (e) {
          UI.log.error(e)
          UI.log.warn('Error deleting statement ' + s + ':\n\t' + e)
          return
        }

        UI.log.debug('SPARQLUpdate sent')
      } else { // removal of an undetermined statement associated with pending TRs
            // TempFormula.remove(s);
      }
      UI.log.debug('about to remove ' + s)

      UI.log.debug('removed')
      outline.walk('up')
      removedTr = selectedTd.parentNode
      // afterTr = removedTr.nextSibling
      function removefromview () {
        var trIterator
        for (trIterator = removedTr;
             trIterator.childNodes.length === 1;
             trIterator = trIterator.previousSibling);
        if (trIterator === removedTr) {
          var theNext = trIterator.nextSibling
          if (theNext.nextSibling && theNext.childNodes.length === 1) {
            var predicateTd = trIterator.firstChild
            predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1)
            theNext.insertBefore(trIterator.firstChild, theNext.firstChild)
          }
          removedTr.parentNode.removeChild(removedTr)
        } else { // !DisplayOptions["display:block on"].enabled){
          predicateTd = trIterator.firstChild
          predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1)
          removedTr.parentNode.removeChild(removedTr)
        }
      }
      if (isBackOut) removefromview()
    }
function deleteTriple (selectedTd, isBackOut) {
    // ToDo: complete deletion of a node
      UI.log.debug('deleteTriple entered')

        // allow a pending node to be deleted if it's a backout sent by SPARQL update callback
      if (!isBackOut && selectedTd.className.indexOf(' pendingedit') !== -1) {
        console.log('The node you attempted to edit has a request still pending.\n' +
                  'Please wait for the request to finish (the text will turn black)\n' +
                  'before editing this node again.')
        outline.walk('up')
        return
      }
      var removedTr
      // var afterTr
      var s = this.getStatementAbout(selectedTd)
      if (!isBackOut &&
            !kb.whether(s.object, rdf('type'), UI.ns.link('Request')) &&
            // Better to check whether provenance is internal?
            !kb.whether(s.predicate, rdf('type'), UI.ns.link('Request')) &&
            !kb.whether(s.subject, rdf('type'), UI.ns.link('Request'))) {
        UI.log.debug('about to send SPARQLUpdate')
        try {
          UI.store.updater.update([s], [], function (uri, success, errorBody) {
            if (success) {
              removefromview()
            } else {
                        // removedTr.AJAR_statement=kb.add(s.subject,s.predicate,s.object,s.why);
              console.log('Error occurs while deleting ' + s + '\n\n' + errorBody)
              selectedTd.className = selectedTd.className.replace(/ pendingedit/g, '')
            }
          })
          selectedTd.className += ' pendingedit'
        } catch (e) {
          UI.log.error(e)
          UI.log.warn('Error deleting statement ' + s + ':\n\t' + e)
          return
        }

        UI.log.debug('SPARQLUpdate sent')
      } else { // removal of an undetermined statement associated with pending TRs
            // TempFormula.remove(s);
      }
      UI.log.debug('about to remove ' + s)

      UI.log.debug('removed')
      outline.walk('up')
      removedTr = selectedTd.parentNode
      // afterTr = removedTr.nextSibling
      function removefromview () {
        var trIterator
        for (trIterator = removedTr;
             trIterator.childNodes.length === 1;
             trIterator = trIterator.previousSibling);
        if (trIterator === removedTr) {
          var theNext = trIterator.nextSibling
          if (theNext.nextSibling && theNext.childNodes.length === 1) {
            var predicateTd = trIterator.firstChild
            predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1)
            theNext.insertBefore(trIterator.firstChild, theNext.firstChild)
          }
          removedTr.parentNode.removeChild(removedTr)
        } else { // !DisplayOptions["display:block on"].enabled){
          predicateTd = trIterator.firstChild
          predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1)
          removedTr.parentNode.removeChild(removedTr)
        }
      }
      if (isBackOut) removefromview()
    }
/* deletes the triple corresponding to selectedTd, remove that Td.