aboutsummaryrefslogtreecommitdiff
path: root/dump/special-forms.scm
diff options
context:
space:
mode:
Diffstat (limited to 'dump/special-forms.scm')
-rw-r--r--dump/special-forms.scm36
1 files changed, 18 insertions, 18 deletions
diff --git a/dump/special-forms.scm b/dump/special-forms.scm
index f771cc1..2650580 100644
--- a/dump/special-forms.scm
+++ b/dump/special-forms.scm
@@ -14,11 +14,11 @@
find-clause
remove-namespace
column-id
- dump-id
+ id
syntax-let
blank-node
map-alist
- dump-with-documentation
+ with-documentation
define-transformer))
(define (key->assoc-ref alist x)
@@ -276,12 +276,12 @@ ALIST field-name) forms."
"user2" table-name)
"__" column-name)))
- (define (dump-id dump-table predicate)
+ (define (id table predicate)
(symbol->string
(string->identifier
"dump"
(string-append
- dump-table "_" (remove-namespace (symbol->string predicate)))))))
+ table "_" (remove-namespace (symbol->string predicate)))))))
(define-syntax blank-node
(syntax-rules ()
@@ -396,11 +396,11 @@ must be remedied."
((triples subject predicate-clauses ...) (triples)
(find-clause #'(clauses ...) 'triples)))
#`(define* (name db #:key
- (dump-metadata? #f)
- (dump-data? #t)
- (dump-documentation? #f))
- (when dump-metadata?
- #,@(let ((dump-table (symbol->string (syntax->datum #'primary-table)))
+ (metadata? #f)
+ (data? #t)
+ (documentation? #f))
+ (when metadata?
+ #,@(let ((table (symbol->string (syntax->datum #'primary-table)))
(subject-type (any (lambda (predicate)
(syntax-case predicate (rdf:type)
((_ rdf:type type) #'type)
@@ -427,14 +427,14 @@ must be remedied."
(datum->syntax
x (column-id query (symbol->string alias))))))
(collect-fields predicate-clause))))
- #,(dump-id dump-table (syntax->datum #'predicate)))
+ #,(id table (syntax->datum #'predicate)))
;; Automatically create domain triples
;; for predicates.
(when #,subject-type
(triple 'predicate 'rdfs:domain #,subject-type))))
(_ (error "Invalid predicate clause:" predicate-clause))))
#'(predicate-clauses ...))))
- (when dump-documentation?
+ (when documentation?
(format #t "~%## '~a'~%~%" (syntax->datum #'name))
#,(syntax-case #'schema-triples-clause (schema-triples)
((schema-triples (triple-subject triple-predicate triple-object) ...)
@@ -477,7 +477,7 @@ The above query results to triples that have the form:
'()
#,@(field->datum #'(predicate-clauses ...))))
(format #t "```~%Here's an example query:~%~%```sparql~%")
- (dump-documentation?)
+ (documentation?)
(newline)
(let* ((result
(map-alist (sql-find
@@ -520,7 +520,7 @@ The above query results to triples that have the form:
(primary-table other-tables ...)
tables-raw ...)))
(format #t "```~%~%"))
- (when dump-data?
+ (when data?
#,(syntax-case #'schema-triples-clause (schema-triples)
((schema-triples (triple-subject triple-predicate triple-object) ...)
#`(for-each triple
@@ -545,7 +545,7 @@ The above query results to triples that have the form:
(cadr kv)
default)))
-(define-syntax dump-with-documentation
+(define-syntax with-documentation
(syntax-rules ()
((_ (key value) ...)
(let* ((alist `((key . ,value) ...))
@@ -567,9 +567,9 @@ The above query results to triples that have the form:
(for-each
(lambda (proc)
(proc db
- #:dump-metadata? #f
- #:dump-data? #f
- #:dump-documentation?
+ #:metadata? #f
+ #:data? #f
+ #:documentation?
(lambda () (for-each
(match-lambda
((k v)
@@ -593,7 +593,7 @@ The above query results to triples that have the form:
(newline)
(for-each
(lambda (proc)
- (proc db #:dump-metadata? table-metadata?))
+ (proc db #:metadata? table-metadata?))
inputs))
#:encoding "UTF-8")))))))