From 398d5d9a59ae5cb6f74b415eb343a2c6eeadb440 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 26 Jul 2023 13:32:16 +0300 Subject: Add new method "string->binomial-name" * dump/triples.scm: Export string->binomial-name. (string->binomial-name): New procedure. Signed-off-by: Munyoki Kilyungi --- dump/triples.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dump/triples.scm b/dump/triples.scm index 2b43d68..0206ba3 100644 --- a/dump/triples.scm +++ b/dump/triples.scm @@ -7,7 +7,8 @@ prefix triple scm->triples - annotate-field)) + annotate-field + string->binomial-name)) (define (annotate-field field schema) (let ([schema (cond ((symbol? schema) @@ -89,3 +90,19 @@ characters with an underscore and prefixing with gn:PREFIX." (else object)) (fn id predicate object)))) alist)) + +(define (string->binomial-name name) + (let ((binomial? + (string-match + "\\\(.+\\)" + name))) + (string->identifier + "" + (if binomial? + (regexp-substitute/global + #f "[^[:space:]A-Za-z0-9:]" + (match:substring binomial?) + 'pre "" 'post) + name) + #:separator "" + #:proc string-capitalize-first))) -- cgit v1.2.3