From 4cab24d18cbf218ba1c59223425a3e41ab4fad54 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 23 Dec 2021 17:57:42 +0530 Subject: Automatically create domain triples for predicates. * dump.scm (define-dump): Automatically create domain triples for predicates. --- dump.scm | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/dump.scm b/dump.scm index c92a0cd..a2379f2 100755 --- a/dump.scm +++ b/dump.scm @@ -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) -- cgit v1.2.3