In order to mitigate against the brute force attacks against Gitlab accounts, we are moving to all edu-ID Logins. We would like to remind you to link your account with your edu-id. Login will be possible only by edu-ID after November 30, 2021. Here you can find the instructions for linking your account.

If you don't have a SWITCH edu-ID, you can create one with this guide here

kind regards

This Server has been upgraded to GitLab release 14.2.6

Commit c14145b8 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Move proxyType property to digital object.

parent b0c2f4d1
Pipeline #33457 passed with stage
in 1 minute and 16 seconds
......@@ -20,11 +20,12 @@ package ch.memobase.builder
import ch.memobase.helpers.StringHelpers
import ch.memobase.mapping.KEYS
import ch.memobase.rdf.MB
import ch.memobase.rdf.NS
import ch.memobase.rdf.RICO
import org.apache.jena.rdf.model.Resource
class DigitalObject(sourceId: String, recordSetId: String, institutionId: String, count: Int) :
class DigitalObject(sourceId: String, recordSetId: String, institutionId: String, count: Int, hasProxyType: Boolean) :
Instantiation(institutionId) {
private val id = recordSetId + "-" + StringHelpers.normalizeId(sourceId) + "-" + count
override val resource: Resource = model.createResource(NS.mbdo + id)
......@@ -33,5 +34,13 @@ class DigitalObject(sourceId: String, recordSetId: String, institutionId: String
addRdfType(RICO.Instantiation)
resource.addProperty(RICO.type, "digitalObject")
addRicoConcept(KEYS.identifiers, "main", listOf(literal(id)))
// no supplied proxy type present.
if (!hasProxyType) {
addDefaultProxyType()
}
}
private fun addDefaultProxyType() {
resource.addProperty(MB.proxyType, KEYS.defaultProxyType)
}
}
......@@ -32,8 +32,7 @@ class Record(
recordSetId: String,
institutionId: String,
hasSponsoringAgent: Boolean,
isPublished: Boolean,
hasProxyType: Boolean
isPublished: Boolean
) :
RecordResource(institutionId) {
......@@ -50,19 +49,11 @@ class Record(
resource.addProperty(RDA.hasSponsoringAgentOfResource, model.createResource(KEYS.memoriavUri))
}
resource.addProperty(MB.isPublished, model.createTypedLiteral(isPublished))
// no supplied proxy type present.
if (!hasProxyType) {
addDefaultProxyType()
}
}
fun addInstantiation(instantiation: Instantiation) {
resource.addProperty(RICO.hasInstantiation, instantiation.resource)
}
private fun addDefaultProxyType() {
resource.addProperty(MB.proxyType, KEYS.defaultProxyType)
}
private fun recordSetUri(id: String): Resource = model.createResource(uri(NS.mbrs, id))
}
......@@ -102,8 +102,7 @@ class ResourceBuilder(
recordSetId,
institutionId,
config.sponsoredByMemoriav,
isPublished,
config.hasProxyType
isPublished
)
for (recordFieldMapper in config.recordFieldMappers) {
try {
......@@ -145,7 +144,7 @@ class ResourceBuilder(
fun generateDigitalObject(): ResourceBuilder {
digitalObject =
if (config.digitalFieldMappers.isNotEmpty()) {
val digitalObject = DigitalObject(recordId, recordSetId, institutionId, 1)
val digitalObject = DigitalObject(recordId, recordSetId, institutionId, 1, config.hasProxyType)
config.digitalFieldMappers.forEach {
try {
it.apply(source, digitalObject)
......
......@@ -92,12 +92,6 @@ class MappingConfigurationParser(data: ByteArray) {
KEYS.isSponsoredByMemoriav -> {
sponsoredByMemoriav = entry.value as Boolean
}
// checks of the proxy type is defined locally.
KEYS.proxyType -> {
val field = FieldParsers.parseSimpleAnnotationField(key, entry.value)
recordFieldMappers.add(MapperParsers.buildAnnotationMappers(field))
hasProxyType = true
}
// literal properties
KEYS.name, KEYS.title, KEYS.descriptiveNote, KEYS.scopeAndContent, KEYS.sameAs,
KEYS.abstract, KEYS.source, KEYS.hasFindingAid, KEYS.relation,
......@@ -146,6 +140,12 @@ class MappingConfigurationParser(data: ByteArray) {
private fun parseDigitalInstantiationConfig(source: Map<String, Any>) {
for (entry in source) {
when (val key = entry.key) {
// checks of the proxy type is defined locally.
KEYS.proxyType -> {
val field = FieldParsers.parseSimpleAnnotationField(key, entry.value)
digitalObjectFieldMappers.add(MapperParsers.buildAnnotationMappers(field))
hasProxyType = true
}
KEYS.locator, KEYS.descriptiveNote, KEYS.duration, KEYS.conditionsOfUse, KEYS.conditionsOfAccess ->
digitalObjectFieldMappers.add(MapperParsers.buildAnnotationMappers(entry))
KEYS.identifiers ->
......
......@@ -109,8 +109,7 @@ class TestAgentMapper {
"rs1",
"ins1",
hasSponsoringAgent = true,
isPublished = false,
hasProxyType = false
isPublished = false
)
mapper.apply(source, record)
RDFDataMgr.write(FileOutputStream("$resourcePath/agent-mapper-with-name-only.ttl"), record.model, Lang.TURTLE)
......@@ -131,8 +130,7 @@ class TestAgentMapper {
"rs1",
"ins1",
hasSponsoringAgent = true,
isPublished = false,
hasProxyType = false
isPublished = false
)
mapper.apply(source, record)
RDFDataMgr.write(
......@@ -161,8 +159,7 @@ class TestAgentMapper {
"rs1",
"ins1",
hasSponsoringAgent = true,
isPublished = false,
hasProxyType = false
isPublished = false
)
mapper.apply(source, record)
......
......@@ -48,8 +48,7 @@ class TestSkosConceptMapper {
"rs1",
"ins1",
hasSponsoringAgent = true,
isPublished = false,
hasProxyType = false
isPublished = false
)
skosConceptFieldMapper.apply(source, record)
......
<https://memobase.ch/record/test-001-identifier> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Record> .
<https://memobase.ch/record/test-001-identifier> <https://memobase.ch/internal/isPublished> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<https://memobase.ch/record/test-001-identifier> <https://memobase.ch/internal/proxyType> "proxydirect" .
<https://memobase.ch/record/test-001-identifier> <https://www.ica.org/standards/RiC/ontology#heldBy> <https://memobase.ch/institution/test> .
<https://memobase.ch/record/test-001-identifier> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/record/test-001-identifier> <https://www.ica.org/standards/RiC/ontology#isPartOf> <https://memobase.ch/recordSet/test-001> .
......
......@@ -20,8 +20,6 @@ _:b0 a rico:CreationRelation ;
rdau:P60451 <https://memobase.ch/institution/mrv> ;
<https://memobase.ch/internal/isPublished>
false ;
<https://memobase.ch/internal/proxyType>
"proxydirect" ;
rico:heldBy <https://memobase.ch/institution/ins1> ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "rs1-1" ;
......
......@@ -19,8 +19,6 @@ _:b0 a rico:CreationRelation ;
rdau:P60451 <https://memobase.ch/institution/mrv> ;
<https://memobase.ch/internal/isPublished>
false ;
<https://memobase.ch/internal/proxyType>
"proxydirect" ;
rico:heldBy <https://memobase.ch/institution/ins1> ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "rs1-1" ;
......
......@@ -5,13 +5,21 @@
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
_:b0 a rico:CreationRelation ;
rico:creationRelationHasSource <https://memobase.ch/record/rs1-1> ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b0 ;
rico:name "Third Person"
] ;
rico:name "Relation 3" ;
rico:type "creator" .
<https://memobase.ch/record/rs1-1>
a rico:Record ;
rdau:P60451 <https://memobase.ch/institution/mrv> ;
<https://memobase.ch/internal/isPublished>
false ;
<https://memobase.ch/internal/proxyType>
"proxydirect" ;
rico:heldBy <https://memobase.ch/institution/ins1> ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "rs1-1" ;
......@@ -19,7 +27,7 @@
] ;
rico:isPartOf <https://memobase.ch/recordSet/rs1> ;
rico:recordResourceOrInstantiationIsSourceOfCreationRelation
_:b0 , _:b1 , _:b2 ;
_:b1 , _:b2 , _:b0 ;
rico:type "Foto" .
_:b1 a rico:CreationRelation ;
......@@ -27,8 +35,9 @@ _:b1 a rico:CreationRelation ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b1 ;
rico:name "Second Person"
rico:name "First Person"
] ;
rico:name "Relation 1" ;
rico:type "creator" .
_:b2 a rico:CreationRelation ;
......@@ -36,17 +45,6 @@ _:b2 a rico:CreationRelation ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b2 ;
rico:name "Third Person"
] ;
rico:name "Relation 3" ;
rico:type "creator" .
_:b0 a rico:CreationRelation ;
rico:creationRelationHasSource <https://memobase.ch/record/rs1-1> ;
rico:creationRelationHasTarget [ a rico:Person ;
rico:agentIsTargetOfCreationRelation
_:b0 ;
rico:name "First Person"
rico:name "Second Person"
] ;
rico:name "Relation 1" ;
rico:type "creator" .
......@@ -9,8 +9,6 @@
a rico:Record ;
<https://memobase.ch/internal/isPublished>
false ;
<https://memobase.ch/internal/proxyType>
"proxydirect" ;
rico:heldBy <https://memobase.ch/institution/test> ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "test-001-identifier" ;
......
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