# OpenAPI Documentation - JSON format (dot notation)
post.responses.default.description = Return all objects with enrich fields
post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream
post.summary = Structure one field of each Object as raw affiliation
post.requestBody.required = true
post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream
post.parameters.0.in = query
post.parameters.0.name = indent
post.parameters.0.schema.type = boolean
post.parameters.0.description = Indent or not the JSON Result
# Necessary plugins
[use]
plugin = basics
plugin = analytics
# Flow configuration
[JSONParse]
separator = *
# --------- Découpage du champ avec libpostal (decoupage en champs)
[expand]
path = value
size = 10
cacheName = libpostal
[expand/URLConnect]
url = https://affiliations-libpostal.services.inist.fr/v1/parse
timeout = 5000
# --------- Enrichissement du resultat libpostal
[expand]
path = value
# size = 1 est obligatoire pour traiter séparement chaque élement du tableau
size = 1
[expand/assign]
path = value.value.id
value = get('value.id')
[expand/assign]
path = value
value = get('value.value')
[expand/assign]
path = value.country
value = get('value.country').replace(/\W/g, ' ').trim()
# --------- Création d'un champ Netscity uniqument pour les affiliations françaises
[expand/swing]
path = value.country
test = equal
value = france
[expand/swing/assign]
path = value.netscity
value = get('value.city').upperCase()
# --------- Enrichissement du champ netscity contenant une ville
[expand/expand]
path = value.netscity
size = 10
cacheName = netscity
[expand/expand/URLConnect]
url = https://affiliations-tools.services.inist.fr/v1/netscity/expand
timeout = 5000
# --------- Selection des informations netscity à conserver
[expand/expand/replace]
path = id
value = get('id')
path = value.id
value = get('id')
path = value.latitude
value = get('value.lat2')
path = value.longitude
value = get('value.lng2')
path = value.province
value = get('value.province')
[expand/assign]
path = value.netscity
value = get('value.netscity.value')
# --------- Enrichissement du champ country avec le vocabulaire 9SD de Loterre
[expand/expand]
path = value.country
size = 10
cacheName = loterre
[expand/expand/URLConnect]
url = https://loterre-resolvers.services.inist.fr/v1/9SD/expand
timeout = 5000
# --------- Selection des informations loterre à conserver
[expand/expand/replace]
path = id
value = get('id')
path = value.id
value = get('id')
path = value.uri
value = get('value.rdf$about')
path = value.code
value = get('value.inist$lodexPlacenameCode/$t')
path = value.latitude
value = get('value.geo$lat/$t')
path = value.longitude
value = get('value.geo$long/$t')
path = value.label
value = get('value.skos$prefLabel').reduce((obj, item) => ((obj[[_.defaultTo(item['xml$lang'],'_')]] = item['$t']), obj), {})
[expand/assign]
path = value.country
value = get('value.country.value')
[dump]
indent = env('indent', false)