aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/metadata.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-12-01 15:32:42 +0300
committerBonfaceKilz2022-12-06 11:28:28 +0300
commitc75ed75c6a5987eed6672be924870f86282ed6d6 (patch)
tree9d91afcbef1ea9c2ec6557b86b5187f5093374ab /gn3/api/metadata.py
parent09f4d9c4bec6e3395296a69ce718dea30240ed54 (diff)
downloadgenenetwork3-c75ed75c6a5987eed6672be924870f86282ed6d6.tar.gz
Use a dataset's name to fetch it's metadata from RDF
* gn3/api/metadata.py (jsonify_dataset_metadata): Rewrite metadata end-point to use a dataset's name instead of it's accession_id. * gn3/db/rdf.py (get_dataset_metadata): Replace accession_id with name. Use one single RDF query instead of multiple queries.
Diffstat (limited to 'gn3/api/metadata.py')
-rw-r--r--gn3/api/metadata.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py
index 35e4067..8f6127f 100644
--- a/gn3/api/metadata.py
+++ b/gn3/api/metadata.py
@@ -13,14 +13,14 @@ from gn3.db.rdf import get_dataset_metadata
metadata = Blueprint("metadata", __name__)
-@metadata.route("/dataset/<accession_id>", methods=["GET"])
-def jsonify_dataset_metadata(accession_id):
+@metadata.route("/dataset/<name>", methods=["GET"])
+def jsonify_dataset_metadata(name):
"""Fetch a dataset's metadata given it's ACCESSION_ID"""
try:
return jsonify(
get_dataset_metadata(
SPARQLWrapper(current_app.config.get("SPARQL_ENDPOINT")),
- accession_id,
+ name,
).data
)
# The virtuoso server is misconfigured or it isn't running at all