Determines the correct URI part if two branches are joined.
497076
private static UriPart unionUriParts(UriPart a, UriPart b) {
    Preconditions.checkArgument(a != b);
    if (a == UriPart.DANGEROUS_SCHEME || b == UriPart.DANGEROUS_SCHEME) {
      // Dangerous schemes (like javascript:) are poison -- if either side is dangerous, the whole
      // thing is.
      return UriPart.DANGEROUS_SCHEME;
    } else if (a == UriPart.FRAGMENT
        || b == UriPart.FRAGMENT
        || a == UriPart.UNKNOWN
        || b == UriPart.UNKNOWN) {
      // UNKNOWN means one part is in the #fragment and one is not. This is the case if one is
      // FRAGMENT and the other is not, or if one of the branches was UNKNOWN to begin with.
      return UriPart.UNKNOWN;
    } else if ((a == UriPart.MAYBE_VARIABLE_SCHEME || b == UriPart.MAYBE_VARIABLE_SCHEME)
        && a != UriPart.UNKNOWN_PRE_FRAGMENT
        && b != UriPart.UNKNOWN_PRE_FRAGMENT) {
      // This is the case you might see on a URL that starts with a print statement, and one
      // branch has a slash or ampersand but the other doesn't.  Re-entering
      // MAYBE_VARIABLE_SCHEME allows us to pretend that the last branch was just part of the
      // leading print statement, which leaves us in a relatively-unknown state, but no more
      // unknown had it just been completely opaque.
      //
      // Good Example 1: {$urlWithQuery}{if $a}&a={$a}{/if}{if $b}&b={$b}{/if}
      // In this example, the first "if" statement has two branches:
      // - "true": {$urlWithQuery}&a={$a} looks like a QUERY due to hueristics
      // - "false": {$urlWithQuery} only, which Soy doesn't know at compile-time to actually
      // have a query, and it remains in MAYBE_VARIABLE_SCHEME.
      // Instead of yielding UNKNOWN, this yields MAYBE_VARIABLE_SCHEME, which the second
      // {if $b} can safely deal with.
      //
      // Good Example 2: {$base}{if $a}/a{/if}{if $b}/b{/if}
      // In this, one branch transitions definitely into an authority or path, but the other
      // might not. However, we can remain in MAYBE_VARIABLE_SCHEME safely.
      return UriPart.MAYBE_VARIABLE_SCHEME;
    } else {
      // The part is unknown, but we think it's before the fragment. In this case, it's clearly
      // ambiguous at compile-time that it's not clear what to do. Examples:
      //
      // /foo/{if $cond}?a={/if}
      // {$base}{if $cond}?a={$a}{else}/b{/if}
      // {if $cond}{$base}{else}/a{if $cond2}?b=1{/if}{/if}
      //
      // Unlike MAYBE_VARIABLE_SCHEME, we don't need to try to gracefully recover here, because
      // the template author can easily disambiguate this.
      return UriPart.UNKNOWN_PRE_FRAGMENT;
    }
  }
199090
public String resolveRelativeUri(String uri) {
        // sometimes we get uri's massaged from File(String), so check for
        // a root directory separator char
        if (uri.startsWith("/") || uri.startsWith(File.separator)) {
            return uri;
        } else {
            return baseURI + uri;
        }
    }
1307628
protected URI buildUrn(String... parts) {
        UrnBuilder builder = new UrnBuilder("UTF-8", "tincan", "uportal", "activities");
        builder.add(parts);

        return builder.getUri();
    }
927406
function checkUri1(i) {
  const start = i;
  let l;

  if (l = checkSC(i)) i += l;

  while (i < tokensLength) {
    if (l = checkInterpolation(i) || checkUriRaw(i)) i += l;
    else break;
  }

  if (l = checkSC(i)) i += l;

  // Check that we are at the end of the uri
  if (i < tokens[start - 1].right) return 0;

  tokens[start].uri_end = i;

  return i - start;
}
1121910
function(uri) {
        var original_segments = window.location.pathname.split('/');
        var route_segments = uri.split('/');
        var route_length = route_segments.length;
        var params = {};
        for (var i = 1; i < route_length; i++) {
            if (route_segments[i].indexOf('{') !== -1) {
                var name = route_segments[i].substr(1, route_segments[i].length-2);
                params[name] = original_segments[i];
            }
        }
        return params;
    }
