aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2023-07-23 12:32:52 +0200
committerPjotr Prins2023-07-23 12:32:52 +0200
commit9cc56448de3c04d72ae2462adc359d1760d924a8 (patch)
treed6ac840a024009fd38547a67448a7b35ca641610
parent8f988827b24ec56f0609c1120d81a62138288a61 (diff)
downloadgenenetwork3-9cc56448de3c04d72ae2462adc359d1760d924a8.tar.gz
works
-rwxr-xr-xgn3-guile/web/webserver.scm18
1 files 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/")))