diff options
Diffstat (limited to 'gn/db/sparql.scm')
-rw-r--r-- | gn/db/sparql.scm | 22 |
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)))) |