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/publication.scm | 58 ++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'examples/publication.scm') diff --git a/examples/publication.scm b/examples/publication.scm index d9e2aa5..81606b2 100755 --- a/examples/publication.scm +++ b/examples/publication.scm @@ -3,6 +3,7 @@ (use-modules (srfi srfi-1) (srfi srfi-26) + (ice-9 getopt-long) (ice-9 match) (ice-9 regex) (transform strings) @@ -12,12 +13,6 @@ -(define %connection-settings - (call-with-input-file (list-ref (command-line) 1) - read)) - - - (define-transformer publication (tables (Publication)) (triples @@ -59,23 +54,34 @@ -(with-documentation - (name "Publications Metadata") - (connection %connection-settings) - (table-metadata? #f) - (prefixes - '(("gnt:" "") - ("fabio:" "") - ("dct:" "") - ("prism:" "") - ("gn:" "") - ("gnc:" "") - ("pubmed:" "") - ("rdfs:" "") - ("xsd:" "") - ("rdf:" ""))) - (inputs - (list publication)) - (outputs - '(#:documentation "./docs/publication.md" - #:rdf "./verified-data/publication.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 "Publications Metadata") + (connection %connection-settings) + (table-metadata? #f) + (prefixes + '(("gnt:" "") + ("fabio:" "") + ("dct:" "") + ("prism:" "") + ("gn:" "") + ("gnc:" "") + ("pubmed:" "") + ("rdfs:" "") + ("xsd:" "") + ("rdf:" ""))) + (inputs + (list publication)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) -- cgit v1.2.3