From 052957100e85e24dea2d8a1a49fc0abf94aae991 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 18 Jul 2023 14:51:51 +0200 Subject: Handling matrix --- gn3-guile/web/webserver.scm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'gn3-guile') diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm index bc9648f..af13275 100755 --- a/gn3-guile/web/webserver.scm +++ b/gn3-guile/web/webserver.scm @@ -113,22 +113,21 @@ SELECT ?species ?p ?o WHERE { (receive (names result) (sparql-species-meta) result)) -;; (define (get-values name resultlist) -;; (map (lambda (m) (cdr (assoc "value" (cdr (assoc name m))))) resultlist)) +(define (get-values names row) + "Get values by name from a resultset row" + (map (lambda (n) (unpack "value" (unpack n row))) (array->list names))) -;; (define (filter-results) -;; (get-values "o" (array->list (get-species)))) - -;; (define (triples) -;; (array->list (get-species-all))) - -(define (get-matrix resultset) - "Format resultset as a list of values" - (receive (names results) resultset - values name results)) +(define (get-rows names results) + "Format results as a list of values ordered by names" + (map (lambda (row) (get-values names row)) (array->list results))) ;; from the triples first harvest the species URIs, followed by creating records of information +(define (compile-species rows) + "Compile a matrix of species triples into records" + (define s '()) + ) + (define (get-species-api-str) (scm->json-string #("https://genenetwork.org/api/v2/mouse/" "https://genenetwork.org/api/v2/rat/"))) -- cgit v1.2.3