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
Elasticsearch Services
Search Doc Service
Commits
f68e7493
Commit
f68e7493
authored
Nov 20, 2020
by
Jonas Waeber
Browse files
Refactor enriched facet transformation for format, genre & language.
parent
30282701
Changes
10
Show whitespace changes
Inline
Side-by-side
src/main/kotlin/DocumentsSearchDocBuilder.kt
View file @
f68e7493
...
@@ -22,9 +22,10 @@ import com.beust.klaxon.JsonObject
...
@@ -22,9 +22,10 @@ import com.beust.klaxon.JsonObject
import
org.apache.logging.log4j.LogManager
import
org.apache.logging.log4j.LogManager
import
org.memobase.builders.*
import
org.memobase.builders.*
import
org.memobase.helpers.*
import
org.memobase.helpers.*
import
org.memobase.model.DocumentsSearchDoc
import
org.memobase.model.EnrichedDigitalMetadata
import
org.memobase.model.EnrichedDigitalMetadata
import
org.memobase.model.LanguageContainer
import
org.memobase.model.Schema
import
org.memobase.model.Schema
import
org.memobase.model.DocumentsSearchDoc
import
org.memobase.rdf.NS
import
org.memobase.rdf.NS
class
DocumentsSearchDocBuilder
(
private
val
mediaUrl
:
String
)
{
class
DocumentsSearchDocBuilder
(
private
val
mediaUrl
:
String
)
{
...
@@ -37,7 +38,8 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -37,7 +38,8 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
val
physicalObject
=
val
physicalObject
=
input
.
values
.
firstOrNull
{
it
[
"@type"
]
==
NS
.
rico
+
"Instantiation"
&&
it
[
"type"
]
==
"physicalObject"
}
input
.
values
.
firstOrNull
{
it
[
"@type"
]
==
NS
.
rico
+
"Instantiation"
&&
it
[
"type"
]
==
"physicalObject"
}
val
hasSubjectIds
=
Extract
.
identifiers
(
record
[
KEYS
.
hasSubject
])
val
keywordIds
=
Extract
.
identifiers
(
record
[
KEYS
.
hasSubject
])
val
genreIds
=
Extract
.
identifiers
(
record
[
KEYS
.
hasGenre
])
val
publishedByIds
=
Extract
.
identifiers
(
record
[
KEYS
.
publishedBy
])
val
publishedByIds
=
Extract
.
identifiers
(
record
[
KEYS
.
publishedBy
])
val
producerIds
=
Extract
.
identifiers
(
record
[
KEYS
.
producer
])
val
producerIds
=
Extract
.
identifiers
(
record
[
KEYS
.
producer
])
val
spatialIds
=
Extract
.
identifiers
(
record
[
KEYS
.
spatial
])
val
spatialIds
=
Extract
.
identifiers
(
record
[
KEYS
.
spatial
])
...
@@ -47,26 +49,28 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -47,26 +49,28 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
val
temporalIds
=
Extract
.
identifiers
(
record
[
KEYS
.
temporal
])
val
temporalIds
=
Extract
.
identifiers
(
record
[
KEYS
.
temporal
])
val
personFacetBuilder
=
PersonFacetBuilder
()
val
personFacetBuilder
=
PersonFacetBuilder
()
val
subjectPersonBuilder
=
AgentContainerBuilder
(
hasSubject
Ids
,
KEYS
.
Person
,
null
,
input
)
val
subjectPersonBuilder
=
AgentContainerBuilder
(
keyword
Ids
,
KEYS
.
Person
,
null
,
input
)
val
publisherPersonBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
Person
,
null
,
input
)
val
publisherPersonBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
Person
,
null
,
input
)
val
producersPersonBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
Person
,
null
,
input
)
val
producersPersonBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
Person
,
null
,
input
)
val
contributorPersonBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Person
,
KEYS
.
contributor
,
input
)
val
contributorPersonBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Person
,
KEYS
.
contributor
,
input
)
val
creatorPersonBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Person
,
KEYS
.
creator
,
input
)
val
creatorPersonBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Person
,
KEYS
.
creator
,
input
)
val
subjectCorporateBodyBuilder
=
AgentContainerBuilder
(
hasSubject
Ids
,
KEYS
.
CorporateBody
,
null
,
input
)
val
subjectCorporateBodyBuilder
=
AgentContainerBuilder
(
keyword
Ids
,
KEYS
.
CorporateBody
,
null
,
input
)
val
publisherCorporateBodyBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
CorporateBody
,
null
,
input
)
val
publisherCorporateBodyBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
CorporateBody
,
null
,
input
)
val
producersCorporateBodyBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
CorporateBody
,
null
,
input
)
val
producersCorporateBodyBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
CorporateBody
,
null
,
input
)
val
contributorCorporateBodyBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
CorporateBody
,
KEYS
.
contributor
,
input
)
val
contributorCorporateBodyBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
CorporateBody
,
KEYS
.
contributor
,
input
)
val
creatorCorporateBodyBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
CorporateBody
,
KEYS
.
creator
,
input
)
val
creatorCorporateBodyBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
CorporateBody
,
KEYS
.
creator
,
input
)
val
subjectAgentBuilder
=
AgentContainerBuilder
(
hasSubject
Ids
,
KEYS
.
Agent
,
null
,
input
)
val
subjectAgentBuilder
=
AgentContainerBuilder
(
keyword
Ids
,
KEYS
.
Agent
,
null
,
input
)
val
publisherAgentBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
Agent
,
null
,
input
)
val
publisherAgentBuilder
=
AgentContainerBuilder
(
publishedByIds
,
KEYS
.
Agent
,
null
,
input
)
val
producersAgentBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
Agent
,
null
,
input
)
val
producersAgentBuilder
=
AgentContainerBuilder
(
producerIds
,
KEYS
.
Agent
,
null
,
input
)
val
contributorAgentBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Agent
,
KEYS
.
contributor
,
input
)
val
contributorAgentBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Agent
,
KEYS
.
contributor
,
input
)
val
creatorAgentBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Agent
,
KEYS
.
creator
,
input
)
val
creatorAgentBuilder
=
AgentContainerBuilder
(
emptyList
(),
KEYS
.
Agent
,
KEYS
.
creator
,
input
)
val
placesRelatedBuilder
=
FacettedContainerBuilder
(
spatialIds
,
KEYS
.
Place
,
KEYS
.
name
,
FacetBuildHelpers
::
place
)
val
placesRelatedBuilder
=
FacettedContainerBuilder
(
spatialIds
,
KEYS
.
Place
,
KEYS
.
name
,
FacetBuildHelpers
::
place
)
val
placeCapturedBuilder
=
FacettedContainerBuilder
(
placeOfCaptureIds
,
KEYS
.
Place
,
KEYS
.
name
,
FacetBuildHelpers
::
place
)
val
placeCapturedBuilder
=
FacettedContainerBuilder
(
placeOfCaptureIds
,
KEYS
.
Place
,
KEYS
.
name
,
FacetBuildHelpers
::
place
)
val
placeFacetBuilder
=
PlaceFacetBuilder
()
val
placeFacetBuilder
=
PlaceFacetBuilder
()
...
@@ -74,11 +78,15 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -74,11 +78,15 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
val
dateIssuedBuilder
=
DateContainerBuilder
(
dateIssuedIds
)
val
dateIssuedBuilder
=
DateContainerBuilder
(
dateIssuedIds
)
val
temporalBuilder
=
DateContainerBuilder
(
temporalIds
)
val
temporalBuilder
=
DateContainerBuilder
(
temporalIds
)
val
suggestContainerBuilder
=
SuggestContainerBuilder
(
hasSubject
Ids
)
val
suggestContainerBuilder
=
SuggestContainerBuilder
(
keyword
Ids
)
val
digitalIdentifierReferences
=
Extract
.
identifiers
(
digitalObject
?.
get
(
"identifiedBy"
))
val
digitalIdentifierReferences
=
Extract
.
identifiers
(
digitalObject
?.
get
(
"identifiedBy"
))
val
digitalIdentifierEntities
=
mutableListOf
<
JsonObject
>()
val
digitalIdentifierEntities
=
mutableListOf
<
JsonObject
>()
val
formats
=
EnrichedFacetContainerBuilder
(
emptyList
(),
NS
.
rico
+
KEYS
.
CarrierType
,
KEYS
.
name
)
val
languages
=
EnrichedFacetContainerBuilder
(
emptyList
(),
NS
.
rico
+
KEYS
.
Language
,
KEYS
.
name
)
val
genres
=
EnrichedFacetContainerBuilder
(
genreIds
,
NS
.
skos
+
KEYS
.
Concept
,
KEYS
.
prefLabel
)
val
id
=
record
[
"@id"
]
as
String
val
id
=
record
[
"@id"
]
as
String
for
(
item
in
input
.
entries
)
{
for
(
item
in
input
.
entries
)
{
...
@@ -106,7 +114,10 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -106,7 +114,10 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
dateCreatedBuilder
,
dateCreatedBuilder
,
dateIssuedBuilder
,
dateIssuedBuilder
,
temporalBuilder
,
temporalBuilder
,
suggestContainerBuilder
suggestContainerBuilder
,
formats
,
genres
,
languages
))
{
))
{
if
(
builder
.
filter
(
item
.
value
))
{
if
(
builder
.
filter
(
item
.
value
))
{
builder
.
append
(
id
,
item
.
value
)
builder
.
append
(
id
,
item
.
value
)
...
@@ -119,10 +130,8 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -119,10 +130,8 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
val
recordIdentifiers
=
Filter
.
entitiesByProperty
(
"identifiedBy"
,
record
,
input
)
val
recordIdentifiers
=
Filter
.
entitiesByProperty
(
"identifiedBy"
,
record
,
input
)
val
recordTitles
=
Filter
.
entitiesByProperty
(
"hasTitle"
,
record
,
input
)
val
recordTitles
=
Filter
.
entitiesByProperty
(
"hasTitle"
,
record
,
input
)
val
recordLanguages
=
Filter
.
entitiesByProperty
(
"hasLanguage"
,
record
,
input
)
val
recordRules
=
Filter
.
entitiesByProperty
(
"regulatedBy"
,
record
,
input
)
val
recordRules
=
Filter
.
entitiesByProperty
(
"regulatedBy"
,
record
,
input
)
val
genre
=
Filter
.
entitiesByProperty
(
"hasGenre"
,
record
,
input
)
val
subjects
=
Filter
.
entitiesByProperty
(
"hasSubject"
,
record
,
input
)
val
subjects
=
Filter
.
entitiesByProperty
(
"hasSubject"
,
record
,
input
)
val
digitalRules
=
Filter
.
entitiesByProperty
(
"regulatedBy"
,
digitalObject
,
input
)
val
digitalRules
=
Filter
.
entitiesByProperty
(
"regulatedBy"
,
digitalObject
,
input
)
...
@@ -134,10 +143,6 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -134,10 +143,6 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
val
accessDigital
=
Extract
.
typedEntityByType
(
digitalRules
,
"type"
,
"access"
,
"name"
).
flatMap
{
it
.
toList
()
}
val
accessDigital
=
Extract
.
typedEntityByType
(
digitalRules
,
"type"
,
"access"
,
"name"
).
flatMap
{
it
.
toList
()
}
val
usageDigital
=
Extract
.
typedEntityByType
(
digitalRules
,
"type"
,
"usage"
,
"sameAs"
).
flatMap
{
it
.
toList
()
}
val
usageDigital
=
Extract
.
typedEntityByType
(
digitalRules
,
"type"
,
"usage"
,
"sameAs"
).
flatMap
{
it
.
toList
()
}
val
format
=
CarrierType
.
extract
(
Filter
.
entitiesByProperty
(
"hasCarrierType"
,
physicalObject
,
input
))
if
(
format
.
isEmpty
())
{
log
.
error
(
"Found no carrier types for record $id."
)
}
val
locator
=
try
{
val
locator
=
try
{
val
value
=
Extract
.
extractIdValue
(
digitalIdentifierEntities
,
KEYS
.
IdentifierType
.
main
)
val
value
=
Extract
.
extractIdValue
(
digitalIdentifierEntities
,
KEYS
.
IdentifierType
.
main
)
...
@@ -200,15 +205,16 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
...
@@ -200,15 +205,16 @@ class DocumentsSearchDocBuilder(private val mediaUrl: String) {
rightsHolder
=
Extract
.
typedEntityByType
(
recordRules
,
"type"
,
"holder"
,
"name"
),
rightsHolder
=
Extract
.
typedEntityByType
(
recordRules
,
"type"
,
"holder"
,
"name"
),
memoriavClaim
=
record
[
"P60451"
]
!=
null
,
memoriavClaim
=
record
[
"P60451"
]
!=
null
,
languageCaption
=
Extract
.
typedEntityByType
(
recordLanguages
,
"type"
,
"caption"
,
"name"
),
format
=
formats
.
build
(),
languageContent
=
Extract
.
typedEntityByType
(
recordLanguages
,
"type"
,
"content"
,
"name"
),
language
=
languages
.
build
(),
genre
=
genres
.
build
(),
format
=
format
,
language
=
Extract
.
facetEntity
(
recordLanguages
,
"name"
),
genre
=
Extract
.
facetEntity
(
genre
,
"prefLabel"
),
keywords
=
Extract
.
facetEntity
(
subjects
,
"prefLabel"
),
keywords
=
subjects
.
flatMap
{
Extract
.
languageContainer
(
"hasSubject"
,
it
[
KEYS
.
prefLabel
])
}.
let
{
if
(
it
.
isEmpty
())
LanguageContainer
.
EMPTY
else
it
.
reduce
{
acc
,
languageContainer
->
acc
.
merge
(
languageContainer
)
}},
personSubject
=
subjectPersonBuilder
.
build
(),
personSubject
=
subjectPersonBuilder
.
build
(),
personProducer
=
producersPersonBuilder
.
build
(),
personProducer
=
producersPersonBuilder
.
build
(),
personPublisher
=
publisherPersonBuilder
.
build
(),
personPublisher
=
publisherPersonBuilder
.
build
(),
...
...
src/main/kotlin/
helpers/CarrierType
.kt
→
src/main/kotlin/
builders/EnrichedFacetContainerBuilder
.kt
View file @
f68e7493
...
@@ -16,28 +16,45 @@
...
@@ -16,28 +16,45 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
*/
package
org.memobase.
help
ers
package
org.memobase.
build
ers
import
com.beust.klaxon.JsonObject
import
com.beust.klaxon.JsonObject
import
org.memobase.model.FacetContainer
import
com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import
org.memobase.helpers.Extract
object
CarrierType
{
import
org.memobase.helpers.KEYS
fun
extract
(
items
:
List
<
JsonObject
>):
List
<
FacetContainer
>
{
import
org.memobase.model.EnrichedFacetContainer
return
items
.
map
{
import
org.memobase.model.LanguageContainer
Extract
.
listOfStrings
(
it
[
"sameAs"
]).
let
{
value
->
import
org.memobase.rdf.NS
val
name
=
Extract
.
languageContainer
(
"carrierType"
,
it
[
"name"
]).
reduce
{
acc
,
languageContainer
->
acc
.
merge
(
languageContainer
)
}
if
(
value
.
isEmpty
())
{
FacetContainer
(
name
,
null
,
emptyList
())
}
else
{
FacetContainer
(
name
,
null
,
value
)
}
}
}
}
}
/**
*
*/
class
EnrichedFacetContainerBuilder
(
private
val
identifiers
:
List
<
String
>,
private
val
targetType
:
String
,
private
val
nameProperty
:
String
)
:
IFieldBuilder
{
private
val
containers
=
mutableListOf
<
EnrichedFacetContainer
>()
object
EnrichedFacetContainers
{
override
fun
filter
(
jsonObject
:
JsonObject
):
Boolean
{
if
(
jsonObject
[
KEYS
.
atType
]
!=
targetType
)
return
false
// Filter any values of this type which were not enriched. These will be found via the resultsFrom link.
if
(!
jsonObject
.
containsKey
(
KEYS
.
resultsFrom
))
return
false
if
(
identifiers
.
isNotEmpty
())
return
identifiers
.
contains
(
jsonObject
[
KEYS
.
entityId
])
return
true
}
override
fun
append
(
key
:
String
,
jsonObject
:
JsonObject
):
String
{
val
names
=
Extract
.
languageContainer
(
targetType
,
jsonObject
[
nameProperty
])
.
reduce
{
acc
,
languageContainer
->
acc
.
merge
(
languageContainer
)
}.
fillInEmpty
()
val
ricoType
=
jsonObject
[
KEYS
.
ricoType
]
as
String
?
containers
.
add
(
EnrichedFacetContainer
(
LanguageContainer
.
EMPTY
,
names
,
ricoType
)
)
return
""
}
override
fun
build
():
List
<
EnrichedFacetContainer
>
{
return
containers
}
}
}
src/main/kotlin/helpers/KEYS.kt
View file @
f68e7493
...
@@ -24,62 +24,74 @@ object KEYS {
...
@@ -24,62 +24,74 @@ object KEYS {
const
val
institutionTypeLabelsPath
=
"institutionTypeLabelsPath"
const
val
institutionTypeLabelsPath
=
"institutionTypeLabelsPath"
}
}
const
val
teaserColor
=
"teaserColor"
const
val
teaserColorComputed
=
"teaserColorComputed"
const
val
entityId
=
"@id"
const
val
entityId
=
"@id"
const
val
atType
=
"@type"
const
val
atType
=
"@type"
// internal values
const
val
isPublished
=
"isPublished"
const
val
isPublished
=
"isPublished"
const
val
teaserColor
=
"teaserColor"
const
val
teaserColorComputed
=
"teaserColorComputed"
// Namespace rico:
const
val
ricoType
=
"type"
const
val
ricoType
=
"type"
const
val
firstName
=
"firstName"
const
val
firstName
=
"firstName"
const
val
lastName
=
"lastName"
const
val
lastName
=
"lastName"
const
val
name
=
"name"
const
val
name
=
"name"
const
val
title
=
"title"
const
val
title
=
"title"
const
val
prefLabel
=
"prefLabel"
const
val
descriptiveNote
=
"descriptiveNote"
const
val
descriptiveNote
=
"descriptiveNote"
const
val
isHolderOf
=
"isHolderOf"
const
val
isHolderOf
=
"isHolderOf"
const
val
resultsFrom
=
"resultsFrom"
const
val
agentIsTargetOfCreationRelation
=
"agentIsTargetOfCreationRelation"
const
val
agentIsTargetOfCreationRelation
=
"agentIsTargetOfCreationRelation"
const
val
hasSubject
=
"hasSubject"
const
val
hasLocation
=
"hasLocation"
const
val
placeOfCapture
=
"P60556"
const
val
spatial
=
"spatial"
const
val
spatial
=
"spatial"
const
val
producer
=
"P60441"
const
val
publishedBy
=
"publishedBy"
const
val
publishedBy
=
"publishedBy"
const
val
isPartOf
=
"isPartOf"
const
val
isPartOf
=
"isPartOf"
const
val
heldBy
=
"heldBy"
const
val
heldBy
=
"heldBy"
const
val
contributor
=
"contributor"
const
val
creator
=
"creator"
const
val
identifiedBy
=
"identifiedBy"
const
val
identifiedBy
=
"identifiedBy"
const
val
hasSubject
=
"hasSubject"
const
val
hasLocation
=
"hasLocation"
// rico classes
const
val
Person
=
"Person"
const
val
Person
=
"Person"
const
val
CorporateBody
=
"CorporateBody"
const
val
CorporateBody
=
"CorporateBody"
const
val
Agent
=
"Agent"
const
val
Agent
=
"Agent"
const
val
CarrierType
=
"CarrierType"
const
val
Language
=
"Language"
const
val
Place
=
"Place"
const
val
Place
=
"Place"
const
val
Title
=
"Title"
const
val
Title
=
"Title"
// Dates
const
val
DateSet
=
"DateSet"
const
val
DateSet
=
"DateSet"
const
val
DateRange
=
"DateRange"
const
val
DateRange
=
"DateRange"
const
val
SingleDate
=
"SingleDate"
const
val
SingleDate
=
"SingleDate"
const
val
issued
=
"issued"
const
val
created
=
"created"
const
val
temporal
=
"temporal"
const
val
Instantiation
=
"Instantiation"
const
val
Instantiation
=
"Instantiation"
const
val
Record
=
"Record"
const
val
Record
=
"Record"
// namespace rda:
const
val
placeOfCapture
=
"P60556"
const
val
producer
=
"P60441"
// namespace skos:
const
val
prefLabel
=
"prefLabel"
const
val
Concept
=
"Concept"
const
val
Concept
=
"Concept"
// rico:type for rico:Agent
const
val
contributor
=
"contributor"
const
val
creator
=
"creator"
// namespace dct:
const
val
issued
=
"issued"
const
val
created
=
"created"
const
val
temporal
=
"temporal"
// namespace wdt:
const
val
wikidataInstance
=
"P31"
const
val
wikidataInstance
=
"P31"
const
val
wikidataAddresses
=
"P6375"
const
val
wikidataAddresses
=
"P6375"
const
val
wikidataPostalCodes
=
"P281"
const
val
wikidataPostalCodes
=
"P281"
const
val
wikidataImage
=
"P18"
const
val
wikidataImage
=
"P18"
// namespace ebucore:
const
val
hasGenre
=
"hasGenre"
const
val
missingLabelDe
=
"FEHLENDES LABEL"
const
val
missingLabelDe
=
"FEHLENDES LABEL"
const
val
missingLabelFr
=
"L'ÉTIQUETTE MANQUANTE"
const
val
missingLabelFr
=
"L'ÉTIQUETTE MANQUANTE"
const
val
missingLabelIt
=
"GALATEO MANCANTE"
const
val
missingLabelIt
=
"GALATEO MANCANTE"
...
...
src/main/kotlin/model/DocumentsSearchDoc.kt
View file @
f68e7493
...
@@ -42,11 +42,10 @@ data class DocumentsSearchDoc(
...
@@ -42,11 +42,10 @@ data class DocumentsSearchDoc(
val
sameAs
:
List
<
String
>,
val
sameAs
:
List
<
String
>,
// Concepts
// Concepts
val
genre
:
List
<
FacetContainer
>,
val
format
:
List
<
EnrichedFacetContainer
>,
val
keywords
:
List
<
FacetContainer
>,
val
genre
:
List
<
EnrichedFacetContainer
>,
val
languageContent
:
List
<
LanguageContainer
>,
val
language
:
List
<
EnrichedFacetContainer
>,
val
languageCaption
:
List
<
LanguageContainer
>,
val
keywords
:
LanguageContainer
,
val
language
:
List
<
FacetContainer
>,
// Agents
// Agents
val
personSubject
:
List
<
AgentWithRelationContainer
>,
val
personSubject
:
List
<
AgentWithRelationContainer
>,
...
@@ -105,7 +104,6 @@ data class DocumentsSearchDoc(
...
@@ -105,7 +104,6 @@ data class DocumentsSearchDoc(
val
colourPhysical
:
List
<
LanguageContainer
>,
val
colourPhysical
:
List
<
LanguageContainer
>,
val
usageConditionsPhysical
:
List
<
LanguageContainer
>,
val
usageConditionsPhysical
:
List
<
LanguageContainer
>,
val
physicalObjectNote
:
List
<
LanguageContainer
>,
val
physicalObjectNote
:
List
<
LanguageContainer
>,
val
format
:
List
<
FacetContainer
>,
// Combined
// Combined
val
access
:
List
<
String
>,
val
access
:
List
<
String
>,
...
@@ -135,8 +133,7 @@ data class DocumentsSearchDoc(
...
@@ -135,8 +133,7 @@ data class DocumentsSearchDoc(
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
LanguageContainer
.
EMPTY
,
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
...
@@ -180,7 +177,6 @@ data class DocumentsSearchDoc(
...
@@ -180,7 +177,6 @@ data class DocumentsSearchDoc(
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
(),
false
,
false
,
SuggestContainer
(
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
())
SuggestContainer
(
emptyList
(),
emptyList
(),
emptyList
(),
emptyList
())
)
)
...
...
src/main/kotlin/model/LanguageContainer.kt
View file @
f68e7493
...
@@ -69,4 +69,13 @@ data class LanguageContainer(
...
@@ -69,4 +69,13 @@ data class LanguageContainer(
else
->
""
else
->
""
}
}
}
}
fun
fillInEmpty
():
LanguageContainer
{
return
LanguageContainer
(
if
(
de
.
isEmpty
())
listOf
(
KEYS
.
missingLabelDe
)
else
de
,
if
(
fr
.
isEmpty
())
listOf
(
KEYS
.
missingLabelFr
)
else
fr
,
if
(
it
.
isEmpty
())
listOf
(
KEYS
.
missingLabelIt
)
else
it
,
un
)
}
}
}
src/test/resources/data/1/input.json
View file @
f68e7493
{
{
"@graph"
:
[
"@graph"
:
[
{
{
"@id"
:
"https://memobase.ch/digital/
Burgerbib-Krebser-216133
-1"
,
"@id"
:
"https://memobase.ch/digital/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Instantiation"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Instantiation"
,
"identifiedBy"
:
"https://memobase.ch/digital/Burgerbib-Krebser-216133-1#genida6aec47a-0957-4a89-933a-3d22034408b7"
,
"isDistributedOn"
:
"vimeo"
,
"instantiates"
:
"https://memobase.ch/record/Burgerbib-Krebser-216133"
,
"locator"
:
"https://vimeo.com/298157684"
,
"isDerivedFromInstantiation"
:
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1"
,
"contains"
:
"https://memobase.ch/digital/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1/derived"
,
"identifiedBy"
:
"https://memobase.ch/digital/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid3daf5a86-80cb-4c92-842e-c4c2e7881318"
,
"instantiates"
:
"https://memobase.ch/record/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647"
,
"isDerivedFromInstantiation"
:
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1"
,
"regulatedBy"
:
"https://memobase.ch/digital/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid73ffdf8b-34b6-4129-a57c-f42c6785bcda"
,
"type"
:
"digitalObject"
"type"
:
"digitalObject"
},
},
{
{
"@id"
:
"https://memobase.ch/digital/
Burgerbib-Krebser-216133-1#genida6aec47a-0957-4a89-933a-3d22034408b7
"
,
"@id"
:
"https://memobase.ch/digital/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid3daf5a86-80cb-4c92-842e-c4c2e7881318
"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Identifier"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Identifier"
,
"identifier"
:
"
Burgerbib-Krebser-216133
-1"
,
"identifier"
:
"
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1"
,
"type"
:
"main"
"type"
:
"main"
},
},
{
{
"@id"
:
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1"
,
"@id"
:
"https://memobase.ch/digital/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid73ffdf8b-34b6-4129-a57c-f42c6785bcda"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Rule"
,
"name"
:
"public"
,
"regulates"
:
"https://memobase.ch/digital/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1"
,
"type"
:
"access"
},
{
"@id"
:
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Instantiation"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Instantiation"
,
"P60558"
:
"S/W"
,
"duration"
:
"00:00:43"
,
"hasCarrierType"
:
[
"hasCarrierType"
:
[
"https://memobase.ch/physical/
Burgerbib-Krebser-216133-1#genid4599794e-c0e2-4e60-b679-377d36294d83
"
,
"https://memobase.ch/physical/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid0da52d17-3363-4531-bfbf-508d93407046
"
,
"https://memobase.ch/physical/
Burgerbib-Krebser-216133
-1#genid
b
67
f6e52-30f6-4e88-af25-f73185b
db6
83
"
"https://memobase.ch/physical/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1#genid67
7e13cc-8662-40b1-83c0-f6ec3b198
db6"
],
],
"hasDerivedInstantiation"
:
"https://memobase.ch/digital/
Burgerbib-Krebser-216133
-1"
,
"hasDerivedInstantiation"
:
"https://memobase.ch/digital/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1"
,
"identifiedBy"
:
[
"identifiedBy"
:
[
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1#genid333fa224-b73a-4866-8447-c1dbebb2c20e"
,
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genide9efa3ee-6bb3-4f0e-9dbd-4d1ca6b4b60e"
,
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1#genid7b74b0fd-ef75-4dc4-a065-eda403b91d1e"
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid443f9a35-4222-4b67-a47d-9a48b4d08cfd"
],
"instantiates"
:
"https://memobase.ch/record/Burgerbib-Krebser-216133"
,
"physicalCharacteristics"
:
[
"Weite: 85 mm"
,
"Höhe: 100 mm"
],
],
"instantiates"
:
"https://memobase.ch/record/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647"
,
"physicalCharacteristics"
:
"Bemerkung: Länge Originalfilm 5m und Länge als Digitalisat 00:00:43 - Digitalisat in SD (standard definition)"
,
"regulatedBy"
:
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid0c204580-4b54-4e0f-99be-5ac19b2a68e5"
,
"type"
:
"physicalObject"
"type"
:
"physicalObject"
},
},
{
{
"@id"
:
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1#genid333fa224-b73a-4866-8447-c1dbebb2c20e"
,
"@id"
:
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid0c204580-4b54-4e0f-99be-5ac19b2a68e5"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Identifier"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Rule"
,
"identifier"
:
"Historische Sammlung Krebser 13/2"
,
"name"
:
"onsite"
,
"type"
:
"callNumber"
"regulates"
:
"https://memobase.ch/physical/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1"
,
"type"
:
"access"
},
},
{
{
"@id"
:
"https://memobase.ch/physical/
Burgerbib-Krebser-216133-1#genid4599794e-c0e2-4e60-b679-377d36294d83
"
,
"@id"
:
"https://memobase.ch/physical/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid0da52d17-3363-4531-bfbf-508d93407046
"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"sameAs"
:
"http://www.wikidata.org/entity/Q1138868"
,
"name"
:
"16 mm S/W-Film (Triacetat)"
"name"
:
{
"@language"
:
"de"
,
"@value"
:
"Glasplatte"
},
"resultsFrom"
:
"https://memobase.ch/physical/Burgerbib-Krebser-216133-1#genid3f2e2ad9-69c5-4f38-a8ae-1753cd3a6a72"
},
},
{
{
"@id"
:
"https://memobase.ch/physical/
Burgerbib-Krebser-216133-1#genid7b74b0fd-ef75-4dc4-a065-eda403b91d1e
"
,
"@id"
:
"https://memobase.ch/physical/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1#genid443f9a35-4222-4b67-a47d-9a48b4d08cfd
"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Identifier"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#Identifier"
,
"identifier"
:
"
Burgerbib-Krebser-216133
-1"
,
"identifier"
:
"
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1"
,
"type"
:
"main"
"type"
:
"main"
},
},
{
{
"@id"
:
"https://memobase.ch/physical/
Burgerbib-Krebser-216133
-1#genid
b
67
f6e52-30f6-4e88-af25-f73185b
db6
83
"
,
"@id"
:
"https://memobase.ch/physical/
LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647
-1#genid67
7e13cc-8662-40b1-83c0-f6ec3b198
db6"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"@type"
:
"https://www.ica.org/standards/RiC/ontology#CarrierType"
,
"name"
:
"Glasplatte"
"sameAs"
:
"http://www.wikidata.org/entity/Q194383"
,
"name"
:
[
{
"@language"
:
"it"
,
"@value"
:
"16 millimetri"
},