Newer
Older
web-services / loterre-resolvers / v1 / 9SD / identify.ini
@Nicolas Thouvenin Nicolas Thouvenin on 6 Oct 2 KB use new json parser
# 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 = Indetify place name with some idenfier
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

[env]
path = primer
value = https://www.loterre.fr/wp-content/uploads/2019/12/Pays.xml

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

# Flow configuration
[JSONParse]
legacy = false
separator = $

[expand]
path = value
size = 1
cacheName = env('primer').append('identify')

[expand/assign]
path = value
value = get('value').lowerCase()

[expand/combine]
path = value
primer = env('primer')
file = ./v1/combine.ini
persistent = true

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

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

path = value.cartographyCode
value = get('value.value.inist$lodexPlacenameCode/$t')

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.wikidataURI
value = get("value.value.wdt$P36/rdf$resource")

path = value.geonameURI
value = get('value.value.gn$geonamesID/$t').prepend('https://www.geonames.org/')

path = value.countryCode
value = get('value.value.gn$countryCode/$t')

path = value.latitude
value = get('value.value.geo$lat/$t')

path = value.longitude
value = get('value.value.geo$long/$t')

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())


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