aboutsummaryrefslogtreecommitdiff
path: root/gn/db
diff options
context:
space:
mode:
authorPjotr Prins2023-08-21 12:21:01 +0200
committerPjotr Prins2023-08-21 12:21:01 +0200
commitd06d732625fdc48677ea32b129da905ebd527c38 (patch)
treec744372e426a2c1ed2042192e8292cb3a0536e31 /gn/db
parentb151e98e3933d7e21f20554cc892f0bef0740cba (diff)
downloadgn-guile-d06d732625fdc48677ea32b129da905ebd527c38.tar.gz
Getting group info
Diffstat (limited to 'gn/db')
-rw-r--r--gn/db/sparql.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/gn/db/sparql.scm b/gn/db/sparql.scm
index fd779c6..2665235 100644
--- a/gn/db/sparql.scm
+++ b/gn/db/sparql.scm
@@ -14,8 +14,10 @@
#:export (memo-sparql-species
memo-sparql-species-meta
sparql-species-meta
+ sparql-groups-meta
memo-sparql-wd-species-info
compile-species
+ compile-groups-meta
get-rows
tsv->scm
strip-lang
@@ -218,3 +220,23 @@ dump-species-metadata.ttl:gn:Axbxa gnt:belongsToSpecies gn:Mus_musculus .
))
rows)
recs)
+
+;; ------------------------------------------------------------------------------
+
+(define (sparql-groups-meta)
+ "Return values names recs"
+ (sparql-scm (gn-sparql-endpoint-url) "
+ SELECT DISTINCT ?set ?species ?descr WHERE {
+ ?set rdf:type gnc:inbredSet ;
+ gnt:belongsToSpecies ?species .
+ OPTIONAL {?set rdfs:label ?descr } .
+ }"))
+
+(define memo-sparql-groups-meta
+ (memoize2 sparql-groups-meta))
+
+(define (compile-groups-meta)
+ "Return tuple of names and rows containing #(set species descr)"
+ (receive (names res) (memo-sparql-groups-meta)
+ (let ([rows (get-rows names res)])
+ (list names rows))))