aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn3/db/rdf.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py
index 9d6346b..3f4db9b 100644
--- a/gn3/db/rdf.py
+++ b/gn3/db/rdf.py
@@ -102,9 +102,11 @@ CONSTRUCT {
query, context,
sparql_uri
)
- if data := results.get("data"):
- for result in data:
- if result.get("categories"):
- result["categories"] = list(map(str.strip,
- result.get("categories").split(";")))
+ data = results.get("data")
+ if not data:
+ return results
+ for result in data:
+ if result.get("categories"):
+ result["categories"] = [
+ x.strip() for x in result.get("categories").split(";")]
return results