From c75ed75c6a5987eed6672be924870f86282ed6d6 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 1 Dec 2022 15:32:42 +0300 Subject: 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. --- gn3/api/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gn3/api') 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/", methods=["GET"]) -def jsonify_dataset_metadata(accession_id): +@metadata.route("/dataset/", 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 -- cgit v1.2.3