aboutsummaryrefslogtreecommitdiff
path: root/gn/db/sources/wikidata.scm
blob: 73974262f758ad7a0ad21d1715f3ea0b0b918cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 .
        }
"
              ))