Commit 106d79db authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fixes expanded rule mapper

parent a71ae647
......@@ -27,7 +27,7 @@ interface IResource {
fun addPlace(type: String, properties: List<Pair<String, Literal>>)
fun addDate(property: String, value: String)
fun addCreationRelation(type: String, agentType: String, properties: List<Pair<String, Literal>>)
fun addRule(type: String, value: List<Pair<String, Literal>>)
fun addRule(type: String, value: List<Pair<String, List<Literal>>>)
fun addAgent(relation: String, agentType: String, properties: List<Pair<String, Literal>>)
fun langLiteral(text: String, language: String): Literal
fun literal(text: String): Literal
......
......@@ -133,13 +133,15 @@ abstract class RecordResource(institutionId: String) : IResource {
resource.addProperty(KEYS.agentPropertiesMap[relation], blank)
}
override fun addRule(type: String, value: List<Pair<String, Literal>>) {
override fun addRule(type: String, value: List<Pair<String, List<Literal>>>) {
if (value.isNotEmpty()) {
val blank = model.createResource()
blank.addProperty(RDF.type, RICO.Rule)
blank.addProperty(RICO.type, literal(type))
value.forEach {
blank.addProperty(KEYS.keysToPropertyMap[it.first], it.second)
it.second.forEach { literal ->
blank.addProperty(KEYS.keysToPropertyMap[it.first], literal)
}
}
blank.addProperty(RICO.regulates, resource)
resource.addProperty(RICO.regulatedBy, blank)
......
......@@ -60,7 +60,7 @@ class ExpandedRuleFieldMapper(private val type: String, private val configField:
}
if (properties.isNotEmpty()) {
subject.addRule(type, properties)
}
......
......@@ -33,15 +33,15 @@ class RuleFieldMapper(private val configField: ConfigField) : IFieldMapper {
is MappedAnnotationField ->
source[configField.field].let {
if (it != null) {
subject.addRule(configField.key, listOf(Pair(KEYS.name, configField.toLiteral(it))))
subject.addRule(configField.key, listOf(Pair(KEYS.name, listOf(configField.toLiteral(it)))))
}
}
is ConstantField ->
subject.addRule(configField.key, listOf(Pair(KEYS.name, configField.toLiteral())))
subject.addRule(configField.key, listOf(Pair(KEYS.name, listOf(configField.toLiteral()))))
is LanguageField ->
subject.addRule(configField.key, configField.toLangLiterals(source).map { value -> Pair(KEYS.name, value) })
subject.addRule(configField.key, listOf(Pair(KEYS.name, configField.toLangLiterals(source))))
is ListField ->
subject.addRule(configField.key, configField.toLiterals(source).map { value -> Pair(KEYS.name, value) })
subject.addRule(configField.key, listOf(Pair(KEYS.name, configField.toLiterals(source))))
}
}
}
\ No newline at end of file
......@@ -6,15 +6,21 @@
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#instantiates> <https://memobase.ch/record/TEST-Sig_Han_1293> .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#type> "digitalObject" .
_:B <http://schema.org/sameAs> "http://rightsstatements.org/vocab/InC/1.0/" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Familie XYZ" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "In Copyright (InC)" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "public" .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-0> .
_:B <https://www.ica.org/standards/RiC/ontology#type> "access" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "holder" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
\ No newline at end of file
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "usage" .
\ No newline at end of file
......@@ -9,14 +9,20 @@
<https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#physicalCharacteristics> "bildformat"@de .
<https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#physicalCharacteristics> "codec"@de .
<https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> <https://www.ica.org/standards/RiC/ontology#type> "physicalObject" .
_:B <http://schema.org/sameAs> "http://rightsstatements.org/vocab/InC/1.0/" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "Sig Han 1293" .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "In Copyright (InC)" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "public" .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> .
_:B <https://www.ica.org/standards/RiC/ontology#type> "access" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "callNumber" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
\ No newline at end of file
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "usage" .
\ No newline at end of file
......@@ -5,15 +5,21 @@
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> <https://www.ica.org/standards/RiC/ontology#isDerivedFromInstantiation> <https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> <https://www.ica.org/standards/RiC/ontology#regulatedBy> _:B .
<https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> <https://www.ica.org/standards/RiC/ontology#type> "digitalObject" .
_:B <http://schema.org/sameAs> "http://rightsstatements.org/vocab/InC/1.0/" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Rule> .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Familie XYZ" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "In Copyright (InC)" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "public" .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> .
_:B <https://www.ica.org/standards/RiC/ontology#regulates> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> .
_:B <https://www.ica.org/standards/RiC/ontology#type> "access" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "holder" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
\ No newline at end of file
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "usage" .
\ No newline at end of file
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