Newer
Older
web-services / loterre-resolvers / v1 / combine.ini
@Nicolas Thouvenin Nicolas Thouvenin on 12 Jan 2022 1 KB fix: copy-paste mistake
# 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
[URLStream]
path = false

[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')