aboutsummaryrefslogtreecommitdiff
path: root/gn/db
diff options
context:
space:
mode:
authorPjotr Prins2023-08-20 13:09:03 +0200
committerPjotr Prins2023-08-20 13:09:03 +0200
commit66c26676c938e6ba35440bcb2e851fb025549ed0 (patch)
tree3b30b828563188802f6ed81ab2cd5eb5e33f0415 /gn/db
parentdcc41148727ec5f68fbeb0504a295981728327a1 (diff)
downloadgn-guile-66c26676c938e6ba35440bcb2e851fb025549ed0.tar.gz
Add gnid to species - still a bug
Diffstat (limited to 'gn/db')
-rw-r--r--gn/db/sparql.scm22
1 files changed, 16 insertions, 6 deletions
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)