aboutsummaryrefslogtreecommitdiff
path: root/transform
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-10-31 10:42:08 +0300
committerMunyoki Kilyungi2024-10-31 10:42:08 +0300
commit5c9676e401ac254d0b06c3e1f64a3c9527660094 (patch)
tree99bd409695d3b2cc00845d3e4adf5625c77426c8 /transform
parentc1c492389ff2d37e5b6cd76d0134de1aba979a9d (diff)
downloadgn-transform-databases-5c9676e401ac254d0b06c3e1f64a3c9527660094.tar.gz
Make documentation? and data? optional in special-forms.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'transform')
-rw-r--r--transform/special-forms.scm70
1 files changed, 36 insertions, 34 deletions
diff --git a/transform/special-forms.scm b/transform/special-forms.scm
index 99b30df..ddb3180 100644
--- a/transform/special-forms.scm
+++ b/transform/special-forms.scm
@@ -537,40 +537,42 @@ The above query results to triples that have the form:
(call-with-target-database
connection
(lambda (db)
- (with-output-to-file ;
- doc-path
- (lambda ()
- (format #t "# ~a" name)
- (for-each
- (lambda (proc)
- (proc db
- #:metadata? #f
- #:data? #f
- #:documentation?
- (lambda () (for-each
- (match-lambda
- ((k v)
- (begin
- (prefix k v #f))))
- prefixes))))
- inputs))
- #:encoding "UTF-8")
+ (when doc-path
+ (with-output-to-file ;
+ doc-path
+ (lambda ()
+ (format #t "# ~a" name)
+ (for-each
+ (lambda (proc)
+ (proc db
+ #:metadata? #f
+ #:data? #f
+ #:documentation?
+ (lambda () (for-each
+ (match-lambda
+ ((k v)
+ (begin
+ (prefix k v #f))))
+ prefixes))))
+ inputs))
+ #:encoding "UTF-8"))
;; Dumping the actual data
- (with-output-to-file
- rdf-path
- (lambda ()
- ;; Add the prefixes
- (for-each
- (match-lambda
- ((k v)
- (begin
- (prefix k v))))
- prefixes)
- (newline)
- (for-each
- (lambda (proc)
- (proc db #:metadata? table-metadata?))
- inputs))
- #:encoding "UTF-8")))))))
+ (when rdf-path
+ (with-output-to-file
+ rdf-path
+ (lambda ()
+ ;; Add the prefixes
+ (for-each
+ (match-lambda
+ ((k v)
+ (begin
+ (prefix k v))))
+ prefixes)
+ (newline)
+ (for-each
+ (lambda (proc)
+ (proc db #:metadata? table-metadata?))
+ inputs))
+ #:encoding "UTF-8"))))))))