diff --git a/loterre-resolvers/v1/2XK/annotate.ini b/loterre-resolvers/v1/2XK/annotate.ini new file mode 100644 index 0000000..9f58dac --- /dev/null +++ b/loterre-resolvers/v1/2XK/annotate.ini @@ -0,0 +1,24 @@ +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-2XK-annotate +post.responses.default.description = Return all objects with annotate fields +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.summary = Annotate 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 + +[delegate] +file = ./v1/2XK.cfg + +[delegate] +file = ./v1/annotate.cfg + +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/2XK/expand.ini b/loterre-resolvers/v1/2XK/expand.ini index 39121b8..0e76fdd 100644 --- a/loterre-resolvers/v1/2XK/expand.ini +++ b/loterre-resolvers/v1/2XK/expand.ini @@ -25,7 +25,7 @@ file = ./v1/2XK.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/2XK/identify.ini b/loterre-resolvers/v1/2XK/identify.ini index 7b2f95f..a1acb9d 100644 --- a/loterre-resolvers/v1/2XK/identify.ini +++ b/loterre-resolvers/v1/2XK/identify.ini @@ -26,14 +26,11 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean -[use] -plugin = basics - [delegate] file = ./v1/2XK.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg [swing] test = get('value').isObject() @@ -158,16 +155,5 @@ path = value.homepage value = get('value.foaf$homepage', []).castArray().map(item => (item.$t ? item.$t : item)) -# Prevent keys from containing dot path notation or start with a dollar character (which is forbidden by nodeJS mongoDB driver) -[OBJFlatten] -separator = fix('.') -safe = false -[exchange] -value = self().mapKeys((value, key) => key.replace(/\.\$/g, '.xml$')) -[OBJFlatten] -separator = fix('.') -reverse = true -safe = false - -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/9SD/annotate.ini b/loterre-resolvers/v1/9SD/annotate.ini index e10c7d5..39cd64b 100644 --- a/loterre-resolvers/v1/9SD/annotate.ini +++ b/loterre-resolvers/v1/9SD/annotate.ini @@ -20,5 +20,5 @@ [delegate] file = ./v1/annotate.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/9SD/expand.ini b/loterre-resolvers/v1/9SD/expand.ini index 5a0b7d7..1e5e468 100644 --- a/loterre-resolvers/v1/9SD/expand.ini +++ b/loterre-resolvers/v1/9SD/expand.ini @@ -18,7 +18,7 @@ file = ./v1/9SD.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/9SD/identify.ini b/loterre-resolvers/v1/9SD/identify.ini index 23d724c..fd14bdb 100644 --- a/loterre-resolvers/v1/9SD/identify.ini +++ b/loterre-resolvers/v1/9SD/identify.ini @@ -30,7 +30,7 @@ file = ./v1/9SD.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg [swing] test = get('value').isObject() @@ -75,5 +75,5 @@ path = value.localization@fr 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) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/D63.cfg b/loterre-resolvers/v1/D63.cfg new file mode 100644 index 0000000..ed4edf9 --- /dev/null +++ b/loterre-resolvers/v1/D63.cfg @@ -0,0 +1,15 @@ +[env] +path = primer +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-communes.xml").join("") + +path = loterreID +value = fix('D63') + +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)) + + +# +# A noter : +# L'utilisation d'un fichier .cfg évite de faire apparaitre ce fichier comme une route dans la documentation openAPI +# diff --git a/loterre-resolvers/v1/D63/annotate.ini b/loterre-resolvers/v1/D63/annotate.ini new file mode 100644 index 0000000..038d2ed --- /dev/null +++ b/loterre-resolvers/v1/D63/annotate.ini @@ -0,0 +1,24 @@ +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-D63-annotate +post.responses.default.description = Return all objects with annotate fields +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.summary = Annotate 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 + +[delegate] +file = ./v1/D63.cfg + +[delegate] +file = ./v1/annotate.cfg + +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/D63/expand.ini b/loterre-resolvers/v1/D63/expand.ini index 4ec82f6..2a78f00 100644 --- a/loterre-resolvers/v1/D63/expand.ini +++ b/loterre-resolvers/v1/D63/expand.ini @@ -14,15 +14,11 @@ post.parameters.1.schema.type = boolean post.parameters.1.description = Indent or not the JSON Result -[env] -path = primer -value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-communes.xml").join("") - -path = loterreID -value = fix('D63') +[delegate] +file = ./v1/D63.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/D63/identify.ini b/loterre-resolvers/v1/D63/identify.ini index 36f0d4f..76d7f12 100644 --- a/loterre-resolvers/v1/D63/identify.ini +++ b/loterre-resolvers/v1/D63/identify.ini @@ -26,15 +26,11 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean -[env] -path = primer -value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-communes.xml").join("") - -path = loterreID -value = fix('D63') +[delegate] +file = ./v1/D63.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg [swing] test = get('value').isObject() @@ -78,5 +74,5 @@ path = value.localization@fr 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) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/P66.cfg b/loterre-resolvers/v1/P66.cfg new file mode 100644 index 0000000..c9bf296 --- /dev/null +++ b/loterre-resolvers/v1/P66.cfg @@ -0,0 +1,15 @@ +[env] +path = primer +value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-memoire.xml").join("") + +path = loterreID +value = fix('P66') + +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)) + + +# +# A noter : +# L'utilisation d'un fichier .cfg évite de faire apparaitre ce fichier comme une route dans la documentation openAPI +# diff --git a/loterre-resolvers/v1/P66/annotate.ini b/loterre-resolvers/v1/P66/annotate.ini new file mode 100644 index 0000000..038d2ed --- /dev/null +++ b/loterre-resolvers/v1/P66/annotate.ini @@ -0,0 +1,24 @@ +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-D63-annotate +post.responses.default.description = Return all objects with annotate fields +post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.summary = Annotate 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 + +[delegate] +file = ./v1/D63.cfg + +[delegate] +file = ./v1/annotate.cfg + +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/P66/expand.ini b/loterre-resolvers/v1/P66/expand.ini index 8b2d5bd..b71b171 100644 --- a/loterre-resolvers/v1/P66/expand.ini +++ b/loterre-resolvers/v1/P66/expand.ini @@ -172,15 +172,11 @@ post.parameters.0.schema.type = boolean post.parameters.0.description = Indent or not the JSON Result -[env] -path = primer -value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-memoire.xml").join("") - -path = loterreID -value = fix('P66') +[delegate] +file = ./v1/P66.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/P66/identify.ini b/loterre-resolvers/v1/P66/identify.ini index 49486d1..edf4eb4 100644 --- a/loterre-resolvers/v1/P66/identify.ini +++ b/loterre-resolvers/v1/P66/identify.ini @@ -33,15 +33,11 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean -[env] -path = primer -value = env("TABLE_SERVER_URL", "http://mapping-tables.daf.intra.inist.fr/").concat("loterre-memoire.xml").join("") - -path = loterreID -value = fix('P66') +[delegate] +file = ./v1/P66.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg [swing] test = get('value').isObject() @@ -67,5 +63,5 @@ path = value.localization@fr 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) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/QX8/annotate.ini b/loterre-resolvers/v1/QX8/annotate.ini index 3607dbe..82ef984 100644 --- a/loterre-resolvers/v1/QX8/annotate.ini +++ b/loterre-resolvers/v1/QX8/annotate.ini @@ -20,5 +20,5 @@ [delegate] file = ./v1/annotate.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/QX8/expand.ini b/loterre-resolvers/v1/QX8/expand.ini index 744416d..207e172 100644 --- a/loterre-resolvers/v1/QX8/expand.ini +++ b/loterre-resolvers/v1/QX8/expand.ini @@ -18,7 +18,7 @@ file = ./v1/QX8.cfg [delegate] -file = ./v1/process.ini +file = ./v1/process.cfg -[dump] -indent = env('indent', false) +[delegate] +file = ./v1/send.cfg diff --git a/loterre-resolvers/v1/combine.cfg b/loterre-resolvers/v1/combine.cfg new file mode 100644 index 0000000..36c2473 --- /dev/null +++ b/loterre-resolvers/v1/combine.cfg @@ -0,0 +1,63 @@ +# Configuration du chemin de stockage des bases des données locales +[env] +path = location +value = fix(`${env('TMPDIR', '/tmp')}/databases/${env('weekNumber')}/${env('loterreID', 'noid')}`) + +# STEP 0 : On noramise la valeur à rechercher (de la même manière que l'index a été créé) +[assign] +path = value +value = fix(_.deburr(String(self.value).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\s]/g, '').toLowerCase())) + +path = loterreID +value = env('loterreID') + +# primer contient l'URL à Télécharger (voir download.ini) +path = primer +value = env('primer') + +# STEP 1 : On vérifie si le vocabulaire est présent localement +[load] +location = env('location') +domain = fix('loterre-vocabulaires').append('-loaded') +path = loterreID +target = isAlreadyDownload + +# STEP 1.1 : si il n'est pas présent localement +[swing] +test = get('isAlreadyDownload').isEmpty() + +# STEP 1.2 : on mémorise le fait que l'on va en faire une copie local +[swing/save] +location = env('location') +domain = fix('loterre-vocabulaires').append('-loaded') +path = loterreID + +# STEP 1.3 : On télécharge la version distante en XML, on la convertit en JSON et on sauvegarde localement +[swing/singleton] +file = ./v1/download.cfg + +# STEP 1.4 : Avec la version JSON fraichement généré on construit un index inversé +[swing/singleton] +file = ./v1/compile.cfg + +[swing/exchange] +value = self().pick(['id', 'value', 'state']) + +# STEP 2 : On cherche une correspondance dans l'index inversé +[load] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('indexes') +path = value +target = result + +[replace] +path = id +value = get('id') +path = value +value = get('result.value', 'n/a') + +# STEP 2 : si l'index inversé nous donne une URI, avec on va chercher les informations associées +[expand] +path = value +file = ./v1/transcribe.cfg + diff --git a/loterre-resolvers/v1/combine.ini b/loterre-resolvers/v1/combine.ini deleted file mode 100644 index 9c6dec8..0000000 --- a/loterre-resolvers/v1/combine.ini +++ /dev/null @@ -1,63 +0,0 @@ -# Configuration du chemin de stockage des bases des données locales -[env] -path = location -value = fix(`${env('TMPDIR', '/tmp')}/databases/${env('weekNumber')}/${env('loterreID', 'noid')}`) - -# STEP 0 : On noramise la valeur à rechercher (de la même manière que l'index a été créé) -[assign] -path = value -value = fix(_.deburr(String(self.value).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/\s]/g, '').toLowerCase())) - -path = loterreID -value = env('loterreID') - -# primer contient l'URL à Télécharger (voir download.ini) -path = primer -value = env('primer') - -# STEP 1 : On vérifie si le vocabulaire est présent localement -[load] -location = env('location') -domain = fix('loterre-vocabulaires').append('-loaded') -path = loterreID -target = isAlreadyDownload - -# STEP 1.1 : si il n'est pas présent localement -[swing] -test = get('isAlreadyDownload').isEmpty() - -# STEP 1.2 : on mémorise le fait que l'on va en faire une copie local -[swing/save] -location = env('location') -domain = fix('loterre-vocabulaires').append('-loaded') -path = loterreID - -# STEP 1.3 : On télécharge la version distante en XML, on la convertit en JSON et on sauvegarde localement -[swing/singleton] -file = ./v1/download.ini - -# STEP 1.4 : Avec la version JSON fraichement généré on construit un index inversé -[swing/singleton] -file = ./v1/compile.ini - -[swing/exchange] -value = self().pick(['id', 'value', 'state']) - -# STEP 2 : On cherche une correspondance dans l'index inversé -[load] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('indexes') -path = value -target = result - -[replace] -path = id -value = get('id') -path = value -value = get('result.value', 'n/a') - -# STEP 2 : si l'index inversé nous donne une URI, avec on va chercher les informations associées -[expand] -path = value -file = ./v1/transcribe.ini - diff --git a/loterre-resolvers/v1/compile.cfg b/loterre-resolvers/v1/compile.cfg new file mode 100644 index 0000000..4163b73 --- /dev/null +++ b/loterre-resolvers/v1/compile.cfg @@ -0,0 +1,46 @@ +[use] +plugin = basics +plugin = analytics +plugin = storage + +# build the reverse index +[cast] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('concepts') + +[replace] +path = id.about +value = get('rdf$about') +# select all keys and remove duplicates to avoid ambiguities +path = value +value = get('indexKeys') + +path = id.score +value = get('score') + +# create a entry for all keys +[exploding] + +# 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.about') +path = score +value = get('id.score') + +[debug] +text = INDEX + +[save] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('indexes') +path = id +score = get('score') + +[pop] + +[replace] +path = state +value = compile diff --git a/loterre-resolvers/v1/compile.ini b/loterre-resolvers/v1/compile.ini deleted file mode 100644 index 4163b73..0000000 --- a/loterre-resolvers/v1/compile.ini +++ /dev/null @@ -1,46 +0,0 @@ -[use] -plugin = basics -plugin = analytics -plugin = storage - -# build the reverse index -[cast] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('concepts') - -[replace] -path = id.about -value = get('rdf$about') -# select all keys and remove duplicates to avoid ambiguities -path = value -value = get('indexKeys') - -path = id.score -value = get('score') - -# create a entry for all keys -[exploding] - -# 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.about') -path = score -value = get('id.score') - -[debug] -text = INDEX - -[save] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('indexes') -path = id -score = get('score') - -[pop] - -[replace] -path = state -value = compile diff --git a/loterre-resolvers/v1/download.cfg b/loterre-resolvers/v1/download.cfg new file mode 100644 index 0000000..e8be0ed --- /dev/null +++ b/loterre-resolvers/v1/download.cfg @@ -0,0 +1,38 @@ +[use] +plugin = basics +plugin = analytics +plugin = storage + + +# Download the skos and save it +[exchange] +value = get('primer') + +[URLStream] +path = false + +[XMLParse] +separator = /rdf:RDF/skos:Concept + +# build indexKeys (remove duplicates to avoid ambiguities) +[assign] +path = indexKeys +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() + +path = score +value = get('owl$deprecated.$t', 3).thru(x => Number(String(x).toLowerCase() === 'true' ? 1 : 2)) + +[save] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('concepts') +path = rdf$about + +[pop] + +[replace] +path = state +value = download diff --git a/loterre-resolvers/v1/download.ini b/loterre-resolvers/v1/download.ini deleted file mode 100644 index e8be0ed..0000000 --- a/loterre-resolvers/v1/download.ini +++ /dev/null @@ -1,38 +0,0 @@ -[use] -plugin = basics -plugin = analytics -plugin = storage - - -# Download the skos and save it -[exchange] -value = get('primer') - -[URLStream] -path = false - -[XMLParse] -separator = /rdf:RDF/skos:Concept - -# build indexKeys (remove duplicates to avoid ambiguities) -[assign] -path = indexKeys -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() - -path = score -value = get('owl$deprecated.$t', 3).thru(x => Number(String(x).toLowerCase() === 'true' ? 1 : 2)) - -[save] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('concepts') -path = rdf$about - -[pop] - -[replace] -path = state -value = download diff --git a/loterre-resolvers/v1/process.cfg b/loterre-resolvers/v1/process.cfg new file mode 100644 index 0000000..8e5383a --- /dev/null +++ b/loterre-resolvers/v1/process.cfg @@ -0,0 +1,31 @@ +# Context input/output +append = dump?indent=true + +# Necessary plugins +[use] +plugin = basics +plugin = analytics +plugin = storage + +# Environment variables +[env] +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)) + +# Flow configuration +[JSONParse] +separator = * + +# On utilise [expand] pour travailler uniqument sur le champ value, sans toucher aux autres champs (si ils existent) +[expand] +path = value +size = 1 +file = ./v1/combine.cfg + +; 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') + diff --git a/loterre-resolvers/v1/process.ini b/loterre-resolvers/v1/process.ini deleted file mode 100644 index f3f7421..0000000 --- a/loterre-resolvers/v1/process.ini +++ /dev/null @@ -1,31 +0,0 @@ -# Context input/output -append = dump?indent=true - -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage - -# Environment variables -[env] -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)) - -# Flow configuration -[JSONParse] -separator = * - -# On utilise [expand] pour travailler uniqument sur le champ value, sans toucher aux autres champs (si ils existent) -[expand] -path = value -size = 1 -file = ./v1/combine.ini - -; 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') - diff --git a/loterre-resolvers/v1/send.cfg b/loterre-resolvers/v1/send.cfg new file mode 100644 index 0000000..5116b62 --- /dev/null +++ b/loterre-resolvers/v1/send.cfg @@ -0,0 +1,16 @@ +[use] +plugin = basics + +# Prevent keys from containing dot path notation or start with a dollar character (which is forbidden by nodeJS mongoDB driver) +[OBJFlatten] +separator = fix('.') +safe = false +[exchange] +value = self().mapKeys((value, key) => key.replace(/\.\$/g, '.xml$').replace(/\/\$/g, '/xml$')) +[OBJFlatten] +separator = fix('.') +reverse = true +safe = false + +[dump] +indent = env('indent', false) diff --git a/loterre-resolvers/v1/transcribe.cfg b/loterre-resolvers/v1/transcribe.cfg new file mode 100644 index 0000000..9f88693 --- /dev/null +++ b/loterre-resolvers/v1/transcribe.cfg @@ -0,0 +1,56 @@ +# Necessary plugins +[use] +plugin = basics +plugin = analytics +plugin = storage + +# Load concept form URI +[load] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('concepts') +path = value +target = value + +# transcribe broaderConcept +[assign] +path = value.skos$broader +value = get('value.skos$broader').castArray().filter(Boolean) + +[map] +path = value.skos$broader + +[map/load] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('concepts') +path = rdf$resource + +[map/exchange] +value = self().pick(['skos$prefLabel', 'rdf$about']) + +# transcribe narrowerConcept +[assign] +path = value.skos$narrower +value = get('value.skos$narrower').castArray().filter(Boolean) + +[map] +path = value.skos$narrower + +[map/load] +location = env('location') +domain = env('loterreID').prepend('loterre-').append('concepts') +path = rdf$resource + +[map/exchange] +value = self().pick(['skos$prefLabel', 'rdf$about']) + + +# trick to apply OBJFlatten only on the value field +[map] +path = value +[map/OBJFlatten] +safe = true + +[assign] +path = value +value = get('value').pop() + diff --git a/loterre-resolvers/v1/transcribe.ini b/loterre-resolvers/v1/transcribe.ini deleted file mode 100644 index 9f88693..0000000 --- a/loterre-resolvers/v1/transcribe.ini +++ /dev/null @@ -1,56 +0,0 @@ -# Necessary plugins -[use] -plugin = basics -plugin = analytics -plugin = storage - -# Load concept form URI -[load] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('concepts') -path = value -target = value - -# transcribe broaderConcept -[assign] -path = value.skos$broader -value = get('value.skos$broader').castArray().filter(Boolean) - -[map] -path = value.skos$broader - -[map/load] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('concepts') -path = rdf$resource - -[map/exchange] -value = self().pick(['skos$prefLabel', 'rdf$about']) - -# transcribe narrowerConcept -[assign] -path = value.skos$narrower -value = get('value.skos$narrower').castArray().filter(Boolean) - -[map] -path = value.skos$narrower - -[map/load] -location = env('location') -domain = env('loterreID').prepend('loterre-').append('concepts') -path = rdf$resource - -[map/exchange] -value = self().pick(['skos$prefLabel', 'rdf$about']) - - -# trick to apply OBJFlatten only on the value field -[map] -path = value -[map/OBJFlatten] -safe = true - -[assign] -path = value -value = get('value').pop() -