From 6aebd73eeeef944e555fec225c529c7674d7336d Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 16 Mar 2023 18:40:19 +0300 Subject: Annotate fields with a custom scheme such as "^^xsd:datetime" * dump.scm (annotate-field): New function. * dump/triples.scm (triple): Print a string as they appear with DISPLAY should they contain "\"" thus enabling a triple that looks like: gn:species_mus_musculus gn:name "Mouse"^^xsd:string Signed-off-by: Munyoki Kilyungi --- dump/triples.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'dump/triples.scm') diff --git a/dump/triples.scm b/dump/triples.scm index 1509ded..6ccf137 100644 --- a/dump/triples.scm +++ b/dump/triples.scm @@ -40,7 +40,16 @@ characters with an underscore and prefixing with gn:PREFIX." (number? object)) (error "Triple object not a string, symbol or number:" (list subject predicate object))) - (format #t "~a ~a ~s .~%" subject predicate object)) + (let ([format-string + (if (symbol? object) + "~a ~a ~a .~%" "~a ~a ~s .~%")] + [object + (if (and (symbol? object) + (string-contains (symbol->string object) + "\"")) + (symbol->string object) + object)]) + (format #t format-string subject predicate object))) (define (scm->triples alist id) (for-each (match-lambda -- cgit v1.2.3