Newer
Older
web-services / loterre-resolvers / v1 / P66 / identify.ini
@Nicolas Thouvenin Nicolas Thouvenin on 2 Dec 2022 4 KB fix: default value
# OpenAPI Documentation - JSON format (dot notation)
mimeType = application/json

post.operationId = post-v1-P66-identify
post.description = Associer des termes au vocabulaire Loterre correspondant - https://skosmos.loterre.fr/P66/fr/
post.summary = verbalisation à partir d'un tableau d'objets avec à minima un champ value contenant des termes
post.tags.0 = loterre-resolvers
post.requestBody.content.application/json.example.0.value = Amygdala
post.requestBody.content.application/json.example.1.value = Frontal lobe
post.requestBody.content.application/json.example.2.value = metamemory
post.responses.default.content.application/json.example.0.value.id = amygdala
post.responses.default.content.application/json.example.0.value.about = http://data.loterre.fr/ark:/67375/P66-W52CFWZ4-9
post.responses.default.content.application/json.example.0.value.prefLabel@fr = amygdale
post.responses.default.content.application/json.example.0.value.prefLabel@en = amygdala
post.responses.default.content.application/json.example.0.value.localization@en.0 = medial temporal lobe
post.responses.default.content.application/json.example.0.value.localization@fr.0 = lobe temporal médian
post.responses.default.content.application/json.example.1.value.id = frontallobe
post.responses.default.content.application/json.example.1.value.about = http://data.loterre.fr/ark:/67375/P66-KHRWNS4W-Q
post.responses.default.content.application/json.example.1.value.prefLabel@fr = lobe frontal
post.responses.default.content.application/json.example.1.value.prefLabel@en = frontal lobe
post.responses.default.content.application/json.example.1.value.localization@en.0 = brain lobe
post.responses.default.content.application/json.example.1.value.localization@fr.0 = lobe cérébral
post.responses.default.content.application/json.example.2.value.id = metamemory
post.responses.default.content.application/json.example.2.value.about = http://data.loterre.fr/ark:/67375/P66-RGFWPLNW-K
post.responses.default.content.application/json.example.2.value.prefLabel@fr = métamémoire
post.responses.default.content.application/json.example.2.value.prefLabel@en = metamemory
post.responses.default.content.application/json.example.2.value.localization@en.0 = memory
post.responses.default.content.application/json.example.2.value.localization@fr.0 = mémoire
post.responses.default.content.application/json.schema.$ref =  #/components/schemas/JSONStream
post.responses.default.description = Les concept SKOS en JSON
post.parameters.0.description = Indenter le JSON résultant
post.parameters.0.in = query
post.parameters.0.name = indent
post.parameters.0.schema.type = boolean

[env]
path = primer
value = https://inist-wsdata.dboard.inist.fr/loterre-resolvers-memoire.xml

path = weekNumber
value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7))

# Necessary plugins
[use]
plugin = basics
plugin = analytics
plugin = storage

# Flow configuration
[JSONParse]
separator = *

[expand]
path = value
default = n/a
size = 1
cacheName = env('weekNumber').prepend('post-v1-P66-identify-week')

[expand/assign]
path = value
value = fix(_.deburr(String(self.value).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\s]/g, '').toLowerCase()))

[expand/combine]
path = value
primer = env('primer')
file = ./v1/combine.ini
cacheName = env('weekNumber').prepend('post-v1-P66-combine-week')

[expand/remove]
test = get('value.value').isString()

[expand/replace]
path = id
value = get('id')

path = value.id
value = get('value.id')

path = value.about
value = get('value.value.rdf$about')

path = value.prefLabel@fr
value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift()

path = value.prefLabel@en
value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'en')).map(x => x.$t).shift()

path = value.localization@en
value =  get('value.value.localization').map((x) => x.skos$prefLabel.filter(y => (y.xml$lang === 'en')).map(x => x.$t).shift())

path = value.localization@fr
value =  get('value.value.localization').map((x) => x.skos$prefLabel.filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift())

; Pour les documents sans résulat, on donne une valeur par défaut
[swing]
test = get('value.id').isEmpty()
[swing/assign]
path = value
value = fix('n/a')

[dump]
indent = env('indent', false)