diff options
author | Munyoki Kilyungi | 2023-07-05 23:20:25 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2023-07-21 14:36:37 +0300 |
commit | 10bebdf9f9618b96c75ffdc1b197bde639ec8421 (patch) | |
tree | 2aaecee283705cee720762bcfce99a96d3613473 /dump/special-forms.scm | |
parent | bc15dbce4aeaa63acb49ba17860fb28d888b0f3d (diff) | |
download | gn-transform-databases-10bebdf9f9618b96c75ffdc1b197bde639ec8421.tar.gz |
Add table metadata to triple dump
Diffstat (limited to 'dump/special-forms.scm')
-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) )) |