diff --git a/loterre-resolvers/v1/9SD/9SD.xml.gz b/loterre-resolvers/v1/9SD/9SD.xml.gz deleted file mode 100644 index be3828c..0000000 --- a/loterre-resolvers/v1/9SD/9SD.xml.gz +++ /dev/null Binary files differ diff --git a/loterre-resolvers/v1/9SD/combine.ini b/loterre-resolvers/v1/9SD/combine.ini deleted file mode 100644 index 6530441..0000000 --- a/loterre-resolvers/v1/9SD/combine.ini +++ /dev/null @@ -1,29 +0,0 @@ -# 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 = Fetch all enrichments -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 - -[use] -plugin = analytics - -[exchange] -value = 9SD.xml.gz - -[files] - -[delegate] -file = ./v1/combine.ini - -[dump] -indent = env('indent', false) - diff --git a/loterre-resolvers/v1/9SD/expand.ini b/loterre-resolvers/v1/9SD/expand.ini index bbbf438..7a4dcd8 100644 --- a/loterre-resolvers/v1/9SD/expand.ini +++ b/loterre-resolvers/v1/9SD/expand.ini @@ -15,7 +15,32 @@ [env] path = primer -value = ./9SD.xml.gz +value = https://www.loterre.fr/wp-content/uploads/2019/12/Pays.xml -[delegate] -file = ./v1/expand.ini +# Necessary plugins +[use] +plugin = basics +plugin = analytics +plugin = storage + +# Flow configuration +[JSONParse] +separator = * + +[expand] +path = value +size = 1 +cacheName = env('primer') + +[expand/assign] +path = value +value = get('value').lowerCase() + +[expand/combine] +path = value +primer = env('primer') +file = ./v1/combine.ini +persistent = true + +[dump] +indent = env('indent', false) diff --git a/loterre-resolvers/v1/9SD/identify.ini b/loterre-resolvers/v1/9SD/identify.ini new file mode 100644 index 0000000..b1e375c --- /dev/null +++ b/loterre-resolvers/v1/9SD/identify.ini @@ -0,0 +1,84 @@ +# 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] +separator = * + +[expand] +path = value +size = 1 +cacheName = env('primer') + +[expand/assign] +path = value +value = get('value').lowerCase() + +[expand/combine] +path = value +primer = env('primer') +file = ./v1/combine.ini +persistent = true + +[expand/debug] +[expand/replace] +path = id +value = get('id') + +path = value.id +value = get('value.id') + +path = value.value.cartographyCode +value = get('value.value.inist$lodexPlacenameCode/$t') + +path = value.value.about +value = get('value.value.rdf$about') + +path = value.value.prefLabel@fr +value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift() + +path = value.value.prefLabel@en +value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'en')).map(x => x.$t).shift() + +path = value.value.wikidataURI +value = get("value.value.wdt$P36/rdf$resource") + +path = value.value.geonameURI +value = get('value.value.gn$geonamesID/$t').prepend('https://www.geonames.org/') + +path = value.value.countryCode +value = get('value.value.gn$countryCode/$t') + +path = value.value.latitude +value = get('value.value.geo$lat/$t') + +path = value.value.longitude +value = get('value.value.geo$long/$t') + +path = localization@en +value = get('value.value.localization').map((x) => x['skos$prefLabel'].filter(y => (y.xml$lang === 'en')).map(x => x.$t).shift()) + +path = 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) diff --git a/loterre-resolvers/v1/combine.ini b/loterre-resolvers/v1/combine.ini index 23e5f42..d6cd7b1 100644 --- a/loterre-resolvers/v1/combine.ini +++ b/loterre-resolvers/v1/combine.ini @@ -19,12 +19,21 @@ plugin = analytics # Flow configuration -[TXTZip] -unzip = true +[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 diff --git a/loterre-resolvers/v1/expand.ini b/loterre-resolvers/v1/expand.ini deleted file mode 100644 index 4889563..0000000 --- a/loterre-resolvers/v1/expand.ini +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage - -# Flow configuration -[JSONParse] -separator = * - -[expand] -path = value -size = 1 -cacheName = env('primer') - -[expand/assign] -path = value -value = get('value').lowerCase() - -[expand/combine] -path = value -primer = env('primer') -prepend = files -file = ./v1/combine.ini - -[dump] -indent = env('indent', false)