aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2023-07-18 14:51:51 +0200
committerPjotr Prins2023-07-18 14:51:51 +0200
commit052957100e85e24dea2d8a1a49fc0abf94aae991 (patch)
treea31fab6bb83493cde8dffa22ac40b037a70b1ca3
parent23f23053df47e69f014ea525463970dbcab2bb27 (diff)
downloadgenenetwork3-052957100e85e24dea2d8a1a49fc0abf94aae991.tar.gz
Handling matrix
-rwxr-xr-xgn3-guile/web/webserver.scm23
1 files changed, 11 insertions, 12 deletions
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/")))