From 8ddd7f80f15943f9a48ac760babff9da9f95c043 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 10 Jul 2023 09:59:53 -0500 Subject: Trying SPARQL --- gn3-guile/web/webserver.scm | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm index e19cfd7..7ce2a9a 100755 --- a/gn3-guile/web/webserver.scm +++ b/gn3-guile/web/webserver.scm @@ -13,6 +13,7 @@ (srfi srfi-1) (srfi srfi-26) (web http) + (web client) (web request) (web response) (web uri) @@ -56,12 +57,42 @@ (,(mk-url "mouse")."Get information on mouse") (,(mk-url "datasets")."Get a list of datasets"))))) +(define (sparql-species) + " +PREFIX chebi: +PREFIX dct: +PREFIX foaf: +PREFIX generif: +PREFIX gn: +PREFIX hgnc: +PREFIX homologene: +PREFIX kegg: +PREFIX molecularTrait: +PREFIX nuccore: +PREFIX omim: +PREFIX owl: +PREFIX phenotype: +PREFIX pubchem: +PREFIX pubmed: +PREFIX rdf: +PREFIX rdfs: +PREFIX taxon: +PREFIX uniprot: +PREFIX up: +PREFIX xsd: + +CONSTRUCT { + ?s ?p ?o +} WHERE { + ?s rdf:type gn:species . + ?s ?p ?o . +}" + ) + +;; curl "https://sparql.genenetwork.org/sparql?default-graph-uri=&query=prefix+gn%3A+%3Chttp%3A%2F%2Fgenenetwork.org%2F%3E+%0D%0A%0D%0ASELECT+distinct+*+WHERE+%7B%3Fu++gn%3AbinomialName+%3Fo%7D&format=application%2Fsparql-results%2Bjson"|jq (define (get-species) - '(("Mus_musculus" . (("id" . "mouse" ) - ("api" . "https://genenetwork.org/api/v2/mouse/"))) - ("Rattus_norvegicus" . (("id" . "rat") - ("api" . "https://genenetwork.org/api/v2/rat/"))) - )) + (http-get "http://sparql.genenetwork.org/sparql?default-graph-uri=&query=") + ) (define (get-species-api-str) (scm->json-string #("https://genenetwork.org/api/v2/mouse/" -- cgit v1.2.3