Skip to content

Commit

Permalink
Fix another issue related to #93 with ints
Browse files Browse the repository at this point in the history
  • Loading branch information
RickMoynihan committed Jun 3, 2020
1 parent 22804eb commit b532dc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/grafter_2/rdf/protocols.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xsd:float xsd:float
xsd:integer xsd:short
xsd:string xsd:time
xsd:long]]
xsd:int xsd:long]]
#?@(:clj [[grafter.url :refer [->java-uri]]]))
#?(:clj (:import [java.net URI]
[java.time LocalTime LocalDate LocalDateTime OffsetTime OffsetDateTime]
Expand Down Expand Up @@ -346,9 +346,10 @@
(datatype-uri [t]
(->java-uri xsd:float))

;; bounded int
Integer
(datatype-uri [t]
(->java-uri xsd:integer))
(->java-uri xsd:int))

Long
(datatype-uri [t]
Expand Down
6 changes: 4 additions & 2 deletions test/grafter_2/rdf4j/io_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[grafter-2.rdf4j.io :as sut :refer [statements]]
[grafter-2.rdf4j.templater :refer [graph]]
[grafter.url :as url]
[grafter.vocabularies.core :refer [prefixer]])
[grafter.vocabularies.core :refer [prefixer ->uri]])
(:import grafter_2.rdf.protocols.OffsetDate
java.net.URI
[java.time LocalDate LocalDateTime LocalTime OffsetDateTime OffsetTime ZoneOffset]
Expand All @@ -21,13 +21,15 @@
"http://www.w3.org/2001/XMLSchema#double" Double "10.7"
"http://www.w3.org/2001/XMLSchema#float" Float "10.6"
"http://www.w3.org/2001/XMLSchema#integer" BigInteger "10"
"http://www.w3.org/2001/XMLSchema#long" Long "10"
"http://www.w3.org/2001/XMLSchema#int" Integer "10"))

(deftest backend-literal->grafter-type-test
(are [clj-val uri klass]
(let [ret-val (sut/backend-literal->grafter-type (sut/->backend-type clj-val))]
(is (= clj-val ret-val))
(is (= klass (class clj-val))))
(is (= klass (class clj-val)))
(is (= (->uri uri) (pr/datatype-uri clj-val))))

true "http://www.w3.org/2001/XMLSchema#boolean" Boolean
(byte 10) "http://www.w3.org/2001/XMLSchema#byte" Byte
Expand Down

0 comments on commit b532dc7

Please sign in to comment.