diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | gn/db/sparql.scm | 22 |
2 files changed, 18 insertions, 10 deletions
@@ -21,6 +21,12 @@ Note the leading dot. The .guix-shell is defined in `genenetwork3/gn3-guile/web` Next fire up emacs with `emacs-geiser-guile` and connect to the running web server with `M-x geiser-connect` and the port `1970`. Now you can not only inspect procedures, but also update any prodedure on the live server using `C-M-x` and get updated output from the webserver! +# Development + +``` +git remote add gn git.genenetwork.org:/home/git/public/gn-guile +``` + # LICENSE This software is published by the GeneNetwork team under the AGPL3. See [LICENSE](LICENSE.txt). diff --git a/gn/db/sparql.scm b/gn/db/sparql.scm index 6c3b5b2..95b4e1d 100644 --- a/gn/db/sparql.scm +++ b/gn/db/sparql.scm @@ -24,6 +24,16 @@ (define (wd-sparql-endpoint-url) "https://query.wikidata.org/sparql") +(define (gn-sparql-prefix query) + (string-append + " +PREFIX gn: <http://genenetwork.org/id/> +PREFIX gnt: <http://genenetwork.org/term/> +PREFIX gnc: <http://genenetwork.org/category/> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> + +" query)) + (define (wdt-taxon-name) "wdt:P225") (define (sparql-exec endpoint-url query) @@ -56,7 +66,8 @@ (define (sparql-scm endpoint-url query) "Return dual S-exp 'resultset' of varnames and results" - (let ((response (json-string->scm (sparql-exec endpoint-url query)))) + (let ((response (json-string->scm + (sparql-exec endpoint-url (gn-sparql-prefix query))))) (values (sparql-names response) (sparql-results response)))) (define (tsv->scm text) @@ -136,10 +147,6 @@ gn:Mus_musculus gnt:organism taxon:10090 . (define (sparql-species) (sparql-scm (gn-sparql-endpoint-url) " -PREFIX gn: <http://genenetwork.org/id/> -PREFIX gnc: <http://genenetwork.org/category/> -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> - SELECT DISTINCT ?species WHERE { ?species rdf:type gnc:species . }")) @@ -150,11 +157,6 @@ SELECT DISTINCT ?species WHERE { (define (sparql-species-meta) "Return values names recs" (sparql-scm (gn-sparql-endpoint-url) " -PREFIX gn: <http://genenetwork.org/id/> -PREFIX gnc: <http://genenetwork.org/category/> -PREFIX gnt: <http://genenetwork.org/term/> -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> - SELECT ?species ?p ?o WHERE { MINUS { ?species rdf:type ?o . } { |