tasks/jsonld/js/jsonld.js
function hashBlankNodes(unnamed) {
    var nextUnnamed = [];
    var duplicates = {};
    var unique = {};

    // hash quads for each unnamed bnode
    jsonld.setImmediate(function() {hashUnnamed(0);});
    function hashUnnamed(i) {
      if(i === unnamed.length) {
        // done, name blank nodes
        return nameBlankNodes(unique, duplicates, nextUnnamed);
      }

      // hash unnamed bnode
      var bnode = unnamed[i];
      var hash = _hashQuads(bnode, bnodes, namer);

      // store hash as unique or a duplicate
      if(hash in duplicates) {
        duplicates[hash].push(bnode);
        nextUnnamed.push(bnode);
      }
      else if(hash in unique) {
        duplicates[hash] = [unique[hash], bnode];
        nextUnnamed.push(unique[hash]);
        nextUnnamed.push(bnode);
        delete unique[hash];
      }
      else {
        unique[hash] = bnode;
      }

      // hash next unnamed bnode
      jsonld.setImmediate(function() {hashUnnamed(i + 1);});
    }
  }
function hashBlankNodes(unnamed) {
    var nextUnnamed = [];
    var duplicates = {};
    var unique = {};

    // hash quads for each unnamed bnode
    jsonld.setImmediate(function() {hashUnnamed(0);});
    function hashUnnamed(i) {
      if(i === unnamed.length) {
        // done, name blank nodes
        return nameBlankNodes(unique, duplicates, nextUnnamed);
      }

      // hash unnamed bnode
      var bnode = unnamed[i];
      var hash = _hashQuads(bnode, bnodes, namer);

      // store hash as unique or a duplicate
      if(hash in duplicates) {
        duplicates[hash].push(bnode);
        nextUnnamed.push(bnode);
      }
      else if(hash in unique) {
        duplicates[hash] = [unique[hash], bnode];
        nextUnnamed.push(unique[hash]);
        nextUnnamed.push(bnode);
        delete unique[hash];
      }
      else {
        unique[hash] = bnode;
      }

      // hash next unnamed bnode
      jsonld.setImmediate(function() {hashUnnamed(i + 1);});
    }
  }
function hashBlankNodes ( unnamed ) { var nextUnnamed = [ ] ; var duplicates = { } ; var unique = { } ; // hash quads for each unnamed bnode jsonld . setImmediate ( function ( ) { hashUnnamed ( 0 ) ; } ) ; function hashUnnamed ( i ) { if ( i === unnamed . length ) { // done, name blank nodes return nameBlankNodes ( unique , duplicates , nextUnnamed ) ; } // hash unnamed bnode var bnode = unnamed [ i ] ; var hash = _hashQuads ( bnode , bnodes , namer ) ; // store hash as unique or a duplicate if ( hash in duplicates ) { duplicates [ hash ] . push ( bnode ) ; nextUnnamed . push ( bnode ) ; } else if ( hash in unique ) { duplicates [ hash ] = [ unique [ hash ] , bnode ] ; nextUnnamed . push ( unique [ hash ] ) ; nextUnnamed . push ( bnode ) ; delete unique [ hash ] ; } else { unique [ hash ] = bnode ; } // hash next unnamed bnode jsonld . setImmediate ( function ( ) { hashUnnamed ( i + 1 ) ; } ) ; } }
generates unique and duplicate hashes for bnodes
generates unique and duplicate hashes for bnodes