diff options
author | Munyoki Kilyungi | 2023-07-26 13:32:16 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2023-07-31 13:10:14 +0300 |
commit | 398d5d9a59ae5cb6f74b415eb343a2c6eeadb440 (patch) | |
tree | f6cd5bd4752a34fb2ec3c3893554ce1650bbe17b /dump/triples.scm | |
parent | 3fc9108643add02ddc945b9d4f63a9e50e5e5d44 (diff) | |
download | gn-transform-databases-398d5d9a59ae5cb6f74b415eb343a2c6eeadb440.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/triples.scm')
-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))) |