Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue #65, namespaces with # #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rdflib_jsonld/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def base(self):

@base.setter
def base(self, base):
if base:
hash_index = base.find('#')
if hash_index > -1:
base = base[0:hash_index]
#if base:
#hash_index = base.find('#')
#if hash_index > -1:
#base = base[0:hash_index]
self._base = self.resolve_iri(base) if (
hasattr(self, '_base') and base is not None) else base
self._basedomain = '%s://%s' % urlsplit(base)[0:2] if base else None
Expand Down
17 changes: 9 additions & 8 deletions rdflib_jsonld/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ def norm_url(base, url):
'http://example.net/one'
"""
parts = urlsplit(urljoin(base, url))
path = normpath(parts[2])
if sep != '/':
path = '/'.join(path.split(sep))
if parts[2].endswith('/') and not path.endswith('/'):
path += '/'
result = urlunsplit(parts[0:2] + (path,) + parts[3:])
if url.endswith('#') and not result.endswith('#'):
result += '#'
#path = normpath(parts[2])
#if sep != '/':
# path = '/'.join(path.split(sep))
#if parts[2].endswith('/') and not path.endswith('/'):
# path += '/'
#result = urlunsplit(parts[0:2] + (path,) + parts[3:])
#if url.endswith('#') and not result.endswith('#'):
# result += '#'
result = url
return result

def context_from_urlinputsource(source):
Expand Down