diff --git a/loterre-resolvers/v1/9SD/expand.ini b/loterre-resolvers/v1/9SD/expand.ini index 36c465d..3df12d9 100644 --- a/loterre-resolvers/v1/9SD/expand.ini +++ b/loterre-resolvers/v1/9SD/expand.ini @@ -16,52 +16,16 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-pays.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-pays.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('2XK') -# Flow configuration -[JSONParse] -separator = * - -[expand] -path = value -size = 1 -cacheName = env('weekNumber').prepend('post-v1-9SD-expand-week') - -[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 -cacheName = env('weekNumber').prepend('post-v1-9SD-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] -path = id -value = get('id') -path = value -value = get('value.value') - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.rdf$about').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +[delegate] +file = ./v1/process.ini [dump] indent = env('indent', false) diff --git a/loterre-resolvers/v1/9SD/identify.ini b/loterre-resolvers/v1/9SD/identify.ini index 8b9acb0..7417a35 100644 --- a/loterre-resolvers/v1/9SD/identify.ini +++ b/loterre-resolvers/v1/9SD/identify.ini @@ -28,41 +28,21 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-pays.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-pays.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('2XK') -# Flow configuration -[JSONParse] -separator = * +[delegate] +file = ./v1/process.ini -[expand] -path = value -size = 1 -cacheName = env('weekNumber').prepend('post-v1-9SD-identify-week') +[swing] +test = get('value').isObject() +[swing/replace] -[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 -cacheName = env('weekNumber').prepend('post-v1-9SD-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] path = id value = get('id') @@ -70,44 +50,37 @@ value = get('value.id') path = value.cartographyCode -value = get('value.value.inist$lodexPlacenameCode/$t') +value = get('value.inist$lodexPlacenameCode/$t') path = value.about -value = get('value.value.rdf$about') +value = get('value.rdf$about') path = value.prefLabel@fr -value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift() +value = get('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() +value = get('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") +value = get("value.wdt$P36/rdf$resource") path = value.geonameURI -value = get('value.value.gn$geonamesID/$t').prepend('https://www.geonames.org/') +value = get('value.gn$geonamesID/$t').prepend('https://www.geonames.org/') path = value.countryCode -value = get('value.value.gn$countryCode/$t') +value = get('value.gn$countryCode/$t') path = value.latitude -value = get('value.value.geo$lat/$t') +value = get('value.geo$lat/$t') path = value.longitude -value = get('value.value.geo$long/$t') +value = get('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()) +value = get('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()) - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.id').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +value = get('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/D63/expand.ini b/loterre-resolvers/v1/D63/expand.ini index 2dde62e..1a727e5 100644 --- a/loterre-resolvers/v1/D63/expand.ini +++ b/loterre-resolvers/v1/D63/expand.ini @@ -16,52 +16,16 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-communes.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-communes.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('D63') -# Flow configuration -[JSONParse] -separator = * - -[expand] -path = value -size = 1 -cacheName = env('weekNumber').prepend('post-v1-D63-expand-week') - -[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 -cacheName = env('weekNumber').prepend('post-v1-D63-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] -path = id -value = get('id') -path = value -value = get('value.value') - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.rdf$about').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +[delegate] +file = ./v1/process.ini [dump] indent = env('indent', false) diff --git a/loterre-resolvers/v1/D63/identify.ini b/loterre-resolvers/v1/D63/identify.ini index 901d22e..370fc43 100644 --- a/loterre-resolvers/v1/D63/identify.ini +++ b/loterre-resolvers/v1/D63/identify.ini @@ -28,41 +28,20 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-communes.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-communes.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('D63') -# Flow configuration -[JSONParse] -separator = * +[delegate] +file = ./v1/process.ini -[expand] -path = value -size = 1 -cacheName = env('weekNumber').prepend('post-v1-D63-identify-week') - -[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 -cacheName = env('weekNumber').prepend('post-v1-D63-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] +[swing] +test = get('value').isObject() +[swing/replace] path = id value = get('id') @@ -70,44 +49,37 @@ value = get('value.id') path = value.cartographyCode -value = get('value.value.inist$lodexPlacenameCode/$t') +value = get('value.inist$lodexPlacenameCode/$t') path = value.about -value = get('value.value.rdf$about') +value = get('value.rdf$about') path = value.prefLabel@fr -value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift() +value = get('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() +value = get('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") +value = get("value.wdt$P36/rdf$resource") path = value.geonameURI -value = get('value.value.gn$geonamesID/$t').prepend('https://www.geonames.org/') +value = get('value.gn$geonamesID/$t').prepend('https://www.geonames.org/') path = value.countryCode -value = get('value.value.gn$countryCode/$t') +value = get('value.gn$countryCode/$t') path = value.latitude -value = get('value.value.geo$lat/$t') +value = get('value.geo$lat/$t') path = value.longitude -value = get('value.value.geo$long/$t') +value = get('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()) +value = get('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()) - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.id').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +value = get('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/P66/expand.ini b/loterre-resolvers/v1/P66/expand.ini index e375d6b..b50b6a9 100644 --- a/loterre-resolvers/v1/P66/expand.ini +++ b/loterre-resolvers/v1/P66/expand.ini @@ -174,52 +174,16 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-memoire.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-memoire.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('P66') -# Flow configuration -[JSONParse] -separator = * - -[expand] -path = value -size = 1 -cacheName = env('weekNumber').prepend('post-v1-P66-expand-week') - -[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 -cacheName = env('weekNumber').prepend('post-v1-P66-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] -path = id -value = get('id') -path = value -value = get('value.value') - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.rdf$about').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +[delegate] +file = ./v1/process.ini [dump] indent = env('indent', false) diff --git a/loterre-resolvers/v1/P66/identify.ini b/loterre-resolvers/v1/P66/identify.ini index 542851b..bceb3f9 100644 --- a/loterre-resolvers/v1/P66/identify.ini +++ b/loterre-resolvers/v1/P66/identify.ini @@ -35,42 +35,20 @@ [env] path = primer -value = env("TABLE_SERVER_URL", "https://inist-wsdata.dboard.inist.fr/") \ - .concat("loterre-resolvers-memoire.xml").join("") +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-memoire.xml").join("") path = weekNumber value = thru(() => new Date()).thru(currentDate => Math.floor((currentDate - (new Date(currentDate.getFullYear(), 0, 1)))/(24 * 60 * 60 * 1000))).thru(days => Math.ceil(days / 7)) -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage +path = loterreID +value = fix('2XK') -# Flow configuration -[JSONParse] -separator = * +[delegate] +file = ./v1/process.ini -[expand] -path = value -default = n/a -size = 1 -cacheName = env('weekNumber').prepend('post-v1-P66-identify-week') - -[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 -cacheName = env('weekNumber').prepend('post-v1-P66-combine-week') - -[expand/remove] -test = get('value.value').isString() - -[expand/replace] +[swing] +test = get('value').isObject() +[swing/replace] path = id value = get('id') @@ -78,26 +56,19 @@ value = get('value.id') path = value.about -value = get('value.value.rdf$about') +value = get('value.rdf$about') path = value.prefLabel@fr -value = get('value.value.skos$prefLabel').filter(y => (y.xml$lang === 'fr')).map(x => x.$t).shift() +value = get('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() +value = get('value.skos$prefLabel').filter(y => (y.xml$lang === 'en')).map(x => x.$t).shift() 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()) +value = get('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()) - -; Pour les documents sans résulat, on donne une valeur par défaut -[swing] -test = get('value.id').isEmpty() -[swing/assign] -path = value -value = fix('n/a') +value = get('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/process.ini b/loterre-resolvers/v1/process.ini new file mode 100644 index 0000000..5785455 --- /dev/null +++ b/loterre-resolvers/v1/process.ini @@ -0,0 +1,53 @@ +# Context input/output +append = dump?indent=true + +# OpenAPI Documentation - JSON format (dot notation) +post.responses.default.description = Enrich json 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.required = true +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream + +# Necessary plugins +[use] +plugin = basics +plugin = analytics + +# Flow configuration +[JSONParse] +separator = * + +[expand] +path = value +size = 1 +cacheName = fix(`post-v1-expand-week-${env('loterreID')}-${env('weekNumber')}`) + +[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 + +[expand/remove] +test = get('value.value').isString() + +[expand/replace] +path = id +value = get('id') +path = value +value = get('value.value') + +; Pour les documents sans résulat, on donne une valeur par défaut +[swing] +test = get('value.rdf$about').isEmpty() +[swing/assign] +path = value +value = fix('n/a') +