diff options
author | Munyoki Kilyungi | 2024-08-26 12:42:55 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-08-26 15:35:33 +0300 |
commit | 852de97b222ddf914ec404dfdb7d9a4965dd7d7f (patch) | |
tree | d93ccf079adcc1f5e4f9a44b49a20694a26689db /gn3/db | |
parent | 5d0b1033f6f75e7a67226a57762e7a5c73d722a2 (diff) | |
download | genenetwork3-852de97b222ddf914ec404dfdb7d9a4965dd7d7f.tar.gz |
If there's no data, return a 404.
* gn3/api/metadata.py (get_wiki_entries): Return an empty {} when
there's no data.
* gn3/db/rdf.py (query_frame_and_compact): Delete check for empty
results. Instead just return the context as is.
(query_and_compact): Ditto.
(query_and_frame): Ditto.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db')
-rw-r--r-- | gn3/db/rdf.py | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py index 3f4db9b..4fd47cb 100644 --- a/gn3/db/rdf.py +++ b/gn3/db/rdf.py @@ -24,24 +24,18 @@ def sparql_construct_query(query: str, endpoint: str) -> dict: def query_frame_and_compact(query: str, context: dict, endpoint: str) -> dict: """Frame and then compact the results given a context""" results = sparql_construct_query(query, endpoint) - if not results: - return {} return jsonld.compact(jsonld.frame(results, context), context) def query_and_compact(query: str, context: dict, endpoint: str) -> dict: """Compact the results given a context""" results = sparql_construct_query(query, endpoint) - if not results: - return {} return jsonld.compact(results, context) def query_and_frame(query: str, context: dict, endpoint: str) -> dict: """Frame the results given a context""" results = sparql_construct_query(query, endpoint) - if not results: - return {} return jsonld.frame(results, context) |