From f96056e48c83cb5d083bdb59dd5d11306bb5ac31 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 23 Dec 2025 14:14:51 +0300 Subject: Use "-" in qnames. Signed-off-by: Munyoki Kilyungi --- transform/triples.scm | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/transform/triples.scm b/transform/triples.scm index f2dbcf7..55edf8a 100644 --- a/transform/triples.scm +++ b/transform/triples.scm @@ -35,27 +35,31 @@ (format #f "~s~a" string-field schema))))) (define* (string->identifier - prefix str - #:optional #:key - (ontology "gn:") - (separator "") - (proc string-capitalize-first)) + prefix str + #:optional #:key + (ontology "gn:") + (separator "") + (proc string-capitalize-first)) "Convert STR to a turtle identifier after replacing illegal characters with an underscore and prefixing with gn:PREFIX." (if (or (and (string? str) (string-null? str)) - (eq? str #f)) + (eq? str #f)) "" (string->symbol (string-append ontology prefix separator - (string-delete - (lambda (c) - (eq? c #\))) - (string-map (lambda (c) - (case c - ((#\/ #\< #\> #\+ #\( #\space #\@) #\_) - (else c))) - (proc - (string-trim-right str #\.)))))))) + (string-delete + (lambda (c) + (eq? c #\))) + (string-map (lambda (c) + (case c + ((#\/ #\< #\> #\+ #\( #\space #\@) #\-) + (else c))) + (proc + (string-trim-right + (regexp-substitute/global + #f "_" + str + 'pre "-" 'post) #\.)))))))) (define* (prefix prefix iri #:optional (ttl? #t)) -- cgit 1.4.1