aboutsummaryrefslogtreecommitdiff
path: root/gn/db/sparql.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gn/db/sparql.scm')
-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)