From ad3f1176642a499229554d490037b533ef7da418 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 23 Oct 2024 20:46:23 -0500 Subject: wikidata: build first query --- gn/db/sources/wikidata.scm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gn/db/sources/wikidata.scm (limited to 'gn/db/sources/wikidata.scm') diff --git a/gn/db/sources/wikidata.scm b/gn/db/sources/wikidata.scm new file mode 100644 index 0000000..7397426 --- /dev/null +++ b/gn/db/sources/wikidata.scm @@ -0,0 +1,29 @@ +#! + +Wikidata queries + +!# + +(define-module (gn db sources wikidata) +) + +(define ps-encoded-by "ps:P702") +(define wdt-instance-of "wdt:P31") +(define wdt-in-taxon "wdt:P703") +(define wd-human "wd:Q15978631") +(define wd-mouse "wd:Q83310") +(define wd-rat "wd:Q184224") +(define wd-gene "wd:Q7187") + +(define (wikidata_query_geneids gene_name) + "Return the wikidata identifiers pointing to genes of listed species" + (string-append + "SELECT DISTINCT ?wikidata_id + WHERE { + ?wikidata_id " wdt-instance-of " " wd-gene "; + " wdt-in-taxon " ?species . + VALUES (?species) { (" wd-human " ) ( " wd-mouse" ) ( " wd-rat" ) } . + ?wikidata_id rdfs:label \"" gene_name "\"@en . + } +" + )) -- cgit v1.2.3