Skip to content
Permalink
Browse files

Add test for rdf:langString & update code to take URI from vocabs

  • Loading branch information...
RickMoynihan committed Oct 28, 2019
1 parent 892fc51 commit 7720c28f57b51b595b3132870275043cf7ba98e7
Showing with 9 additions and 6 deletions.
  1. +1 −1 project.clj
  2. +1 −2 shadow-cljs.edn
  3. +4 −2 src/grafter_2/rdf/protocols.cljc
  4. +3 −1 test/grafter_2/rdf/protocols_test.cljs
@@ -43,7 +43,7 @@
[org.eclipse.rdf4j/rdf4j-repository-manager "3.0.0"]

[grafter/url "0.2.5"]
[grafter/vocabularies "0.3.1"]
[grafter/vocabularies "0.3.2"]
[me.raynes/fs "1.4.6"]
[potemkin "0.4.5"]]

@@ -1,6 +1,6 @@
{:source-paths ["src" "test"]

:dependencies [[grafter/vocabularies "0.3.1"]]
:dependencies [[grafter/vocabularies "0.3.2"]]

:nrepl {:port 8777}

@@ -10,4 +10,3 @@
:autorun true}
}
}

@@ -3,6 +3,7 @@
"Abstract functions for interacting with RDF & RDF backends, such as
RDF4j."
(:require [grafter.vocabularies.core :as gvc :refer [->uri]]
[grafter.vocabularies.rdf :as rdf]
[grafter.vocabularies.xsd :refer [xsd:boolean xsd:byte
xsd:date xsd:dateTime
xsd:decimal xsd:double
@@ -158,7 +159,8 @@

(defrecord OffsetDate [date timezone])

(def rdf:langString (->uri "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"))
(def ^{:deprecated "Use grafter.vocabularies.rdf/rdf:langString instead."}
rdf:langString rdf/rdf:langString)

;; TODO add tests to ensure that datatype-uri's etc are right
;; everywhere we do string coercions.
@@ -211,7 +213,7 @@

IDatatypeURI
(datatype-uri [this]
rdf:langString)
rdf/rdf:langString)

#?@(:cljs
;; IEmptyableCollection fix for protocol bug seen in Chrome / Chromium
@@ -1,13 +1,15 @@
(ns grafter-2.rdf.protocols-test
(:require [grafter.vocabularies.xsd :refer [xsd:boolean xsd:string]]
[grafter.vocabularies.rdf :refer [rdf:langString]]
[grafter-2.rdf.protocols :as pr]
[cljs.test :refer (deftest testing is are)]))

(deftest langstring-test
(testing "langstring"
(let [lang-string (pr/->LangString "foo-bar" :en)]
(is (= "foo-bar" (pr/raw-value lang-string)))
(is (instance? pr/LangString lang-string)))))
(is (instance? pr/LangString lang-string))
(is (= rdf:langString (pr/datatype-uri lang-string))))))

(deftest literal-test
(testing "literal"

0 comments on commit 7720c28

Please sign in to comment.
You can’t perform that action at this time.