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

Keyword relative iris #158

Open
wants to merge 2 commits 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
13 changes: 11 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@ Implementation Report Process
As of early 2020, the process to generate an EARL report for the official
`JSON-LD Processor Conformance`_ page is:

* Check out a local copy of the test suites::

> mkdir ../w3c
> cd ../w3c
> git clone https://github.com/w3c/json-ld-api.git
> git clone https://github.com/w3c/json-ld-framing.git
> cd ../pyld


* Run the tests on the ``json-ld-api`` and ``json-ld-framing`` test repos to
generate a ``.jsonld`` test report:

* ``python tests/runtests.py ../json-ld-api/tests/ ../json-ld-framing/tests/ -e pyld-earl.jsonld``
> ``python tests/runtests.py ..w3c/json-ld-api/tests/ ../w3c/json-ld-framing/tests/ -e pyld-earl.jsonld``

* Use the rdf_ tool to generate a ``.ttl``:

* ``rdf serialize pyld-earl.jsonld --output-format turtle -o pyld-earl.ttl``
> ``rdf serialize pyld-earl.jsonld --output-format turtle -o pyld-earl.ttl``

* Optionally follow the `report instructions`_ to generate the HTML report for
inspection.
Expand Down
8 changes: 8 additions & 0 deletions lib/pyld/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ def prepend_base(base, iri):
if rval == '':
rval = './'

# Relative IRIs must not have the form a of keyword
elif rval[0] == '@':
rval = './' + rval

return rval


Expand Down Expand Up @@ -559,6 +563,10 @@ def remove_base(base, iri):
# prepend remaining segments
rval += '/'.join(iri_segments)

# Relative IRIs must not have the form a of keyword
if rval and rval[0] == '@':
rval = './' + rval

return unparse_url((None, None, rval, rel.query, rel.fragment)) or './'


Expand Down