From afd3d25530401569a5953dc1c411f43a56ebd02c Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 18 Aug 2023 15:41:28 +0200 Subject: Adding test infrastructure and reorganizing modules - still not happy with (web uri) --- gn/db/sparql.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gn/db/sparql.scm') diff --git a/gn/db/sparql.scm b/gn/db/sparql.scm index 95b4e1d..0e8c938 100644 --- a/gn/db/sparql.scm +++ b/gn/db/sparql.scm @@ -5,9 +5,11 @@ #:use-module (ice-9 iconv) #:use-module (ice-9 receive) #:use-module (ice-9 string-fun) - #:use-module (gn cache memoize) #:use-module (web client) + #:use-module (web request) #:use-module (web uri) + #:use-module (gn cache memoize) + #:use-module (web gn-uri) #:export (memo-sparql-species memo-sparql-species-meta @@ -15,9 +17,19 @@ compile-species get-rows tsv->scm + strip-lang ) ) + +(define (strip-lang s) + "Strip quotes and language tag (@en) from RDF entries" + (list->string (match (string->list s) + [(#\"rest ... #\") rest] + [(#\"rest ... #\" #\@ #\e #\n) rest] + [rest rest])) + ) + (define (gn-sparql-endpoint-url) "https://sparql.genenetwork.org/sparql") -- cgit v1.2.3