diff options
author | Munyoki Kilyungi | 2023-07-26 13:32:16 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-07-30 12:29:56 +0300 |
commit | ddf6bd5b1016df4a4d8d4727852a7ed80cc90407 (patch) | |
tree | 40dcd9c1dc2dd7b39ba325414ec38ff56851e1c9 /dump | |
parent | b9a322a1e37c3e535b6e7bbe718d06ba0da85952 (diff) | |
download | gn-transform-databases-ddf6bd5b1016df4a4d8d4727852a7ed80cc90407.tar.gz |
Add new method "string->binomial-name"
* dump/triples.scm: Export string->binomial-name.
(string->binomial-name): New procedure.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'dump')
-rw-r--r-- | dump/triples.scm | 19 |
1 files changed, 18 insertions, 1 deletions
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))) |