aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-10-17 12:49:00 +0300
committerBonfaceKilz2023-10-27 13:45:32 +0300
commitc82819fabb0564726677f0b74d8a55c853b2b309 (patch)
treeeaf53ecb498aa51c87e1f28e4d6fc2a92177615b /gn3/db
parentafe8c48f6d58e97d2607dcf9a82b85ffb389bbe4 (diff)
downloadgenenetwork3-c82819fabb0564726677f0b74d8a55c853b2b309.tar.gz
Implement "GET /metadata/publications/:name".
* gn3/api/metadata.py: Delete gn3.db.rdf.get_publication_metadata. (publication): Rename this ... (publications): ... to this. Return a json-ld result. * gn3/db/rdf.py (get_publication_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/rdf.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py
index 1d714c1..2f80aa2 100644
--- a/gn3/db/rdf.py
+++ b/gn3/db/rdf.py
@@ -130,46 +130,6 @@ CONSTRUCT {
return response
-def get_publication_metadata(
- sparql_conn: SPARQLWrapper, name: str
-):
- """Return info about a publication with a given NAME"""
- __metadata_query = """
-$prefix
-
-CONSTRUCT {
- gn:publication ?publicationTerm ?publicationValue .
- gn:publication ?predicate ?subject .
-} WHERE {
- $name ?publicationTerm ?publicationValue .
- ?publication ?publicationTerm ?publicationValue .
- OPTIONAL {
- ?subject ?predicate ?publication .
- } .
- VALUES ?publicationTerm {
- gn:pubMedId gn:title gn:volume
- gn:abstract gn:pages gn:month gn:year gn:author
- }
- VALUES ?predicate {
- gn:phenotypeOfPublication
- }
-}
-"""
- response: MonadicDict = MonadicDict()
- for key, value in sparql_query(
- sparql_conn,
- Template(__metadata_query)
- .substitute(
- prefix=RDF_PREFIXES,
- name=name
- )
- )[0].items():
- response[key] = value
- if isinstance(value, str) and not key.endswith("pubMedId"):
- response[key] = value.map(get_url_local_name) # type: ignore
- return response
-
-
def get_phenotype_metadata(
sparql_conn: SPARQLWrapper, name: str
):