def uri_split(uri): """ Split the `uri` into base path and remainder, the base is everything that comes before the last *#*' or */* including it .. code-block:: python >>> print util.uri_split('http://mynamespace/ns#some_property') ('NS1', 'some_property') """ sp = uri.rfind('#') != -1 and '#' or '/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[0], predicate
def namespace_split(uri): """ Same as `uri_split`, but instead of the base of the uri, returns the registered `namespace` for this uri .. code-block:: python >>> print util.namespace_split('http://mynamespace/ns#some_property') (rdflib.URIRef('http://mynamespace/ns#'), 'some_property') """ sp = uri.rfind('#') != -1 and '#' or '/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[1], predicate
def namespace_split(uri): """ Same as :func:`uri_split`, but instead of the base of the uri, returns the registered `namespace` for this uri .. code-block:: python >>> print namespace_split('http://mynamespace/ns#some_property') (rdflib.URIRef('http://mynamespace/ns#'), 'some_property') :param str uri: the uri :return: a (namespace, predicate) tuple. Types: (:class:`rdflib.term.URIRef`, str) :rtype: tuple """ sp = '#' if uri.rfind('#') != -1 else '/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[1], predicate
def namespace_split(uri): """ Same as :func:`uri_split`, but instead of the base of the uri, returns the registered `namespace` for this uri .. code-block:: python >>> print namespace_split('http://mynamespace/ns#some_property') (rdflib.URIRef('http://mynamespace/ns#'), 'some_property') :param str uri: the uri :return: a (namespace, predicate) tuple. Types: (:class:`rdflib.term.URIRef`, basestring) :rtype: tuple """ sp = '#' if uri.rfind('#') != -1 else '/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[1], predicate
def uri_split(uri): """ Split the `uri` into base path and remainder, the base is everything that comes before the last *#*' or */* including it .. code-block:: python >>> print uri_split('http://mynamespace/ns#some_property') ('NS1', 'some_property') :param uri: the uri :type uri: :class:`rdflib.term.URIRef` or basestring :return: a (base, remainder) tuple. Types: (str, str) :rtype: tuple """ sp = '#' if uri.rfind('#') != -1 else'/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[0], predicate
def uri_split(uri): """ Split the `uri` into base path and remainder, the base is everything that comes before the last *#*' or */* including it .. code-block:: python >>> print uri_split('http://mynamespace/ns#some_property') ('NS1', 'some_property') :param uri: the uri :type uri: :class:`rdflib.term.URIRef` or basestring :return: a (base, remainder) tuple. Types: (str, basestring) :rtype: tuple """ sp = '#' if uri.rfind('#') != -1 else '/' base, predicate = uri.rsplit(sp, 1) return get_namespace('%s%s' % (base, sp))[0], predicate