diff --git a/loterre-resolvers/examples.http b/loterre-resolvers/examples.http index d0744d6..8b39d0b 100644 --- a/loterre-resolvers/examples.http +++ b/loterre-resolvers/examples.http @@ -10,7 +10,7 @@ ] ### -# 9SD/expand +# 9SD/identify POST https://loterre-resolvers.services.inist.fr/v1/9SD/identify?indent=true HTTP/1.1 Content-Type: application/json @@ -21,3 +21,28 @@ { "value": "CAN"} ] ### + + +# D63/expand +POST https://loterre-resolvers.services.inist.fr/v1/D63/expand?indent=true HTTP/1.1 +Content-Type: application/json + +[ + { "value": "Nancy" }, + { "value": "Ecrouves" }, + { "value": "Pagny sur Moselle" }, + { "value": "Trifouilly"} +] +### + +# D63/identify +POST https://loterre-resolvers.services.inist.fr/v1/D63/identify?indent=true HTTP/1.1 +Content-Type: application/json + +[ + { "value": "Nancy sur cluses" }, + { "value": "Trémaouézan" }, + { "value": "Curan" }, + { "value": "Paris"} +]../affiliations-tools/examples.http +### diff --git a/loterre-resolvers/v1/D63/expand.ini b/loterre-resolvers/v1/D63/expand.ini new file mode 100644 index 0000000..b2f93b3 --- /dev/null +++ b/loterre-resolvers/v1/D63/expand.ini @@ -0,0 +1,47 @@ +# 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 = Enrich on field of each Object with a SKOS concept +post.requestBody.required = true +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.parameters.0.in = query +post.parameters.0.name = path +post.parameters.0.schema.type = string +post.parameters.0.description = The path in each object to enrcih with a SKOS Cocnept +post.parameters.1.in = query +post.parameters.1.name = indent +post.parameters.1.schema.type = boolean +post.parameters.1.description = Indent or not the JSON Result + +[env] +path = primer +value = https://www.loterre.fr/wp-content/uploads/2020/07/Communes.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('expand') + +[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 +persistent = true + +[dump] +indent = env('indent', false) diff --git a/loterre-resolvers/v1/D63/identify.ini b/loterre-resolvers/v1/D63/identify.ini new file mode 100644 index 0000000..774effa --- /dev/null +++ b/loterre-resolvers/v1/D63/identify.ini @@ -0,0 +1,103 @@ +# OpenAPI Documentation - JSON format (dot notation) +mimeType = application/json + +post.operationId = post-v1-9SD-identify +post.description = Associer une communes de France au vocabulaire Loterre correspondant - https://www.loterre.fr/skosmos/D63/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.id = 1 +post.requestBody.content.application/json.example.0.value = Nancy +post.requestBody.content.application/json.example.1.id = 2 +post.requestBody.content.application/json.example.1.value = Pagny sur Moselle +post.requestBody.content.application/json.example.2.id = 3 +post.requestBody.content.application/json.example.2.value = Trifouilly +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.requestBody.required = true +post.responses.default.content.application/json.example.0.id = 1 +post.responses.default.content.application/json.example.0.value = {...} +post.responses.default.content.application/json.example.1.id = 2 +post.responses.default.content.application/json.example.1.value = {...} +post.responses.default.content.application/json.example.2.id = 3 +post.responses.default.content.application/json.example.2.value = {...} +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.responses.default.description = Les prefixes DOI en verion textuel +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://www.loterre.fr/wp-content/uploads/2020/07/Communes.xml + +# Necessary plugins +[use] +plugin = basics +plugin = analytics +plugin = storage + +# Flow configuration +[JSONParse] +separator = * + +[expand] +path = value +size = 1 +cacheName = env('primer').append('identify') + +[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 +persistent = true + +[expand/remove] +test = get('value.value').isString() + +[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)