diff options
Diffstat (limited to 'gn3/db/rdf')
-rw-r--r-- | gn3/db/rdf/wiki.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index a208b74..d8fd8c8 100644 --- a/gn3/db/rdf/wiki.py +++ b/gn3/db/rdf/wiki.py @@ -143,4 +143,19 @@ CONSTRUCT { query, WIKI_CONTEXT, sparql_uri ) + data = results.get("data") + for result in data: + categories = result.get("categories") + if categories and isinstance(categories, str): + result["categories"] = [categories] + else: + result["categories"] = [] + pmids = result.get("pubmed_ids") + if pmids and isinstance(pmids, str): + result["pubmed_ids"] = [pmids] + elif pmids: + result["pubmed_ids"] = [int(pmid) for pmid in pmids] + else: + result["pubmed_ids"] = [] + result["version"] = int(result["version"]) return results |