From 9cc56448de3c04d72ae2462adc359d1760d924a8 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 23 Jul 2023 12:32:52 +0200 Subject: works --- gn3-guile/web/webserver.scm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm index 0ae95aa..a5d4cef 100755 --- a/gn3-guile/web/webserver.scm +++ b/gn3-guile/web/webserver.scm @@ -129,9 +129,6 @@ SELECT ?species ?p ?o WHERE { }}}")) -(define (get-species) - (receive (names result) (sparql-species-meta) - result)) (define (get-values names row) "Get values by name from a resultset row" @@ -162,18 +159,23 @@ SELECT ?species ?p ?o WHERE { recs) ;; result should be a vector of list of pair -(define (tojson recs) +(define (species-digest 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)) + (cons k (map (lambda (i) (cons (car i) (car (cdr i)))) v)) )) recs ) ) +(define (get-species) + (receive (names res) (sparql-species-meta) + (let* ([table (get-rows names res)] + [recs '()] + [h (compile-species recs table)]) + (species-digest h)) + )) + (define (get-species-api-str) (scm->json-string #("https://genenetwork.org/api/v2/mouse/" "https://genenetwork.org/api/v2/rat/"))) -- cgit v1.2.3