Obtain (uri, name) from a qualified name
12314
def resolve_namespace(self, qname):
        
        if ':' in qname:
            prefix, name = qname.split(':', 1)
            uri = self._ns[prefix]
        else:
            name = qname
            if None in self._ns:
                uri = self._ns[None]
            else:
                uri = None
        return (uri, name)
547557
public static String qualifier(String qualifiedName) {
		int loc = qualifiedName.lastIndexOf('.');
		if (loc < 0)
			return "";

		return qualifiedName.substring(0, loc);
	}
896360
def get(self, uri, params={}):
        '''
        '''
        return self._session.get(urljoin(Investigate.BASE_URL, uri),
            params=params, headers=self._auth_header, proxies=self.proxies
        )
385041
def _qname(self, name):
        
        if isinstance(name, QName):
            return name
        if not isinstance(name, str):
            raise TypeError("{} must be str".format(name))
        if name == '':
            return name
        if name.startswith('{'):
            return name
        prefix, tag = name.split(':', maxsplit=1)
        uri = self.NS[prefix]
        return QName(uri, tag)
117604
def _get_request_uri(self, request):
        """"""
        request_uri = request['target']
        if request_uri.startswith('/'):  # eg. GET /index.html
            return (request.get('Host', 'localhost').split(':')[0],
                    request_uri[1:])
        elif '://' in request_uri:  # eg. GET http://rded.nl
            locator = request_uri.split('://', 1)[1]
            host, path = locator.split('/', 1)
            return (host.split(':')[0], path)
1155427
def get_uri(self, curie):
        '''  '''
        if curie is None:
            return None
        parts = curie.split(':')
        if len(parts) == 1:
            if curie != '':
                LOG.error("Not a properly formed curie: \"%s\"", curie)
            return None
        prefix = parts[0]
        if prefix in self.curie_map:
            return '%s%s' % (self.curie_map.get(prefix),
                             curie[(curie.index(':') + 1):])
        LOG.error("Curie prefix not defined for %s", curie)
        return None
1156769
def qualified_name(self):
        

        parent = self.full_parent_name
        if parent:
            return parent + ' ' + self.name
        else:
            return self.name
1224331
def get_uris(self, base_uri, filter_list=None):
        """"""
        return {
            re.sub(r'^/', base_uri, link.attrib['href'])
            for link in self.parsedpage.get_nodes_by_selector('a')
            if 'href' in link.attrib and (
                link.attrib['href'].startswith(base_uri) or
                link.attrib['href'].startswith('/')
            ) and
            not is_uri_to_be_filtered(link.attrib['href'], filter_list)
        }
1214039
def _namespace_from_uri(self, uri):
        """"""
        # TODO - this could be helped a bunch with proper use of the graph API
        # it seems a bit fragile to treat these as simple string-splits
        uri = str(uri)
        parts = uri.split('#')
        if len(parts) == 1:
            return "%s/" % '/'.join(uri.split('/')[:-1])
        return "%s#" % '#'.join(parts[:-1])
594027
@Override
    public Resource qualifiedNameToResource(QualifiedName name) {
	String unescapedLocalName = qnU.unescapeProvLocalName(name.getLocalPart());
	if (isBlankName(name)) {
	    return new BNodeImpl(unescapedLocalName);
	} else {
	    return new URIImpl(name.getNamespaceURI() + unescapedLocalName);

	}
    }
218207
def extract_dynamic_part(uri):
    
    for part in uri.split('/'):
        part = part.strip()
        if part.startswith('{') and part.endswith('}'):
            return clean_dynamic_uri(part)
1107404
def qname(self, uri: str) -> str:
        '''  '''
        try:
            prefix, namespace, name = self.g.compute_qname(uri)
            qname = prefix + ':' + name
            return qname
        except:
            try:
                print('prefix:', prefix)
                print('namespace:', namespace)
                print('name:', name)
            except:
                print('Could not print from compute_qname')
            exit('No qname for ' + uri)
1052348
def fully_qualified_name(obj, sep='.'):
    """"""
    if inspect.isclass(obj):
        return obj.__module__ + sep + obj.__name__
    else:
        return obj.__module__ + sep + obj.__class__.__name__
1283018
def term_from_uri(uri):
    """"""
    if uri is None:
        return None
    # This insures that if we get a Literal with an integer value (as we
    # do for modification positions), it will get converted to a string,
    # not an integer.
    if isinstance(uri, rdflib.Literal):
        uri = str(uri.toPython())
    # This is to handle URIs like
    # http://www.openbel.org/bel/namespace//MAPK%20Erk1/3%20Family
    # or
    # http://www.openbel.org/bel/namespace/MAPK%20Erk1/3%20Family
    # In the current implementation, the order of the patterns
    # matters.
    patterns = ['http://www.openbel.org/bel/namespace//(.*)',
                'http://www.openbel.org/vocabulary//(.*)',
                'http://www.openbel.org/bel//(.*)',
                'http://www.openbel.org/bel/namespace/(.*)',
                'http://www.openbel.org/vocabulary/(.*)',
                'http://www.openbel.org/bel/(.*)']
    for pr in patterns:
        match = re.match(pr, uri)
        if match is not None:
            term = match.groups()[0]
            term = unquote(term)
            return term
    # If none of the patterns match then the URI is actually a simple term
    # for instance a site: "341" or a substitution: "sub(V,600,E)"
    return uri
967907
def get(self, name_or_uri):
        
        name_or_uri = quote(name_or_uri)
        return self._client.get(name_or_uri)
460719
def uri(self):
        """"""
        uristring = self.path
        if self.query:
            uristring += "?{}".format(self.query)
        if self.fragment:
            uristring += "#{}".format(self.fragment)

        return uristring
1059737
def _get_name_from_url(self, request):
        

        format = request.GET.get('format', None)
        if not format:
            match = self._format_query_pattern.match(request.path)
            if match and match.group('format'):
                format = match.group('format')
        return format