From 17cf02801447bca5a02f1dcdf2122e25789fd79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20E=2E=20Gonz=C3=A1lez-Espinoza?= Date: Mon, 17 Jul 2023 10:50:44 +0200 Subject: [PATCH] Added missing case and corrected test. --- kgforge/specializations/stores/bluebrain_nexus.py | 5 ++++- tests/specializations/stores/test_bluebrain_nexus.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kgforge/specializations/stores/bluebrain_nexus.py b/kgforge/specializations/stores/bluebrain_nexus.py index 4987b5aa..ff588e06 100644 --- a/kgforge/specializations/stores/bluebrain_nexus.py +++ b/kgforge/specializations/stores/bluebrain_nexus.py @@ -1061,7 +1061,10 @@ def rewrite_uri(self, uri: str, context: Context, **kwargs) -> str: else: resolved_id = id return url.replace(id, quote_plus(resolved_id)) - uri = "/".join((url_base, quote_plus(url, encoding=encoding))) + if not is_file and "/_/" not in url: # adding _ for empty schema + uri = "/".join((url_base, "_", quote_plus(url, encoding=encoding))) + else: + uri = "/".join((url_base, quote_plus(url, encoding=encoding))) return uri diff --git a/tests/specializations/stores/test_bluebrain_nexus.py b/tests/specializations/stores/test_bluebrain_nexus.py index 7fccce48..5071fcf7 100644 --- a/tests/specializations/stores/test_bluebrain_nexus.py +++ b/tests/specializations/stores/test_bluebrain_nexus.py @@ -187,7 +187,7 @@ def test_to_resource(nexus_store, registered_building, building_jsonld): pytest.param( ("http://data.net/myverycoolid123456789"), (False), - ("https://nexus-instance.org/resources/test/kgforge/http%3A%2F%2Fdata.net%2Fmyverycoolid123456789"), + ("https://nexus-instance.org/resources/test/kgforge/_/http%3A%2F%2Fdata.net%2Fmyverycoolid123456789"), id="simple-resource-id", ), pytest.param(