Commit 6a53bc32 authored by Günter Hipler's avatar Günter Hipler
Browse files

test for using the iri when creating a subject like ProvidedCHO

parent 8e615736
Pipeline #24260 passed with stages
in 7 minutes and 5 seconds
......@@ -19,6 +19,7 @@
package ch.memobase.rico2edm.edm
import ch.memobase.Utils
import ch.memobase.Utils.loadFile
import ch.memobase.rico2edm.edm.subjects.ProvidedCHO
import ch.memobase.rico2edm.rdf.writer.RdfXmlWriter
......@@ -50,6 +51,35 @@ class CHOSpec extends AnyFunSuite with Matchers{
private val ricoNoCorrectIssuedProperty = loadFile("src/test/resources/rico.durationNoCorrectIssuedDate.json")
test ("create CHOObject with Identifier") {
val graph = Extractors.jsonGraph(ricoDuration).get.arr
val record = Extractors.record(graph).get
val idIri = Extractors.recordId(record).get
val idShort = Extractors.recordIdShort(graph)(record)
assert(idIri == "https://memobase.ch/record/raf-001-2893")
assert(idShort.get == "raf-001-2893")
/*
so far I haven't seen a possibility with rdf4j to create a resource as part of a model without an explicit base iri
or to use an implicit base uri not part of the iri(...) argument
by now I have to use an absolute iri
If you are using a rio parser (Rio.parse) you can provide a base Uri as part of the constructor
at the moment I haven't enough time to analyze it in more depth
*/
assertThrows[IllegalArgumentException](new ProvidedCHO(idShort.get))
val cho = new ProvidedCHO(idIri)
assert(Utils.serializeRDFModel(cho.getModel).contains(
"""<edm:ProvidedCHO rdf:about="https://memobase.ch/record/raf-001-2893">"""))
}
test("get creator") {
val graph = Extractors.jsonGraph(rawRicoIndent).get.arr
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment