Commit 2d994b07 authored by Günter Hipler's avatar Günter Hipler
Browse files

more proproperties for CHO object

parent 324d98b6
Pipeline #22909 passed with stages
in 6 minutes and 26 seconds
...@@ -34,7 +34,9 @@ ist die Kardinalität tatsächlich 0-n? ...@@ -34,7 +34,9 @@ ist die Kardinalität tatsächlich 0-n?
Ich finde bei uns nur literal Ich finde bei uns nur literal
-> muss noch eine geeignete Implementierung her, die beide Fälle berücksichtigt -> muss noch eine geeignete Implementierung her, die beide Fälle berücksichtigt
#### dcTermsCreated
da noch mehr aufräumen - ich klebe zuviel zusammen
s. testcase CHOSpec "collect alternatives dcterms:created"
......
...@@ -135,6 +135,11 @@ class EDM { ...@@ -135,6 +135,11 @@ class EDM {
.resourceGenres(graph)(record.value) .resourceGenres(graph)(record.value)
.foreach(c => cho.addSubject(Some(c))) .foreach(c => cho.addSubject(Some(c)))
Extractors
.dcTermsCreated(graph)(record.value)
.foreach(c => cho.addDcTermsCreated(Some(c)))
ExtractionResult(cho) ExtractionResult(cho)
} }
......
...@@ -257,6 +257,49 @@ object Extractors { ...@@ -257,6 +257,49 @@ object Extractors {
} }
).toList ).toList
val dcTermsCreated
: JArr => mutable.LinkedHashMap[String, JValue] => List[String] =
graph =>
record =>
getAllBlankNodeContent(graph)(record)("created")
.filter(obj =>
obj.contains("normalizedDateValue")
)
.flatMap(v =>
stringValue(v)("normalizedDateValue") match {
case Some(s) => Some(s)
case None => None
}
).toList :::
getAllBlankNodeContent(graph)(record)("created")
.filter(obj =>
obj.contains("expressedDate")
)
.flatMap(v =>
stringValue(v)("expressedDate") match {
case Some(s) => Some(s)
case None => None
}
).toList :::
getAllBlankNodeContent(graph)(record)("created")
.filter(obj =>
obj.contains("certainty")
)
.flatMap(v => {
val certainty = stringValue(v)("certainty") match {
case Some(s) => Some(s)
case None => Option.empty[String]
}
val expressedDate = stringValue(v)("expressedDate") match {
case Some(s) => Some(s)
case None => Option.empty[String]
}
Some(s"${certainty.getOrElse("")} / ${expressedDate.getOrElse("")}")
}
).toList
val resourceTitles val resourceTitles
: JArr => mutable.LinkedHashMap[String, JValue] => List[String] = : JArr => mutable.LinkedHashMap[String, JValue] => List[String] =
......
...@@ -25,7 +25,7 @@ import ch.memobase.rdf.vocabularies.EDM ...@@ -25,7 +25,7 @@ import ch.memobase.rdf.vocabularies.EDM
import org.eclipse.rdf4j.model.Model import org.eclipse.rdf4j.model.Model
import org.eclipse.rdf4j.model.impl.SimpleValueFactory import org.eclipse.rdf4j.model.impl.SimpleValueFactory
import org.eclipse.rdf4j.model.util.Values.iri import org.eclipse.rdf4j.model.util.Values.iri
import org.eclipse.rdf4j.model.vocabulary.{DC, RDF} import org.eclipse.rdf4j.model.vocabulary.{DC, DCTERMS, RDF}
class ProvidedCHO (val id: String) { class ProvidedCHO (val id: String) {
...@@ -74,6 +74,10 @@ class ProvidedCHO (val id: String) { ...@@ -74,6 +74,10 @@ class ProvidedCHO (val id: String) {
def addGenre(genre:Option[String]): Unit = def addGenre(genre:Option[String]): Unit =
genre.map(t => model.add(iri(id),DC.TYPE,factory.createLiteral(t))) genre.map(t => model.add(iri(id),DC.TYPE,factory.createLiteral(t)))
def addDcTermsCreated(dctermsCreated:Option[String]): Unit =
dctermsCreated.map(t => model.add(iri(id),DCTERMS.CREATED,factory.createLiteral(t)))
def getModel: Model = model def getModel: Model = model
......
{
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "Bei der Sammlung Historische Fotografie sind die Urheberrechte grundsätzlich bei den jeweiligen Fotografen. Die Schutzdauer von 70 Jahre nach Ableben des Urhebers ist in den meisten Fällen jedoch abgelaufen. In jenen Fällen, bei denen die Schutzdauer noch nicht abgelaufen ist, wurden die Rechte dem SNM übertragen. Bei den Archivbeständen der beiden Westschweizer Pressefotoagenturen ASL und PDL ist das SNM der Rechteinhaber.",
"regulates": "https://memobase.ch/record/lmz-001--597216",
"type": "holder"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "-597216",
"type": "original"
},
{
"@id": "_:b10",
"@type": "https://www.ica.org/standards/RiC/ontology#CarrierType",
"name": [
{
"@language": "de",
"@value": "Keine Angabe"
},
{
"@language": "fr",
"@value": "Aucune information"
},
{
"@language": "it",
"@value": "Nessuna informazione"
}
],
"resultsFrom": "_:b11"
},
{
"@id": "_:b11",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"affects": "_:b15",
"beginningDate": "2021-31-17T01:31:02+0000",
"endDate": "2021-31-17T01:31:02+0000",
"performedBy": "_:b13",
"resultsIn": "_:b10",
"type": "enrichment"
},
{
"@id": "_:b12",
"@type": "https://www.ica.org/standards/RiC/ontology#Agent",
"agentIsTargetOfCreationRelation": "_:b8",
"name": "PDL-Fotoagentur Presse Diffusion Lausanne"
},
{
"@id": "_:b13",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "CarrierTypeNormalizer",
"performs": "_:b11"
},
{
"@id": "_:b14",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/CNE/1.0/",
"name": "Copyright Not Evaluated (CNE)",
"regulates": "https://memobase.ch/physical/lmz-001--597216-1",
"type": "usage"
},
{
"@id": "_:b15",
"@type": "https://www.ica.org/standards/RiC/ontology#CarrierType",
"name": "[siehe Technische Bemerkung]"
},
{
"@id": "_:b16",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "onsite",
"regulates": "https://memobase.ch/physical/lmz-001--597216-1",
"type": "access"
},
{
"@id": "_:b17",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"affects": "_:b6",
"beginningDate": "2021-31-17T01:31:02+0000",
"endDate": "2021-31-17T01:31:02+0000",
"performedBy": "_:b18",
"resultsIn": "_:b2",
"type": "enrichment"
},
{
"@id": "_:b18",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "GenreNormalizer",
"performs": "_:b17"
},
{
"@id": "_:b19",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/CNE/1.0/",
"name": "Copyright Not Evaluated (CNE)",
"regulates": "https://memobase.ch/digital/lmz-001--597216-1",
"type": "usage"
},
{
"@id": "_:b2",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": [
{
"@language": "de",
"@value": "Pressefotografie"
},
{
"@language": "fr",
"@value": "Photographie de presse"
},
{
"@language": "it",
"@value": "Fotografia per la stampa"
}
],
"resultsFrom": "_:b17"
},
{
"@id": "_:b20",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "public",
"regulates": "https://memobase.ch/digital/lmz-001--597216-1",
"type": "access"
},
{
"@id": "_:b21",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "LM-149688.31",
"type": "callNumber"
},
{
"@id": "_:b22",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "lmz-001--597216-1",
"type": "main"
},
{
"@id": "_:b23",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "lmz-001--597216-1",
"type": "main"
},
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": "[Ärztin misst einem Mädchen den Puls]",
"type": "main"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#DateRange",
"certainty": "Datiert nach Inschrift",
"expressedDate": "Monat 5 1945"
},
{
"@id": "_:b5",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "SNM--597216",
"type": "oldMemobase"
},
{
"@id": "_:b6",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Pressefotografie"
},
{
"@id": "_:b7",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "lmz-001--597216",
"type": "main"
},
{
"@id": "_:b8",
"@type": "https://www.ica.org/standards/RiC/ontology#CreationRelation",
"creationRelationHasSource": "https://memobase.ch/record/lmz-001--597216",
"creationRelationHasTarget": "_:b12",
"name": "Author",
"type": "creator"
},
{
"@id": "_:b9",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Ärztin"
},
{
"@id": "https://memobase.ch/digital/lmz-001--597216-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"P60558": "Grayscale",
"hasFormat": "fmt/43",
"hasMimeType": "image/jpeg",
"height": "1009.0",
"isDistributedOn": "image",
"locator": "sftp:/swissbib_index/mb_sftp/lmz-001/media/-597216.jpg",
"orientation": "Undefined",
"width": "965.0",
"componentColor": [
"2F2F4F",
"545454",
"A9A9A9",
"000000",
"8FBC8F",
"D9D9F3",
"527F76"
],
"eventType": "CREATE",
"identifiedBy": "_:b23",
"instantiates": "https://memobase.ch/record/lmz-001--597216",
"isDerivedFromInstantiation": "https://memobase.ch/physical/lmz-001--597216-1",
"regulatedBy": [
"_:b20",
"_:b19"
],
"type": "digitalObject"
},
{
"@id": "https://memobase.ch/physical/lmz-001--597216-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"hasCarrierType": [
"_:b15",
"_:b10"
],
"hasDerivedInstantiation": "https://memobase.ch/digital/lmz-001--597216-1",
"identifiedBy": [
"_:b21",
"_:b22"
],
"instantiates": "https://memobase.ch/record/lmz-001--597216",
"physicalCharacteristics": "Bemerkung: Masse: Höhe 6 cm, Breite 6 cm <br> <br> Material und Technik: MIttelformatnegativ: Gelatinesilber-Film auf flexibler Filmträger.",
"regulatedBy": [
"_:b16",
"_:b14"
],
"type": "physicalObject"
},
{
"@id": "https://memobase.ch/record/lmz-001--597216",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"abstract": "Ärztin misst einem Mädchen den Puls",
"created": "_:b4",
"P60451": "https://memobase.ch/institution/mrv",
"sameAs": "https://www.nationalmuseum.ch/sammlung_online/?lauftext=LM-149688.31",
"hasGenre": [
"_:b2",
"_:b6"
],
"eventType": "CREATE",
"isPublished": false,
"conditionsOfUse": "Das SNM hat die Objekte nach den Originalen aus seinen Sammlungen reproduziert. Bei urheberrechtlich geschützten Objekten (Werke) hat die Benutzerin oder der Benutzer die benötigten Verwendungsrechte selbst einzuholen sowie das Urheberpersönlichkeitsrecht zu wahren. Mit Ausnahme der gesetzlich erlaubten Werkverwendung ist jegliche andere Nutzung ohne Einverständnis der Rechteinhaber verboten. Das SNM übernimmt keinerlei Haftung für die Verwendung durch die Benutzenden oder Dritte. Bildbestellungen können beim SNM unter Einhaltung der \u201eAllgemeinen Geschäftsbedingungen \u2013 Bildbestellung\u201c jederzeit vorgenommen werden.",
"descriptiveNote": "S/W-Negativ",
"hasInstantiation": [
"https://memobase.ch/physical/lmz-001--597216-1",
"https://memobase.ch/digital/lmz-001--597216-1"
],
"hasSubject": "_:b9",
"hasTitle": "_:b3",
"heldBy": "https://memobase.ch/institution/lmz",
"identifiedBy": [
"_:b1",
"_:b5",
"_:b7"
],
"isPartOf": "https://memobase.ch/recordSet/lmz-001",
"recordResourceOrInstantiationIsSourceOfCreationRelation": "_:b8",
"regulatedBy": "_:b0",
"title": "[Ärztin misst einem Mädchen den Puls]",
"type": "Foto"
}
],
"@context": {
"conditionsOfUse": {"@id": "https://www.ica.org/standards/RiC/ontology#conditionsOfUse"},
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
"abstract": {"@id": "http://purl.org/dc/terms/abstract"},
"regulatedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulatedBy",
"@type": "@id"
},
"type": {"@id": "https://www.ica.org/standards/RiC/ontology#type"},
"heldBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#heldBy",
"@type": "@id"
},
"eventType": {"@id": "https://memobase.ch/internal/eventType"},
"title": {"@id": "https://www.ica.org/standards/RiC/ontology#title"},
"identifiedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifiedBy",
"@type": "@id"
},
"hasGenre": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasGenre",
"@type": "@id"
},
"hasTitle": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasTitle",
"@type": "@id"
},
"P60451": {
"@id": "http://rdaregistry.info/Elements/u/P60451",
"@type": "@id"
},
"hasInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasInstantiation",
"@type": "@id"
},
"created": {
"@id": "http://purl.org/dc/terms/created",
"@type": "@id"
},
"isPartOf": {
"@id": "https://www.ica.org/standards/RiC/ontology#isPartOf",
"@type": "@id"
},
"sameAs": {"@id": "http://schema.org/sameAs"},
"descriptiveNote": {"@id": "https://www.ica.org/standards/RiC/ontology#descriptiveNote"},
"recordResourceOrInstantiationIsSourceOfCreationRelation": {
"@id": "https://www.ica.org/standards/RiC/ontology#recordResourceOrInstantiationIsSourceOfCreationRelation",
"@type": "@id"
},
"hasSubject": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasSubject",
"@type": "@id"
},
"name": {"@id": "https://www.ica.org/standards/RiC/ontology#name"},
"resultsFrom": {
"@id": "https://www.ica.org/standards/RiC/ontology#resultsFrom",
"@type": "@id"
},
"agentIsTargetOfCreationRelation": {
"@id": "https://www.ica.org/standards/RiC/ontology#agentIsTargetOfCreationRelation",
"@type": "@id"
},
"performs": {
"@id": "https://www.ica.org/standards/RiC/ontology#performs",
"@type": "@id"
},
"identifier": {"@id": "https://www.ica.org/standards/RiC/ontology#identifier"},
"regulates": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulates",
"@type": "@id"
},
"beginningDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#beginningDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"endDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#endDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"performedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#performedBy",
"@type": "@id"
},
"affects": {
"@id": "https://www.ica.org/standards/RiC/ontology#affects",
"@type": "@id"
},
"resultsIn": {
"@id": "https://www.ica.org/standards/RiC/ontology#resultsIn",
"@type": "@id"
},
"expressedDate": {"@id": "https://www.ica.org/standards/RiC/ontology#expressedDate"},
"certainty": {"@id": "https://www.ica.org/standards/RiC/ontology#certainty"},
"prefLabel": {"@id": "http://www.w3.org/2004/02/skos/core#prefLabel"},
"physicalCharacteristics": {"@id": "https://www.ica.org/standards/RiC/ontology#physicalCharacteristics"},
"hasCarrierType": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasCarrierType",
"@type": "@id"
},
"hasDerivedInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasDerivedInstantiation",
"@type": "@id"
},
"instantiates": {
"@id": "https://www.ica.org/standards/RiC/ontology#instantiates",
"@type": "@id"
},
"componentColor": {
"@id": "http://www.europeana.eu/schemas/edm/componentColor",
"@type": "http://www.w3.org/2001/XMLSchema#hexBinary"
},
"orientation": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#orientation"},
"width": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#width"},
"P60558": {"@id": "http://rdaregistry.info/Elements/u/P60558"},
"isDistributedOn": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#isDistributedOn"},
"locator": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#locator"},
"hasFormat": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasFormat"},
"height": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#height"},
"hasMimeType": {"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasMimeType"},
"isDerivedFromInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#isDerivedFromInstantiation",
"@type": "@id"
},
"creationRelationHasSource": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasSource",
"@type": "@id"
},
"creationRelationHasTarget": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasTarget",
"@type": "@id"
}
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -36,6 +36,9 @@ class CHOSpec extends AnyFunSuite with Matchers{ ...@@ -36,6 +36,9 @@ class CHOSpec extends AnyFunSuite with Matchers{
private lazy val ricoRegulatedBy = loadFile("src/test/resources/rico.regulatedBy.json") private lazy val ricoRegulatedBy = loadFile("src/test/resources/rico.regulatedBy.json")
private lazy val ricoNoSourceInRecord = loadFile("src/test/resources/raw2.indent.json") private lazy val ricoNoSourceInRecord = loadFile("src/test/resources/raw2.indent.json")
private lazy val ricoCertainty = loadFile("src/test/resources/rico.certainty.json")
test("get creator") { test("get creator") {
...@@ -184,4 +187,21 @@ class CHOSpec extends AnyFunSuite with Matchers{ ...@@ -184,4 +187,21 @@ class CHOSpec extends AnyFunSuite with Matchers{
} }
test ("collect alternatives dcterms:created") {
val graph = Extractors.jsonGraph(ricoRegulatedBy).get.arr
val record = Extractors.record(graph).get.obj
val normalizedDateValue = Extractors.dcTermsCreated(graph)(record)
assert(normalizedDateValue.length == 1 && normalizedDateValue.head == "1942-08-07")
val graph1 = Extractors.jsonGraph(ricoCertainty).get.arr
val record1 = Extractors.record(graph1).get.obj
val certainty = Extractors.dcTermsCreated(graph1)(record1)
certainty.foreach(println)
}
} }
Supports Markdown
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