diff options
author | Pjotr Prins | 2023-07-23 11:47:23 +0200 |
---|---|---|
committer | Pjotr Prins | 2023-07-23 11:47:23 +0200 |
commit | 8f988827b24ec56f0609c1120d81a62138288a61 (patch) | |
tree | a90bf5c5368bd4a323c2dde8aa1bf9a173a1f781 /gn3-guile/web/webserver.scm | |
parent | ac059c92e1d678d8c4f5678fa2e14bc0110ffa11 (diff) | |
download | genenetwork3-8f988827b24ec56f0609c1120d81a62138288a61.tar.gz |
this works
Diffstat (limited to 'gn3-guile/web/webserver.scm')
-rwxr-xr-x | gn3-guile/web/webserver.scm | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm index 08e2412..0ae95aa 100755 --- a/gn3-guile/web/webserver.scm +++ b/gn3-guile/web/webserver.scm @@ -95,9 +95,6 @@ SELECT DISTINCT ?species WHERE { ?species rdf:type gn:species . }")) -;; (define (get-species-uris) -;; (map (lambda (m) (cdr (assoc "value"(cdr (car m))))) (array->list (sparql-species)))) - #! (define-values (names res) (sparql-species-meta)) (define table (get-rows names res)) @@ -107,6 +104,15 @@ SELECT DISTINCT ?species WHERE { (assoc-ref h "http://genenetwork.org/species_drosophila_melanogaster") ;; note switch! (define d (car h)) (assoc-ref (list d) "http://genenetwork.org/species_drosophila_melanogaster") + +(scm->json #(1 (("2" . 3)))) +;; [1,{"2":3}] +(scm->json #("http://genenetwork.org/species_drosophila_melanogaster" (("http://genenetwork.org/menuName" . "Drosophila") ("http://genenetwork.org/binomialName" . "Drosophila melanogaster") ))) +;; ["http://genenetwork.org/species_drosophila_melanogaster",{"http://genenetwork.org/menuName":"Drosophila","http://genenetwork.org/binomialName":"Drosophila melanogaster"}] +l +;; (("http://genenetwork.org/menuName" "Drosophila") ("http://genenetwork.org/name" "Drosophila") ("http://genenetwork.org/binomialName" "Drosophila melanogaster")) +(scm->json (map (lambda (i) (cons (car i) (car (cdr i)))) l)) +;; {"http://genenetwork.org/menuName":"Drosophila","http://genenetwork.org/name":"Drosophila","http://genenetwork.org/binomialName":"Drosophila melanogaster"} !# (define (sparql-species-meta) @@ -157,15 +163,16 @@ SELECT ?species ?p ?o WHERE { ;; result should be a vector of list of pair (define (tojson recs) - (for-each (lambda (r) - (let ([k (car r)] - [v (cdr r)]) - (display k) - (newline) - (display r) - (newline) - )) recs - )) + (map (lambda (r) + (let* ([k (car r)] + [v (cdr r)]) + ; (display k) + ; (display v) + ; (newline) + (scm->json (map (lambda (i) (cons (car i) (car (cdr i)))) v)) + )) + recs ) + ) (define (get-species-api-str) (scm->json-string #("https://genenetwork.org/api/v2/mouse/" |