Skip to content

Commit 75291df

Browse files
committed
Rename library ns's to grafter-2 & update RDF dependencies to RDF4j
grafter.tabular always had an implicit sesame dependency, so update the library to work with RDF4j version of grafter. And change namespace to grafter-2 to allow projects to use both old and new versions simultaneously should they require during a transition. NOTE: this library is still deprecated and is soley in maintenance mode.
1 parent ac0a131 commit 75291df

File tree

12 files changed

+47
-48
lines changed

12 files changed

+47
-48
lines changed

project.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject grafter/grafter.tabular "0.11.3-SNAPSHOT"
1+
(defproject grafter/grafter.tabular-2 "2.1.0-SNAPSHOT"
22
:description "Tools for the hard graft of data processing"
33
:url "http://grafter.org/"
44
:license {:name "Eclipse Public License - v1.0"
@@ -8,7 +8,7 @@
88

99
:dependencies [[org.clojure/clojure "1.9.0"]
1010
[org.clojure/tools.logging "0.3.1"]
11-
[grafter "0.11.2"] ;; depends on grafter.rdf.protocols
11+
[grafter "2.1.0"] ;; depends on grafter.rdf.protocols
1212
[commons-io/commons-io "2.4"]
1313
[me.raynes/fs "1.4.6"]
1414
[potemkin "0.4.3"]

src/grafter/rdf/preview.clj renamed to src/grafter_2/rdf/preview.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
(ns grafter.rdf.preview
1+
(ns grafter-2.rdf.preview
22
"Tool support for rendering previews of grafter.tabular graph-fn templates
33
with values from datasets."
44
(:require [clojure.walk]
55
[clojure.edn :as edn]
6-
[grafter.tabular :refer [make-dataset]])
6+
[grafter-2.tabular :refer [make-dataset]])
77
(:import [incanter.core Dataset]))
88

99
(defn- symbolize-keys [m]
@@ -107,7 +107,7 @@
107107
(preview-graph dataset graphf row false))
108108

109109
([dataset graphf row render-constants?]
110-
(let [form (:grafter.tabular/template (meta graphf))
110+
(let [form (:grafter-2.tabular/template (meta graphf))
111111
bindings (first (second form))
112112
body-forms (drop 2 form)
113113
printable-row-data (->printable-form (nth (:rows dataset) row nil))
@@ -118,7 +118,7 @@
118118
(map (fn [body-form]
119119
(let [replaced-vals (clojure.walk/postwalk-replace subs body-form)]
120120
(if (= :render-constants render-constants?)
121-
(bind-constants (:grafter.tabular/defined-in-ns (meta graphf)) replaced-vals)
121+
(bind-constants (:grafter-2.tabular/defined-in-ns (meta graphf)) replaced-vals)
122122
replaced-vals)))))})))
123123

124124
(comment

src/grafter/sequences.clj renamed to src/grafter_2/sequences.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(ns grafter.sequences
1+
(ns grafter-2.sequences
22
"A library of useful lazy sequences."
33
(:require [clojure.string :refer [blank?]]))
44

src/grafter/tabular.clj renamed to src/grafter_2/tabular.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
(ns grafter.tabular
1+
(ns grafter-2.tabular
22
"Functions for processing tabular data."
33
(:require [clojure
44
[set :as set]
55
[string :as str]]
6-
[grafter.tabular.common :as tabc :refer [lift->vector map-keys]]
6+
[grafter-2.tabular.common :as tabc :refer [lift->vector map-keys]]
77
[incanter.core :as inc]
88
[potemkin.namespaces :refer [import-vars]])
99
(:import incanter.core.Dataset))
1010

1111
;; Load protocol definitions. This could occur in the ns definition but putting
1212
;; them in their means that namespace refactoring tools can clear them out
1313
;; accidentally. Better to explicitly require them to ensure they're loaded.
14-
(require '[grafter.tabular
14+
(require '[grafter-2.tabular
1515
[csv]
1616
[excel]])
1717

1818
;; This one is necessary for import-vars - again separating these from the ns
1919
;; definition protects them against overzealous refactoring tools.
20-
(require '[grafter.tabular.melt])
20+
(require '[grafter-2.tabular.melt])
2121

2222
(import-vars
23-
[grafter.tabular.common
23+
[grafter-2.tabular.common
2424
dataset?
2525
column-names
2626
make-dataset
@@ -31,7 +31,7 @@
3131
with-metadata-columns
3232
without-metadata-columns
3333
resolve-column-id]
34-
[grafter.tabular.melt
34+
[grafter-2.tabular.melt
3535
melt])
3636

3737

@@ -598,7 +598,7 @@ the specified column being cloned."
598598
should not be considered part of this namespaces public interface.
599599
It is only public because it is used by a macro."
600600
[ds row index]
601-
(let [col-name (grafter.tabular/resolve-column-id ds index ::not-found)]
601+
(let [col-name (grafter-2.tabular/resolve-column-id ds index ::not-found)]
602602
(if-not (= col-name ::not-found)
603603
(get row col-name ::not-found))))
604604

src/grafter/tabular/common.clj renamed to src/grafter_2/tabular/common.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
(ns grafter.tabular.common
1+
(ns grafter-2.tabular.common
22
{:no-doc true}
33
(:require [clj-excel.core :as xls]
4-
[grafter.sequences :as seqs]
4+
[grafter-2.sequences :as seqs]
55
[clojure.java.io :as io]
66
[incanter.core :as inc]
77
[me.raynes.fs :as fs])
@@ -138,9 +138,9 @@
138138
(defn assoc-data-source-meta [output-ds data-source]
139139
"Adds metadata about where the dataset was loaded from to the object."
140140
(let [source-meta (cond
141-
(#{String File URI URL} (class data-source)) {:grafter.tabular/data-source data-source}
141+
(#{String File URI URL} (class data-source)) {:grafter-2.tabular/data-source data-source}
142142
(instance? incanter.core.Dataset data-source) (meta data-source)
143-
:else {:grafter.tabular/data-source :datasource-unknown}) ]
143+
:else {:grafter-2.tabular/data-source :datasource-unknown}) ]
144144
(with-meta output-ds (merge (meta output-ds) source-meta))))
145145

146146
(defmulti ^:no-doc read-dataset*

src/grafter/tabular/csv.clj renamed to src/grafter_2/tabular/csv.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
(ns grafter.tabular.csv
1+
(ns grafter-2.tabular.csv
22
{:no-doc true}
33
(:require [clojure.data.csv :as csv]
44
[clojure.java.io :as io]
5-
[grafter.tabular.common :as tab]
6-
[grafter.rdf.protocols :refer [raw-value]])
5+
[grafter-2.tabular.common :as tab]
6+
[grafter-2.rdf.protocols :refer [raw-value]])
77
(:import [java.io IOException]
88
[org.apache.commons.io.input BOMInputStream]))
99

src/grafter/tabular/edn.clj renamed to src/grafter_2/tabular/edn.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
(ns grafter.tabular.edn
1+
(ns grafter-2.tabular.edn
22
{:no-doc true}
3-
(:require [grafter.tabular.common :as tab]
3+
(:require [grafter-2.tabular.common :as tab]
44
[clojure.edn :as edn]
55
[incanter.core :refer [->Dataset]]
66
[clojure.java.io :refer [reader writer]])

src/grafter/tabular/excel.clj renamed to src/grafter_2/tabular/excel.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
(ns grafter.tabular.excel
1+
(ns grafter-2.tabular.excel
22
{:no-doc true}
33
(:require [clj-excel.core :as xls]
4-
[grafter.tabular.common :as tab]
4+
[grafter-2.tabular.common :as tab]
55
[clojure.java.io :as io])
66
(:import
77
[java.net URI URL]
88
[org.apache.poi.ss.usermodel Cell]))
99

1010
;; Extend the clj-excel multi-method to handle expected grafter types
1111
;; when outputting as an Excel file.
12-
(defmethod xls/cell-mutator org.openrdf.model.URI [^Cell cell ^org.openrdf.model.URI val] (.setCellValue cell (str val)))
12+
(defmethod xls/cell-mutator org.eclipse.rdf4j.model.URI [^Cell cell ^org.eclipse.rdf4j.model.URI val] (.setCellValue cell (str val)))
1313
(defmethod xls/cell-mutator URI [^Cell cell ^URI val] (.setCellValue cell (str val)))
1414
(defmethod xls/cell-mutator URL [^Cell cell ^URI val] (.setCellValue cell (str val)))
1515
(defmethod xls/cell-mutator :default [^Cell cell val] (.setCellValue cell (str val)))

src/grafter/tabular/melt.clj renamed to src/grafter_2/tabular/melt.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
(ns ^:no-doc grafter.tabular.melt
1+
(ns ^:no-doc grafter-2.tabular.melt
22
"Functions for melting data and building variations on melt."
33
(:require
44
[clojure.set :as set]
5-
[grafter.tabular.common :refer :all]))
5+
[grafter-2.tabular.common :refer :all]))
66

77
(defn mapcat-rows
88
"Transforms a dataset by performing a mapcat operation on the

test/grafter/sequences_test.clj renamed to test/grafter_2/sequences_test.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
(ns grafter.sequences-test
1+
(ns grafter-2.sequences-test
22
(:require [clojure.test :refer :all]
3-
[grafter.sequences :refer :all]))
3+
[grafter-2.sequences :refer :all]))
44

55
(deftest column-names-seq-test
66
(testing "iterates alphabet repeatedly like it's numeric"
@@ -19,4 +19,3 @@
1919
(testing "fills initial nil values with given value"
2020
(is (= [:a :a :b]
2121
(fill-when (complement nil?) '(nil nil :b) :a)))))
22-

test/grafter/tabular/melt_test.clj renamed to test/grafter_2/tabular/melt_test.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
(ns grafter.tabular.melt-test
2-
(:require [grafter.tabular :refer [column-names make-dataset]]
3-
[grafter.tabular.melt :refer :all]
1+
(ns grafter-2.tabular.melt-test
2+
(:require [grafter-2.tabular :refer [column-names make-dataset]]
3+
[grafter-2.tabular.melt :refer :all]
44
[clojure.test :refer :all]))
55

66
(defn datasets-equal?

test/grafter/tabular_test.clj renamed to test/grafter_2/tabular_test.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
(ns grafter.tabular-test
1+
(ns grafter-2.tabular-test
22
(:require [clojure.test :refer :all]
3-
[grafter.sequences :as seqs]
4-
[grafter.tabular.common :as tabc]
5-
[grafter.tabular :refer :all]
6-
[grafter.rdf.protocols :refer [->Quad]]
7-
[grafter.rdf.templater :refer [graph triplify]]
8-
[grafter.tabular.csv]
9-
[grafter.tabular.excel]
10-
[grafter.tabular.edn]
3+
[grafter-2.sequences :as seqs]
4+
[grafter-2.tabular.common :as tabc]
5+
[grafter-2.tabular :refer :all]
6+
[grafter-2.rdf.protocols :refer [->Quad]]
7+
[grafter-2.rdf4j.templater :refer [graph triplify]]
8+
[grafter-2.tabular.csv]
9+
[grafter-2.tabular.excel]
10+
[grafter-2.tabular.edn]
1111
[incanter.core :as inc]
1212
[clojure.java.io :as io])
1313
(:import [java.io File]))
@@ -130,7 +130,7 @@
130130
(defn has-metadata? [ds]
131131
(let [md (meta ds)]
132132
(is md "There is no metadata set")
133-
(is (:grafter.tabular/data-source md) "There is no :data-source set.")))
133+
(is (:grafter-2.tabular/data-source md) "There is no :data-source set.")))
134134

135135
(defmethod tabc/read-dataset* ::test
136136
[source opts]
@@ -256,7 +256,7 @@
256256
(is (= '("Sheet1" "Sheet2") (mapcat keys datasets))))))
257257

258258
(testing "Opening a sequential thing"
259-
(let [ds (grafter.tabular/make-dataset [[1 2 3]])
259+
(let [ds (grafter-2.tabular/make-dataset [[1 2 3]])
260260
datasets (read-datasets [{"foo" ds}])]
261261
(is (every? is-a-dataset? (mapcat vals datasets)))
262262
(is ((first datasets) "foo") ds)))
@@ -308,7 +308,7 @@
308308
(columns test-data [:a :b])) "should select columns 0 and 1 (a and b)"))
309309

310310
(testing "works with infinite sequences"
311-
(is (columns test-data (grafter.sequences/integers-from 5))
311+
(is (columns test-data (seqs/integers-from 5))
312312
"Takes as much as it can from the supplied sequence and returns those columns.")
313313

314314
(is (thrown? IndexOutOfBoundsException
@@ -803,12 +803,12 @@
803803
[a
804804
[b c]]))
805805
ds (make-dataset [["http://one/" "http://two/" "http://three/"]])
806-
quad-meta (meta (first (my-graphfn ds)))] (is (= {:grafter.tabular/row {"a" "http://one/" "b" "http://two/" "c" "http://three/"}}
806+
quad-meta (meta (first (my-graphfn ds)))] (is (= {:grafter-2.tabular/row {"a" "http://one/" "b" "http://two/" "c" "http://three/"}}
807807
quad-meta)
808808
"Adds the row that yielded each Quad as metadata")
809809

810810
(is (= {"a" "http://one/" "b" "http://two/" "c" "http://three/"}
811-
(:grafter.tabular/row quad-meta))
811+
(:grafter-2.tabular/row quad-meta))
812812
"Adds the row that yielded each Quad as metadata"))))))
813813

814814
(deftest rename-test

0 commit comments

Comments
 (0)