-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcli.clj
27 lines (22 loc) · 827 Bytes
/
cli.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(ns rdfa.cli
(:gen-class)
(:require (rdfa repr parser)))
; TODO: would be more useful if env contained data about *used* prefixes.
;(defn print-prefixes [{prefix-map :prefix-map vocab :vocab}]
; (letfn [(printpfx [pfx iri]
; (println (str "@prefix " pfx ": <" iri "> .")))]
; (if vocab (printpfx "" vocab))
; (doseq [[pfx iri] prefix-map]
; (printpfx pfx iri))))
(defn print-triples [triples]
(doseq [triple triples]
(-> triple rdfa.repr/repr-triple println)))
(defn -main [& args]
(doseq [path args]
(let [location (.. (java.net.URI. path) (toString))
{:keys [env triples proc-triples]} (rdfa.parser/get-rdfa location)]
(do
;(print-prefixes env)
(print-triples triples)
; TODO: only if --proc in args
(print-triples proc-triples)))))