diff options
author | Munyoki Kilyungi | 2023-07-05 23:20:25 +0300 |
---|---|---|
committer | BonfaceKilz | 2023-07-30 12:29:56 +0300 |
commit | fe564abecd58bcbc3fbe6893d53ca7bf58251f2c (patch) | |
tree | 2aaecee283705cee720762bcfce99a96d3613473 /dump | |
parent | 9dc944bac064cd591580df4743063530f07d427b (diff) | |
download | gn-transform-databases-fe564abecd58bcbc3fbe6893d53ca7bf58251f2c.tar.gz |
Add table metadata to triple dump
Diffstat (limited to 'dump')
-rw-r--r-- | dump/special-forms.scm | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/dump/special-forms.scm b/dump/special-forms.scm index d94733e..727b356 100644 --- a/dump/special-forms.scm +++ b/dump/special-forms.scm @@ -459,7 +459,8 @@ must be remedied." (list 'triple-predicate ...) (list 'triple-object ...)))) (_ (error "Invalid schema triples clause:" #'schema-triples-clause))) - (format out "## Generated Triples: + (format out " +## Generated Triples: The following SQL query was executed: @@ -467,7 +468,7 @@ The following SQL query was executed: ~a ``` -Here are the generated triples: +Triples take the form: " (select-query #,(collect-fields #'(subject predicate-clauses ...)) @@ -483,14 +484,20 @@ Here are the generated triples: '() #,@(translate-forms 'field (lambda (x) - (symbol->string - (syntax->datum - ((syntax-rules (field) - ((field (query alias)) alias) - ((field table column) column) - ((field table column alias) alias)) - x)))) - #'(predicate-clauses ...)))) + (syntax-case x (field) + ((field (query alias)) + #`(format #f "~a" (syntax->datum #'alias))) + ((field table column) + #`(format #f "~a.~a" + (syntax->datum #'table) + (syntax->datum #'column))) + ((field table column alias) + #`(format #f "~a.~a" + (syntax->datum table) + (syntax->datum alias))))) + #'(predicate-clauses ...))) + ) + (format out "~%") ;; To clear the buffer (force-output out) )) |