437806
def urljoin (parent, url):
    
    if urlutil.url_is_absolute(url):
        return url
    return urlparse.urljoin(parent, url)
934143
function absoluteURI(uri, base) {
    if (uri.substr(0, 2) == './')
      uri = uri.substr(2);

    // absolute urls are left in tact
    if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
      return uri;
    
    var baseParts = base.split('/');
    var uriParts = uri.split('/');
    
    baseParts.pop();
    
    while (curPart = uriParts.shift())
      if (curPart == '..')
        baseParts.pop();
      else
        baseParts.push(curPart);
    
    return baseParts.join('/');
  }
1023053
function getUri2() {
  const startPos = pos;
  let content = [];

  while (pos < tokens[startPos].uri_end) {
    if (checkSC(pos)) content = content.concat(getSC());
    else if (checkUnary(pos)) content.push(getUnary());
    else if (_checkValue(pos)) content.push(_getValue());
    else break;
  }

  return content;
}
1326878
private int[] checkURI (int p, int start, int end) {
        if (p>start && wikiChars[p-1]==':') { // "://" found
            int pb=p-1;
            while (pb>start && isLatinLetterOrDigit(wikiChars[pb-1])) pb--;
            int pe=p+2;
            while (pe<end && isUrlChar(wikiChars[pe])) pe++;
            String uri = null;
            do {
                // don't want these chars at the end of URI
                while (pe>p+2 && ",.;:?!%)".indexOf(wikiChars[pe-1])>=0) pe--;
                if (isURI(wikiText.substring(pb, pe))) {
                    uri = wikiText.substring(pb, pe);
                } else {
                    pe--; // try chopping from the end
                }
            } while (uri==null && pe>p+2);
            if (uri!=null && isAbsoluteURI(uri)) {
                int offs[]= {pb, pe};
                return offs;
            }
        }
        return null;
    }
937231
private String normalizeParentPath(String uri) {
        String relativeUri = extractRelativeUrl(uri, null);
        if (relativeUri.endsWith("/") && relativeUri.length() != 1) {
            relativeUri = StringUtils.removeEndIgnoreCase(relativeUri, "/");
        }
        return relativeUri;
    }
948046
def in_general_ns(uri):
    """"""
    RDFuri = RDF.uri
    RDFSuri = RDFS.uri

    for ns in (RDFuri, RDFSuri, OWL, SKOS, DC):
        if uri.startswith(ns):
            return True
    return False
131878
private String findBaseURI(final Element root) throws MalformedURLException {
        String ret = null;
        if (findAtomLink(root, "self") != null) {
            ret = findAtomLink(root, "self");
            if (".".equals(ret) || "./".equals(ret)) {
                ret = "";
            }
            if (ret.indexOf("/") != -1) {
                ret = ret.substring(0, ret.lastIndexOf("/"));
            }
            ret = resolveURI(null, root, ret);
        }
        return ret;
    }
993726
def merge0(oth)
      oth = parser.send(:convert_to_uri, oth)

      if self.relative? && oth.relative?
        raise BadURIError,
          "both URI are relative"
      end

      if self.absolute? && oth.absolute?
        #raise BadURIError,
        #  "both URI are absolute"
        # hmm... should return oth for usability?
        return oth, oth
      end

      if self.absolute?
        return self.dup, oth
      else
        return oth, oth
      end
    end
53199
function(first) {
    if (first === "/") {
        return "/" + _url_join.apply(_url_join, [].splice.call(arguments, 1));
    } else {
        return _url_join.apply(_url_join, [].splice.call(arguments, 0));
    }
}
1286076
def _uri_split(uri):
    """"""
    scheme, netloc, path, query, fragment = _safe_urlsplit(uri)

    auth = None
    port = None

    if '@' in netloc:
        auth, netloc = netloc.split('@', 1)

    if netloc.startswith('['):
        host, port_part = netloc[1:].split(']', 1)
        if port_part.startswith(':'):
            port = port_part[1:]
    elif ':' in netloc:
        host, port = netloc.split(':', 1)
    else:
        host = netloc
    return scheme, auth, host, port, path, query, fragment
52311
private static String ensureLeadingSlash(@Nullable String uri) {
        if (uri == null)
            return "/";
        return uri.startsWith("/") ? uri : "/" + uri;
    }
771375
def select_uri_implementation(ecore_model_path):
    """"""
    if URL_PATTERN.match(ecore_model_path):
        return pyecore.resources.resource.HttpURI
    return pyecore.resources.URI