Commit 971cb67a authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add rico:affects to Activity. This allows us to determine where an enrichement came from.

parent 85f809c5
Pipeline #20251 passed with stage
in 2 minutes and 5 seconds
......@@ -48,7 +48,7 @@ dependencies {
//compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '7.1.0'
implementation "org.apache.logging.log4j:log4j-api:${log4jV}"
implementation 'org.memobase:memobase-service-utilities:2.0.2'
implementation 'org.memobase:memobase-service-utilities:2.0.4'
// YAML Parser
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.+'
implementation 'com.fasterxml.jackson.core:jackson-core:2.11.+'
......
......@@ -33,11 +33,13 @@ object Activity {
fun appendActivity(
concept: RicoResource,
mechanismName: String,
sourceResource: RicoResource,
model: MemobaseModel
) {
val mechanism = createMechanism(model, mechanismName)
val activity = createActivity(model)
activity.addProperty(RICO.performedBy, mechanism)
activity.addProperty(RICO.affects, sourceResource.resource)
mechanism.addProperty(RICO.performs, activity)
concept.addProperty(RICO.resultsFrom, activity)
activity.addProperty(RICO.resultsIn, concept.resource)
......
......@@ -49,8 +49,8 @@ class EnrichedConceptBuilder(
return this
}
fun appendActivity(mechanismName: String): EnrichedConceptBuilder {
resource?.let { Activity.appendActivity(it, mechanismName, model) }
fun appendActivity(mechanismName: String, sourceResource: RicoResource): EnrichedConceptBuilder {
resource?.let { Activity.appendActivity(it, mechanismName, sourceResource, model) }
return this
}
......
......@@ -49,7 +49,7 @@ class CarrierTypeNormalizer(
.addLabels(RICO.name, labelsMap.getOrDefault(facetValue, Labels.default))
.addSameAsLink(facetValue)
.addOtherStatements(copyStatements)
.appendActivity(KEYS.carrierTypeNormalizerMechanismName)
.appendActivity(KEYS.carrierTypeNormalizerMechanismName, item)
.build()
}
facetValues.freeFacetValue.forEach { facetValue ->
......@@ -57,7 +57,7 @@ class CarrierTypeNormalizer(
.init()
.addLabels(RICO.name, labelsMap.getOrDefault(facetValue, Labels.default))
.addOtherStatements(copyStatements)
.appendActivity(KEYS.carrierTypeNormalizerMechanismName)
.appendActivity(KEYS.carrierTypeNormalizerMechanismName, item)
.build()
}
null
......
......@@ -53,7 +53,7 @@ class GenreNormalizer(
.addLabels(SKOS.prefLabel, labelsMap.getOrDefault(facetValue, Labels.default))
.addSameAsLink(facetValue)
.addOtherStatements(copyStatements)
.appendActivity(KEYS.genreNormalizerMechanismName)
.appendActivity(KEYS.genreNormalizerMechanismName, item)
.build()
}
facetValues.freeFacetValue.forEach { facetValue ->
......@@ -61,7 +61,7 @@ class GenreNormalizer(
.init()
.addLabels(SKOS.prefLabel, labelsMap.getOrDefault(facetValue, Labels.default))
.addOtherStatements(copyStatements)
.appendActivity(KEYS.genreNormalizerMechanismName)
.appendActivity(KEYS.genreNormalizerMechanismName, item)
.build()
}
null
......
......@@ -50,7 +50,7 @@ class LanguagesNormalizer(
.addLabels(RICO.name, labelsMap.getOrDefault(facetValue, Labels.default))
.addSameAsLink(facetValue)
.addOtherStatements(copyStatements)
.appendActivity(KEYS.languageNormalizerMechanismName)
.appendActivity(KEYS.languageNormalizerMechanismName, item)
.build()
}
facetValues.freeFacetValue.forEach { facetValue ->
......@@ -58,7 +58,7 @@ class LanguagesNormalizer(
.init()
.addLabels(RICO.name, labelsMap.getOrDefault(facetValue, Labels.default))
.addOtherStatements(copyStatements)
.appendActivity(KEYS.languageNormalizerMechanismName)
.appendActivity(KEYS.languageNormalizerMechanismName, item)
.build()
}
null
......
......@@ -22,26 +22,27 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
_:b0 a rico:Language ;
schema:sameAs "http://www.wikidata.org/entity/Q188" ;
rico:name "tedesco"@it , "allemand"@fr , "Deutsch"@de ;
rico:resultsFrom _:b1 ;
rico:type "caption" .
[ a rico:Record ;
rico:hasLanguage _:b0 , _:b1
] .
_:b1 a rico:Language ;
rico:name "Deutsch" ;
rico:type "caption" .
_:b1 a rico:Activity ;
rico:beginningDate "2020-16-07T17:16:04+0000"^^xsd:dateTime ;
rico:endDate "2020-16-07T17:16:04+0000"^^xsd:dateTime ;
_:b2 a rico:Activity ;
rico:affects _:b1 ;
rico:beginningDate "2021-59-18T15:59:17+0000"^^xsd:dateTime ;
rico:endDate "2021-59-18T15:59:17+0000"^^xsd:dateTime ;
rico:performedBy [ a rico:Mechanism ;
rico:name "LanguagesNormalizer" ;
rico:performs _:b1
rico:performs _:b2
] ;
rico:resultsIn _:b0 ;
rico:type "enrichment" .
[ a rico:Record ;
rico:hasLanguage _:b0 ;
rico:hasLanguage [ a rico:Language ;
rico:name "Deutsch" ;
rico:type "caption"
]
] .
_:b0 a rico:Language ;
schema:sameAs "http://www.wikidata.org/entity/Q188" ;
rico:name "tedesco"@it , "allemand"@fr , "Deutsch"@de ;
rico:resultsFrom _:b2 ;
rico:type "caption" .
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