code: function _removeBase(base, iri) {
    if(_isString(base)) {
      base = jsonld.url.parse(base || '');
    }
  
    // establish base root
    var root = '';
    if(base.href !== '') {
      root += (base.protocol || '') + '//' + base.authority;
    }
    // support network-path reference with empty base
    else if(iri.indexOf('//')) {
      root += '//';
    }
  
    // IRI not relative to base
    if(iri.indexOf(root) !== 0) {
      return iri;
    }
  
    // remove root from IRI and parse remainder
    var rel = jsonld.url.parse(iri.substr(root.length));
  
    // remove path segments that match
    var baseSegments = base.normalizedPath.split('/');
    var iriSegments = rel.normalizedPath.split('/');
  
    while(baseSegments.length > 0 && iriSegments.length > 0) {
      if(baseSegments[0] !== iriSegments[0]) {
        break;
      }
      baseSegments.shift();
      iriSegments.shift();
    }
  
    // use '../' for each non-matching base segment
    var rval = '';
    if(baseSegments.length > 0) {
      // don't count the last segment if it isn't a path (doesn't end in '/')
      // don't count empty first segment, it means base began with '/'
      if(base.normalizedPath.substr(-1) !== '/' || baseSegments[0] === '') {
        baseSegments.pop();
      }
      for(var i = 0; i < baseSegments.length; ++i) {
        rval += '../';
      }
    }
  
    // prepend remaining segments
    rval += iriSegments.join('/');
  
    // add query and hash
    if(rel.query) {
      rval += '?' + rel.query;
    }
    if(rel.hash) {
      rval += rel.hash;
    }
  
    if(rval === '') {
      rval = './';
    }
  
    return rval;
  }
docs: Removes a base IRI from the given absolute IRI.
  
  @param base the base IRI.
  @param iri the absolute IRI.
  
  @return the relative IRI if relative to base, otherwise the absolute IRI.