code: function mapResources (resources) {
      var result = {};
  
      resources.forEach(function (r) {
        result[r.urn] = r;
      });
  
      var categorisations = resources.filter(function (r) { return r.class === 'Categorisation'; });
      var dataflows = resources.filter(function (r) { return r.class === 'Dataflow'; });
      var categoryschemes = resources.filter(function (r) { return r.class === 'CategoryScheme'; });
      var categories = [];
  
      function getCategories (c) {
        if (c.items === undefined) return;
        c.items.forEach(getCategories);
        categories = categories.concat(c.items);
      }
  
      categoryschemes.forEach(getCategories);
  
      var categoryMap = {};
      categories.forEach(function (c) { categoryMap[c.urn] = c; });
  
      categorisations.forEach(function (c) {
        var source = result[c.source.href];
        var target = categoryMap[c.target.href];
        if (target === undefined) return;
        if (target.children === undefined) target.children = [];
        target.children.push(source);
      });
  
      return result;
    }
docs: ------------------------------------------------------------------------------ Functions for pre-processing responses