From 3cad04ddfe731c0ffbb26379778c69732b02861b Mon Sep 17 00:00:00 2001 From: Matthias Urban Date: Fri, 6 Nov 2020 09:05:23 +0100 Subject: [PATCH 1/3] Fixed clear database method --- osp/core/session/db/sql_wrapper_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osp/core/session/db/sql_wrapper_session.py b/osp/core/session/db/sql_wrapper_session.py index ca2a0144..06653fed 100644 --- a/osp/core/session/db/sql_wrapper_session.py +++ b/osp/core/session/db/sql_wrapper_session.py @@ -594,11 +594,11 @@ def _clear_database(self): for table_name in self._get_table_names( SqlWrapperSession.DATA_TABLE_PREFIX): self._do_db_delete(table_name, None) + self._do_db_delete(self.TYPES_TABLE, None) + self._do_db_delete(self.RELATIONSHIP_TABLE, None) self._do_db_delete(self.CUDS_TABLE, None) self._do_db_delete(self.ENTITIES_TABLE, None) - self._do_db_delete(self.TYPES_TABLE, None) self._do_db_delete(self.NAMESPACES_TABLE, None) - self._do_db_delete(self.RELATIONSHIP_TABLE, None) self._initialize() self._commit() From 13a12e804342ecefcf4db1405acf3e82f96d0f65 Mon Sep 17 00:00:00 2001 From: Matthias Urban Date: Tue, 10 Nov 2020 14:39:22 +0100 Subject: [PATCH 2/3] packageinfo version up --- packageinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packageinfo.py b/packageinfo.py index 3016d3f6..38814d73 100644 --- a/packageinfo.py +++ b/packageinfo.py @@ -1,4 +1,4 @@ """Information about the package.""" NAME = "osp-core" -VERSION = "3.5.0" +VERSION = "3.5.1" From 2fd46c4328bf47809818af50ba0f942ec909cdef Mon Sep 17 00:00:00 2001 From: Matthias Urban Date: Tue, 10 Nov 2020 18:26:51 +0100 Subject: [PATCH 3/3] backwards compatibility fixes --- osp/core/ontology/namespace.py | 7 ++++--- tests/test_case_insensitivity.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osp/core/ontology/namespace.py b/osp/core/ontology/namespace.py index 24cfa482..e92049e9 100644 --- a/osp/core/ontology/namespace.py +++ b/osp/core/ontology/namespace.py @@ -187,9 +187,10 @@ def _do_get(self, name, _case_sensitive, _force_by_iri): iri = rdflib.URIRef(str(self._iri) + iri_suffix) try: return self._namespace_registry.from_iri(iri, _name=name) - except ValueError: - return self._get_case_insensitive(name) - return self._get_case_insensitive(name) + except KeyError as e: + if not _case_sensitive: + return self._get_case_insensitive(name) + raise e def _get_case_insensitive(self, name): """Get by trying alternative naming convention of given name. diff --git a/tests/test_case_insensitivity.py b/tests/test_case_insensitivity.py index 35fa206d..9d3a685a 100644 --- a/tests/test_case_insensitivity.py +++ b/tests/test_case_insensitivity.py @@ -26,6 +26,9 @@ def test_get_case_insensitive_alternative(self): self.assertEqual(alt("some_entity", False), "SOME_ENTITY") self.assertEqual(alt("SOME_ENTITY", False), "SOME_ENTITY") + from osp.core.namespaces import cuba + self.assertEqual(cuba.wrapper, cuba.Wrapper) + if __name__ == "__main__": unittest.main()