Commit 606b9dc8 authored by Günter Hipler's avatar Günter Hipler
Browse files

basis für diskussion

parent cf927cc2
Pipeline #24276 passed with stages
in 7 minutes and 17 seconds
......@@ -5,3 +5,4 @@ target/
project/project
project/target
data
configs
......@@ -150,7 +150,7 @@ class EDM {
Extractors
.resourceGenres(graph)(record.value)
.foreach(c => cho.addSubject(Some(c)))
.foreach(c => cho.addGenre(Some(c)))
Extractors
.dcTermsCreated(graph)(record.value)
......
......@@ -308,13 +308,26 @@ object Extractors {
record =>
getAllBlankNodeContent(graph)(record)("hasGenre")
.filter(obj =>
obj("@type").str == "http://www.w3.org/2004/02/skos/core#Concept")
.flatMap(v =>
stringValue(v)("prefLabel") match {
case Some(s) => Some(s)
case None => None
obj("@type").str == "http://www.w3.org/2004/02/skos/core#Concept" &&
!obj.contains("resultsFrom"))
.flatMap(v => {
if (v("prefLabel").isInstanceOf[JArr]) {
v("prefLabel").arr.flatMap(item =>
stringValue(item.obj)("@value") match {
case Some(s) => Some(s)
case None => None
}
)
}
).toList
else {
stringValue(v)("prefLabel") match {
case Some(s) => Some(s)
case None => None
}
}
}
).toList.distinct
val resourceDCTermsExtent
: List[mutable.LinkedHashMap[String, JValue]] => List[String] =
......
This diff is collapsed.
......@@ -50,6 +50,8 @@ class CHOSpec extends AnyFunSuite with Matchers{
private val ricoNoCorrectIssuedProperty = loadFile("src/test/resources/rico.durationNoCorrectIssuedDate.json")
private lazy val ricoRawContributor = loadFile("src/test/resources/raw.contributor.json")
test ("create CHOObject with Identifier") {
......@@ -230,12 +232,31 @@ class CHOSpec extends AnyFunSuite with Matchers{
}
test ("collect genre dc:type") {
/*
val graph = Extractors.jsonGraph(ricoRegulatedBy).get.arr
val record = Extractors.record(graph).get.obj
val genres = Extractors.resourceGenres(graph)(record.value)
assert(genres.length == 1 && genres.head == "Fotos")
//exclude resultsFrom
val graph1 = Extractors.jsonGraph(ricoContributorP60441).get.arr
val record1 = Extractors.record(graph1).get.obj
val genres1 = Extractors.resourceGenres(graph1)(record1)
//println(genres1)
*/
val graph2 = Extractors.jsonGraph(ricoRawContributor).get.arr
val record2 = Extractors.record(graph2).get.obj
val digObj = Extractors.digitalObject(graph2).get
val genres2 = Extractors.resourceGenres(graph2)(record2.value)
//println(genres2)
val edm = new EDM
println(Utils.serializeRDFModel(edm.createChoObject(graph2,record2,digObj).obj.getModel))
}
......
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