Skip to content

Commit

Permalink
Update to be compatible with grafter 0.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RickMoynihan committed Mar 18, 2019
1 parent 9210222 commit fc78a69
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/core.logic "0.8.11"]]

:profiles {:dev {:dependencies [[grafter "0.11.4"]]}}
:profiles {:dev {:dependencies [[grafter "0.12.2"]]}}

:deploy-repositories [["releases" :clojars]
["snapshots" :clojars]]
Expand Down
34 changes: 26 additions & 8 deletions src/grafter/matcha/alpha.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,37 @@
(when (every? some? (map resolve syms))
`(do ~@body)))

(try
;; avoid issue: https://github.com/Swirrl/matcha/issues/5
(require '[grafter.rdf.protocols :as gp])
(import '[grafter.rdf.protocols RDFLiteral LangString Quad])
(defn require-grafter-protocols [require-form]
(try
(require require-form)
:required
(catch java.io.FileNotFoundException _
:fne)
(catch java.lang.ClassNotFoundException _
:cnfe)
(catch clojure.lang.Compiler$CompilerException _
;; this ones a little aggressive...
:cce
)
))

(require-grafter-protocols '[grafter.rdf.protocols])
(require-grafter-protocols '[grafter-2.rdf.protocols])

(when-available #{grafter.rdf.protocols.LangString grafter.rdf.protocols.RDFLiteral}
(extend-protocol lp/IUninitialized
grafter.rdf.protocols.LangString
(lp/-uninitialized [coll] coll)

(catch java.io.FileNotFoundException _))
grafter.rdf.protocols.RDFLiteral
(lp/-uninitialized [coll] coll)))

(when-available #{LangString RDFLiteral}
(when-available #{grafter_2.rdf.protocols.LangString grafter_2.rdf.protocols.RDFLiteral}
(extend-protocol lp/IUninitialized
LangString
grafter_2.rdf.protocols.LangString
(lp/-uninitialized [coll] coll)

RDFLiteral
grafter_2.rdf.protocols.RDFLiteral
(lp/-uninitialized [coll] coll)))

(pldb/db-rel triple ^:index subject ^:index predicate ^:index object)
Expand Down
4 changes: 2 additions & 2 deletions test/grafter/matcha/alpha_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[grafter.vocabularies.core :refer [prefixer]]
[grafter.vocabularies.foaf :refer [foaf:knows]]
[grafter.vocabularies.rdf :refer [rdfs:label]]
[grafter.rdf.protocols :refer [->Triple] :as gp]
[grafter-2.rdf.protocols :refer [->Triple] :as gp]
[clojure.spec.alpha :as s])
(:import [grafter.rdf.protocols LangString RDFLiteral]
(:import [grafter_2.rdf.protocols LangString RDFLiteral]
[java.net URI]))

(deftest quote-query-vars-test
Expand Down

0 comments on commit fc78a69

Please sign in to comment.