diff options
author | Arun Isaac | 2021-12-23 17:57:42 +0530 |
---|---|---|
committer | Arun Isaac | 2021-12-23 17:57:42 +0530 |
commit | 4cab24d18cbf218ba1c59223425a3e41ab4fad54 (patch) | |
tree | c97f2c78687ba0a47c5d46bcf396ae93a0ff6787 | |
parent | 1deb7d533866f7b67e9df112e5ad89dd42ee70cd (diff) | |
download | gn-transform-databases-4cab24d18cbf218ba1c59223425a3e41ab4fad54.tar.gz |
Automatically create domain triples for predicates.
* dump.scm (define-dump): Automatically create domain triples for
predicates.
-rwxr-xr-x | dump.scm | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -249,20 +249,25 @@ ALIST field-name) forms." (syntax-case predicate-clause () ((_ predicate _) ;; Dump metadata about the dump itself. - #`(scm->triples - (map-alist '() - (set rdf:type 'gn:dump) - (set gn:createsPredicate 'predicate) - (filter-set gn:forSubjectType #,subject-type) - (multiset gn:dependsOn - '#,(map (lambda (field) - (match (syntax->datum field) - ((table-name column-name _ ...) - (datum->syntax - x (column-id (symbol->string table-name) - (symbol->string column-name)))))) - (collect-fields predicate-clause)))) - #,(dump-id dump-table (syntax->datum #'predicate)))) + #`(begin + (scm->triples + (map-alist '() + (set rdf:type 'gn:dump) + (set gn:createsPredicate 'predicate) + (filter-set gn:forSubjectType #,subject-type) + (multiset gn:dependsOn + '#,(map (lambda (field) + (match (syntax->datum field) + ((table-name column-name _ ...) + (datum->syntax + x (column-id (symbol->string table-name) + (symbol->string column-name)))))) + (collect-fields predicate-clause)))) + #,(dump-id dump-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 ...))) (sql-for-each (lambda (row) |