aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dump/triples.scm19
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)))