aboutsummaryrefslogtreecommitdiff
path: root/gn/db
diff options
context:
space:
mode:
authorPjotr Prins2023-08-18 15:41:28 +0200
committerPjotr Prins2023-08-18 15:41:28 +0200
commitafd3d25530401569a5953dc1c411f43a56ebd02c (patch)
tree95188317effce4e1b90e898b1d4f582cb033c848 /gn/db
parentb9fb2c69136fe243fc9c6f7c3c4f8917814a401e (diff)
downloadgn-guile-afd3d25530401569a5953dc1c411f43a56ebd02c.tar.gz
Adding test infrastructure and reorganizing modules - still not happy with (web uri)
Diffstat (limited to 'gn/db')
-rw-r--r--gn/db/sparql.scm14
1 files changed, 13 insertions, 1 deletions
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")