code: function _prependBase(base, iri) {
    // already an absolute IRI
    if(iri.indexOf(':') !== -1) {
      return iri;
    }
  
    // parse base if it is a string
    if(_isString(base)) {
      base = jsonld.url.parse(base || '');
    }
  
    // parse given IRI
    var rel = jsonld.url.parse(iri);
  
    // start hierarchical part
    var hierPart = (base.protocol || '');
    if(rel.authority) {
      hierPart += '//' + rel.authority;
    }
    else if(base.href !== '') {
      hierPart += '//' + base.authority;
    }
  
    // per RFC3986 normalize
    var path;
  
    // IRI represents an absolute path
    if(rel.pathname.indexOf('/') === 0) {
      path = rel.pathname;
    }
    else {
      path = base.pathname;
  
      // append relative path to the end of the last directory from base
      if(rel.pathname !== '') {
        path = path.substr(0, path.lastIndexOf('/') + 1);
        if(path.length > 0 && path.substr(-1) !== '/') {
          path += '/';
        }
        path += rel.pathname;
      }
    }
  
    // remove slashes and dots in path
    path = _removeDotSegments(path, hierPart !== '');
  
    // add query and hash
    if(rel.query) {
      path += '?' + rel.query;
    }
    if(rel.hash) {
      path += rel.hash;
    }
  
    var rval = hierPart + path;
  
    if(rval === '') {
      rval = './';
    }
  
    return rval;
  }
docs: Prepends a base IRI to the given relative IRI.
  
  @param base the base IRI.
  @param iri the relative IRI.
  
  @return the absolute IRI.