Newer
Older
web-services / loterre-resolvers / v1 / combine.ini
@Nicolas Thouvenin Nicolas Thouvenin on 13 Feb 2023 1 KB use expand cache
# Context input/output
append = dump?indent=true

# OpenAPI Documentation - JSON format (dot notation)
post.responses.default.description = Return all objects from XML/SKOS file
post.responses.default.content.application/json.schema.type = array
post.responses.default.content.application/json.schema.items.type = object
post.responses.default.content.application/json.schema.items.properties.id.type = string
post.responses.default.content.application/json.schema.items.properties.value.$ref = #/components/schemas/anyValue
post.summary = Transform XML/SKOS file to array of JSON Objects
post.requestBody.required = true
post.requestBody.content.text/xml.schema.type = string
post.requestBody.content.text/xml.schema.format = binary

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

# Flow configuration
[debug]

[replace]
path = primer
value = self()
[debug]

[expand]
path = primer
cacheName = fix(`post-v1-primer-week-${env('loterreID')}-${env('weekNumber')}`)

[expand/URLFetch]
timeout = 300000
url = get('value')
path = null
target = value

[exchange]
value = get('primer')

[XMLParse]
separator = /rdf:RDF/skos:Concept

[assign]
path = localization
value = get('skos$broader.rdf$resource').concat('').filter(Boolean)

[SKOSPathEnum]
path = localization
label = skos$prefLabel
recursion = true

[OBJFlatten]
safe = true

[replace]
path = concept
value = self()

# select all keys and remove duplicates to avoid ambiguities
path = keys
value = fix(_.get(self, 'skos$prefLabel'), _.get(self, 'skos$altLabel'), _.get(self, 'skos$hiddenLabel')). \
        flatten().\
		filter(o => _.has(o, '$t')).\
		map(o => _.deburr(String(o.$t).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\s]/g, '').toLowerCase())).\
		uniq()


[exploding]
id = concept
value = keys

; invert id & value because of [exploding] which works only by value (not by id)
[replace]
path = id
value = get('value')

path = value
value = get('id')