diff --git a/loterre-resolvers/v1/combine.ini b/loterre-resolvers/v1/combine.ini index 6201601..5077a17 100644 --- a/loterre-resolvers/v1/combine.ini +++ b/loterre-resolvers/v1/combine.ini @@ -1,3 +1,4 @@ +# 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())) @@ -5,53 +6,52 @@ path = loterreID value = env('loterreID') +# primer contient l'URL à Télécharger (voir download.ini) path = primer value = env('primer') -# Check if the file is already download +# 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 -# if not download, do it and save it +# 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 -# Download the vocabulary from URL +# 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 -# Build un reverse index from the dowload vocabulary +# 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']) -# Search concept in the reverse index file -[debug] -path = value -text = SEARCH - +# STEP 2 : On cherche une correspondance dans l'index inversé [load] location = env('location') domain = env('loterreID').prepend('loterre-').append('indexes') path = value -target = value +target = result +[replace] +path = id +value = get('id') +path = value +value = get('result.value', 'n/a') -[debug] -path = value2 -text = FOUND? - -# Transcribe URI and its internal links (broader, narrower) +# 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/process.ini b/loterre-resolvers/v1/process.ini index c61b131..a4775ca 100644 --- a/loterre-resolvers/v1/process.ini +++ b/loterre-resolvers/v1/process.ini @@ -26,15 +26,11 @@ [JSONParse] separator = * -[debug] -path = value -text = REQUEST - +# 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 -;cacheName = fix(`post-v1-expand-week-${env('loterreID')}-${env('weekNumber')}`) ; Pour les documents sans résulat, on donne une valeur par défaut [swing] diff --git a/loterre-resolvers/v1/transcribe.ini b/loterre-resolvers/v1/transcribe.ini index 782db77..799874a 100644 --- a/loterre-resolvers/v1/transcribe.ini +++ b/loterre-resolvers/v1/transcribe.ini @@ -6,8 +6,9 @@ # Load concept form URI [load] +location = env('location') domain = env('loterreID').prepend('loterre-').append('concepts') -path = value.value +path = value target = value # transcribe broaderConcept @@ -19,6 +20,7 @@ path = value.skos$broader [map/load] +location = env('location') domain = env('loterreID').prepend('loterre-').append('concepts') path = rdf$resource @@ -34,6 +36,7 @@ path = value.skos$narrower [map/load] +location = env('location') domain = env('loterreID').prepend('loterre-').append('concepts') path = rdf$resource