Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
postprocessing
rico-edm-transformer
Commits
5a7f5e5d
Commit
5a7f5e5d
authored
Mar 08, 2021
by
Günter Hipler
Browse files
more evaluation on contributor vs. creator
parent
3231bc02
Pipeline
#22832
passed with stages
in 6 minutes and 32 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/scala/ch/memobase/edm/Extractors.scala
View file @
5a7f5e5d
...
...
@@ -52,6 +52,24 @@ object Extractors {
res
.
obj
.
value
}
private
val
objContainsValue
=
(
resource
:
JObj
)
=>
(
property
:
String
)
=>
(
value
:
String
)
=>
{
resource
(
property
).
getClass
match
{
case
_
:
Class
[
ujson.Arr
]
=>
resource
(
property
).
arr
.
exists
(
_
.
str
==
value
)
case
_
:
Class
[
ujson.Str
]
=>
resource
(
property
).
str
==
value
case
_
=>
false
}
}
private
val
getAllBlankNodeContent
=
(
graph
:
JArr
)
=>
(
resource
:
mutable.LinkedHashMap
[
String
,
JValue
])
=>
(
property
:
String
)
=>
graph
.
value
.
collect
{
case
res
if
objContainsValue
(
resource
)(
property
)
(
res
.
obj
(
"@id"
).
str
)
=>
res
.
obj
.
value
}
private
val
getBlankNodesContent
=
(
graph
:
JArr
)
=>
(
resource
:
mutable.LinkedHashMap
[
String
,
JValue
])
=>
(
property
:
String
)
=>
...
...
@@ -133,6 +151,40 @@ object Extractors {
)
.
toList
//noinspection ScalaStyle
val
resourceContributor
:
JArr
=>
mutable
.
LinkedHashMap
[
String
,
JValue
]
=>
List
[
(
String
,
String
)
]
=
graph
=>
record
=>
getBlankNodesContent
(
graph
)(
record
)(
"recordResourceOrInstantiationIsSourceOfCreationRelation"
)
.
flatMap
(
obj
=>
getBlankNodeContent
(
graph
)(
obj
)(
"creationRelationHasTarget"
)
.
filter
(
v
=>
v
(
"type"
).
str
==
"contributor"
)
.
flatMap
(
v
=>
stringValue
(
v
)(
"name"
))
match
{
case
Some
(
name
)
=>
Some
(
obj
.
getOrElse
(
"name"
,
obj
(
"type"
)).
str
,
name
)
case
None
=>
None
}
)
.
toList
val
resourceContributorBlanknodes
:
JArr
=>
mutable
.
LinkedHashMap
[
String
,
JValue
]
=>
List
[
mutable.LinkedHashMap
[
String
,
JValue
]
]
=
graph
=>
record
=>
getAllBlankNodeContent
(
graph
)(
record
)(
"recordResourceOrInstantiationIsSourceOfCreationRelation"
).
toList
val
producer
:
JArr
=>
mutable
.
LinkedHashMap
[
String
,
JValue
]
=>
Option
[
String
]
=
graph
=>
...
...
src/test/resources/raw.contributor.json
0 → 100644
View file @
5a7f5e5d
{
"@graph"
:
[
{
"@id"
:
"_:b0"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b2"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b1"
,
"resultsIn"
:
"_:b3"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b1"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"LanguagesNormalizer"
,
"performs"
:
"_:b0"
},
{
"@id"
:
"_:b10"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Interview"
},
{
"@language"
:
"fr"
,
"@value"
:
"Interview"
},
{
"@language"
:
"it"
,
"@value"
:
"Intervista"
}
],
"resultsFrom"
:
"_:b11"
},
{
"@id"
:
"_:b11"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b17"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b31"
,
"resultsIn"
:
"_:b10"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b12"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"GenreNormalizer"
,
"performs"
:
"_:b13"
},
{
"@id"
:
"_:b13"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b66"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b12"
,
"resultsIn"
:
"_:b74"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b14"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CorporateBody"
,
"eventType"
:
"CREATE"
,
"agentIsTargetOfCreationRelation"
:
"_:b15"
,
"name"
:
"Studio Radio Lausanne"
},
{
"@id"
:
"_:b15"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CreationRelation"
,
"creationRelationHasSource"
:
"https://memobase.ch/record/rts-002-FNB023_1639_023"
,
"creationRelationHasTarget"
:
"_:b14"
,
"name"
:
"Author"
,
"type"
:
"creator"
},
{
"@id"
:
"_:b16"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"name"
:
"Français"
,
"type"
:
"content"
},
{
"@id"
:
"_:b17"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Intervista"
},
{
"@id"
:
"_:b18"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Gespräch"
},
{
"@language"
:
"fr"
,
"@value"
:
"Interview"
},
{
"@language"
:
"it"
,
"@value"
:
"Intervista"
}
],
"resultsFrom"
:
"_:b19"
},
{
"@id"
:
"_:b19"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b25"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b41"
,
"resultsIn"
:
"_:b18"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b2"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"name"
:
"French"
,
"type"
:
"content"
},
{
"@id"
:
"_:b20"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CreationRelation"
,
"creationRelationHasSource"
:
"https://memobase.ch/record/rts-002-FNB023_1639_023"
,
"creationRelationHasTarget"
:
"_:b21"
,
"name"
:
"Orateur / Responsable du Cabinet des Affaires étrangères"
,
"type"
:
"contributor"
},
{
"@id"
:
"_:b21"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Agent"
,
"agentIsTargetOfCreationRelation"
:
"_:b20"
,
"name"
:
"inconnu"
},
{
"@id"
:
"_:b22"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"name"
:
"Francese"
,
"type"
:
"content"
},
{
"@id"
:
"_:b23"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Gespräch"
},
{
"@language"
:
"fr"
,
"@value"
:
"Interview"
},
{
"@language"
:
"it"
,
"@value"
:
"Intervista"
}
],
"resultsFrom"
:
"_:b5"
},
{
"@id"
:
"_:b24"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Rule"
,
"name"
:
"SOCIETA SVIZZERA DI RADIODIFFUSIONE E TELEVISIONE, Losanna; SOCIETE SUISSE DE RADIODIFFUSION ET TELEVISION, Lausanne; SCHWEIZERISCHE RADIO-UND FERNSEHGESELLSCHAFT; SWISS BROADCASTING CORPORATION; SRG SSR IDEE SUISSE"
,
"regulates"
:
"https://memobase.ch/record/rts-002-FNB023_1639_023"
,
"type"
:
"holder"
},
{
"@id"
:
"_:b25"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Parlato"
},
{
"@id"
:
"_:b26"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"CarrierTypeNormalizer"
,
"performs"
:
"_:b27"
},
{
"@id"
:
"_:b27"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b44"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b26"
,
"resultsIn"
:
"_:b45"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b28"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Rede"
},
{
"@language"
:
"fr"
,
"@value"
:
"Discours"
},
{
"@language"
:
"it"
,
"@value"
:
"Discorso"
}
],
"resultsFrom"
:
"_:b29"
},
{
"@id"
:
"_:b29"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b71"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b83"
,
"resultsIn"
:
"_:b28"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b3"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q150"
,
"name"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Französisch"
},
{
"@language"
:
"fr"
,
"@value"
:
"français"
},
{
"@language"
:
"it"
,
"@value"
:
"francese"
}
],
"resultsFrom"
:
"_:b0"
,
"type"
:
"content"
},
{
"@id"
:
"_:b30"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Agent"
,
"name"
:
"BORDENEUVE"
},
{
"@id"
:
"_:b31"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"GenreNormalizer"
,
"performs"
:
"_:b11"
},
{
"@id"
:
"_:b32"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Agent"
,
"name"
:
"MOREAU, Jean"
},
{
"@id"
:
"_:b33"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Rede"
},
{
"@id"
:
"_:b34"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"GenreNormalizer"
,
"performs"
:
"_:b35"
},
{
"@id"
:
"_:b35"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b54"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b34"
,
"resultsIn"
:
"_:b48"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b36"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CorporateBody"
,
"name"
:
"[Aucune information]"
},
{
"@id"
:
"_:b37"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Coup d'état en Algérie"
},
{
"@id"
:
"_:b38"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Gesprochen"
},
{
"@id"
:
"_:b39"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Person"
,
"agentIsTargetOfCreationRelation"
:
"_:b40"
,
"name"
:
"COTY, René"
},
{
"@id"
:
"_:b4"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"GenreNormalizer"
,
"performs"
:
"_:b5"
},
{
"@id"
:
"_:b40"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CreationRelation"
,
"creationRelationHasSource"
:
"https://memobase.ch/record/rts-002-FNB023_1639_023"
,
"creationRelationHasTarget"
:
"_:b39"
,
"name"
:
"Orateur / Président de la République"
,
"type"
:
"contributor"
},
{
"@id"
:
"_:b41"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"GenreNormalizer"
,
"performs"
:
"_:b19"
},
{
"@id"
:
"_:b42"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"name"
:
"Französisch"
,
"type"
:
"content"
},
{
"@id"
:
"_:b43"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q150"
,
"name"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Französisch"
},
{
"@language"
:
"fr"
,
"@value"
:
"français"
},
{
"@language"
:
"it"
,
"@value"
:
"francese"
}
],
"resultsFrom"
:
"_:b7"
,
"type"
:
"content"
},
{
"@id"
:
"_:b44"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"name"
:
"78 T Direktschnittplatte"
},
{
"@id"
:
"_:b45"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q17010713"
,
"name"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Direktschnitt"
},
{
"@language"
:
"fr"
,
"@value"
:
"L'ÉTIQUETTE MANQUANTE"
},
{
"@language"
:
"it"
,
"@value"
:
"GALATEO MANCANTE"
}
],
"resultsFrom"
:
"_:b27"
},
{
"@id"
:
"_:b46"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CreationRelation"
,
"creationRelationHasSource"
:
"https://memobase.ch/record/rts-002-FNB023_1639_023"
,
"creationRelationHasTarget"
:
"_:b47"
,
"name"
:
"Présentateur / Journaliste"
,
"type"
:
"contributor"
},
{
"@id"
:
"_:b47"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Agent"
,
"agentIsTargetOfCreationRelation"
:
"_:b46"
,
"name"
:
"inconnu"
},
{
"@id"
:
"_:b48"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Interview"
},
{
"@language"
:
"fr"
,
"@value"
:
"Interview"
},
{
"@language"
:
"it"
,
"@value"
:
"Intervista"
}
],
"resultsFrom"
:
"_:b35"
},
{
"@id"
:
"_:b49"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CorporateBody"
,
"name"
:
"Studio Radio Lausanne"
},
{
"@id"
:
"_:b5"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b64"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b4"
,
"resultsIn"
:
"_:b23"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b50"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Interview"
},
{
"@language"
:
"fr"
,
"@value"
:
"Interview"
},
{
"@language"
:
"it"
,
"@value"
:
"Intervista"
}
],
"resultsFrom"
:
"_:b51"
},
{
"@id"
:
"_:b51"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b79"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b81"
,
"resultsIn"
:
"_:b50"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b52"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Mechanism"
,
"name"
:
"LanguagesNormalizer"
,
"performs"
:
"_:b53"
},
{
"@id"
:
"_:b53"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b16"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b52"
,
"resultsIn"
:
"_:b57"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b54"
,
"@type"
:
"http://www.w3.org/2004/02/skos/core#Concept"
,
"prefLabel"
:
"Interview"
},
{
"@id"
:
"_:b55"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q150"
,
"name"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Französisch"
},
{
"@language"
:
"fr"
,
"@value"
:
"français"
},
{
"@language"
:
"it"
,
"@value"
:
"francese"
}
],
"resultsFrom"
:
"_:b56"
,
"type"
:
"content"
},
{
"@id"
:
"_:b56"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Activity"
,
"affects"
:
"_:b22"
,
"beginningDate"
:
"2021-29-16T16:29:22+0000"
,
"endDate"
:
"2021-29-16T16:29:22+0000"
,
"performedBy"
:
"_:b80"
,
"resultsIn"
:
"_:b55"
,
"type"
:
"enrichment"
},
{
"@id"
:
"_:b57"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Language"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q150"
,
"name"
:
[
{
"@language"
:
"de"
,
"@value"
:
"Französisch"
},
{
"@language"
:
"fr"
,
"@value"
:
"français"
},
{
"@language"
:
"it"
,
"@value"
:
"francese"
}
],
"resultsFrom"
:
"_:b53"
,
"type"
:
"content"
},
{
"@id"
:
"_:b58"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Place"
,
"name"
:
"Alger"
},
{
"@id"
:
"_:b59"
,