From 99cef5dab86b93fb6f7d600297bd4fbb54622a64 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 21 Aug 2023 15:37:37 +0300 Subject: Remove hard-coded paths Signed-off-by: Munyoki Kilyungi --- examples/tissue.scm | 61 +++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'examples/tissue.scm') diff --git a/examples/tissue.scm b/examples/tissue.scm index 22b715e..ce9f345 100755 --- a/examples/tissue.scm +++ b/examples/tissue.scm @@ -3,48 +3,53 @@ (use-modules (srfi srfi-1) (srfi srfi-26) + (ice-9 getopt-long) (ice-9 match) (ice-9 regex) (transform strings) (transform sql) (transform triples) (transform special-forms)) - - - -(define %connection-settings - (call-with-input-file (list-ref (command-line) 1) - read)) - (define-transformer tissue - ;; The Name and TissueName fields seem to be identical. BIRN_lex_ID - ;; and BIRN_lex_Name are mostly NULL. - (tables (Tissue)) + ;; The Name and TissueName fields seem to be identical. BIRN_lex_ID + ;; and BIRN_lex_Name are mostly NULL. + (tables (Tissue)) (schema-triples (gnc:tissue a skos:Concept)) ;; Hopefully the Short_Name field is distinct and can be used as an ;; identifier. (triples (string->identifier "tissue" (field Tissue Short_Name)) - (set rdf:type 'gnc:tissue) - (set rdfs:label (field Tissue Name)))) + (set rdf:type 'gnc:tissue) + (set rdfs:label (field Tissue Name)))) -(with-documentation - (name "Tissue Metadata") - (connection %connection-settings) - (table-metadata? #f) - (prefixes - '(("gn:" "") - ("gnt:" "") - ("skos:" "") - ("gnc:" "") - ("rdf:" "") - ("rdfs:" ""))) - (inputs - (list tissue)) - (outputs - '(#:documentation "./docs/tissue.md" - #:rdf "./verified-data/tissue.ttl"))) +(let* ((option-spec + '((settings (single-char #\s) (value #t)) + (output (single-char #\o) (value #t)) + (documentation (single-char #\d) (value #t)))) + (options (getopt-long (command-line) option-spec)) + (settings (option-ref options 'settings #f)) + (output (option-ref options 'output #f)) + (documentation (option-ref options 'documentation #f)) + (%connection-settings + (call-with-input-file settings + read))) + (with-documentation + (name "Tissue Metadata") + (connection %connection-settings) + (table-metadata? #f) + (prefixes + '(("gn:" "") + ("gnt:" "") + ("skos:" "") + ("gnc:" "") + ("rdf:" "") + ("rdfs:" ""))) + (inputs + (list tissue)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) -- cgit v1.2.3