diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 87e32c7..8093ecf 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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. diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py index 49d6212..22e0257 100644 --- a/lib/pyld/jsonld.py +++ b/lib/pyld/jsonld.py @@ -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 @@ -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 './'