aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn/data/species.scm14
-rw-r--r--gn/db/sparql.scm22
-rw-r--r--test/runner.scm3
-rw-r--r--web/gn-uri.scm2
-rwxr-xr-xweb/webserver.scm2
5 files changed, 29 insertions, 14 deletions
diff --git a/gn/data/species.scm b/gn/data/species.scm
index 98ea1b1..e06931e 100644
--- a/gn/data/species.scm
+++ b/gn/data/species.scm
@@ -16,6 +16,12 @@
get-expanded-taxon-data
))
+(define (gn-species short-name)
+ "Find the GN identifier from shortname"
+ (let ([rec (get-expanded-taxon-data short-name)])
+ rec
+ ))
+
(define (get-species)
(receive (names res) (memo-sparql-species-meta)
(let* ([table (get-rows names res)]
@@ -62,13 +68,6 @@
)
-(define (get-expanded-species)
- "Here we add information related to each species"
- (map (lambda (rec)
- (expand-species rec)
- ) (get-species)
-))
-
(define (get-expanded-taxon-data short-name)
"Here we add information related to one taxonomy species"
(call/cc (lambda (return)
@@ -121,4 +120,5 @@
("meta" . ,(mk-meta id))
("data" . ,(mk-data id))
("up" . ,(mk-meta "species"))
+ ("links" . ,(get-group-links (gn-species id)))
))
diff --git a/gn/db/sparql.scm b/gn/db/sparql.scm
index 0e8c938..fd779c6 100644
--- a/gn/db/sparql.scm
+++ b/gn/db/sparql.scm
@@ -13,6 +13,7 @@
#:export (memo-sparql-species
memo-sparql-species-meta
+ sparql-species-meta
memo-sparql-wd-species-info
compile-species
get-rows
@@ -180,6 +181,14 @@ SELECT ?species ?p ?o WHERE {
(define memo-sparql-species-meta
(memoize2 sparql-species-meta))
+#!
+dump-species-metadata.ttl:gn:Axbxa rdf:type gnc:inbredSet .
+dump-species-metadata.ttl:gn:Axbxa rdfs:label "AXB/BXA Family" .
+dump-species-metadata.ttl:gn:Axbxa gnt:family "Reference Populations (replicate average, SE, N)" .
+dump-species-metadata.ttl:gn:Axbxa gnt:mappingMethod "AXBXA" .
+dump-species-metadata.ttl:gn:Axbxa gnt:code "AXB" .
+dump-species-metadata.ttl:gn:Axbxa gnt:belongsToSpecies gn:Mus_musculus .
+!#
(define (get-values names row)
"Get values by name from a resultset row"
@@ -194,17 +203,18 @@ SELECT ?species ?p ?o WHERE {
(define (compile-species recs rows)
"Compile a matrix of species triples into records"
(for-each (lambda (r)
- (let* ([s (car r)]
+ (let* ([species (car r)]
[v (cdr (cdr r))]
[p (car (cdr r))]
[nrec '()]
- [kv (assoc s recs)]) ; find record to fill based on subject
- (if (not kv)
- (set! nrec '())
- (set! nrec (cdr kv))
+ [kvs (assoc species recs)]) ; find record to fill based on subject
+ ;; for each gnid add value pair
+ (if (not kvs)
+ (set! nrec `(("gnid" ,species)))
+ (set! nrec (cdr kvs))
)
(set! nrec (assoc-set! nrec p v))
- (set! recs (assoc-set! recs s nrec))
+ (set! recs (assoc-set! recs species nrec))
))
rows)
recs)
diff --git a/test/runner.scm b/test/runner.scm
index 45f2b0c..5555dc2 100644
--- a/test/runner.scm
+++ b/test/runner.scm
@@ -19,4 +19,7 @@
(test-equal "tomato-data should have a description"
(assoc-ref (get-expanded-taxon-data "tomato") "description") "type of plant species with edible, often red, berry fruit")
+(test-assert "mouse-meta should list all groups/populations/cohorts"
+ (assoc "links" (get-expanded-taxon-meta "mouse")))
+
(test-end "runner")
diff --git a/web/gn-uri.scm b/web/gn-uri.scm
index a4292f0..c52066d 100644
--- a/web/gn-uri.scm
+++ b/web/gn-uri.scm
@@ -9,6 +9,8 @@
mk-meta
mk-data
mk-doc
+ mk-html
+ mk-url
prefix
url-parse-id
normalize-id
diff --git a/web/webserver.scm b/web/webserver.scm
index 485d334..6be0890 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -23,7 +23,7 @@
(web client)
(web request)
(web response)
-; (web uri)
+ (web uri)
(fibers web server)
(gn cache memoize)
(web gn-uri)