diff --git a/biblio-tools/examples.http b/biblio-tools/examples.http index ec8a313..50636d6 100644 --- a/biblio-tools/examples.http +++ b/biblio-tools/examples.http @@ -1,6 +1,6 @@ # To test locally, replace with -# @baseUrl = http://localhost:31976 -@baseUrl = https://biblio-tools.services.inist.fr +@baseUrl = http://localhost:31976 +#@baseUrl = https://biblio-tools.services.inist.fr # unpaywall/is_oa POST {{baseUrl}}/v1/unpaywall/is_oa?indent=true HTTP/1.1 @@ -11,6 +11,8 @@ { "value": "10.1007/s10980-018-0699-8" }, { "value": "10.1159/000490004" }, { "value": "10.1016/j.memsci.2018.08.024"}, + { "value": "10.1029/2018jd029272"}, + { "value": "10.4000/edc.9014"}, { "value": "unknown"} ] ### @@ -27,6 +29,7 @@ { "value": "10.1159/000490004" }, { "value": "10.1016/j.memsci.2018.08.024"}, { "value": "10.1029/2018jd029272"}, + { "value": "10.4000/edc.9014"}, { "value": "unknown"} ] ### diff --git a/biblio-tools/v1/unpaywall/corhal.ini b/biblio-tools/v1/unpaywall/corhal.ini index 6e33d6f..0bebe13 100644 --- a/biblio-tools/v1/unpaywall/corhal.ini +++ b/biblio-tools/v1/unpaywall/corhal.ini @@ -18,6 +18,9 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') + # Necessary plugins [use] plugin = basics @@ -48,48 +51,36 @@ # Création d'une requete graphql avec une liste de DOI [replace] -path = request.query +path = output.0.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,is_oa,oa_status,has_repository_copy,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf,version}}}`) path = input value = self() +[map] +path = output + # Envoi de la requete -[URLFetch] +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') -path = request -json = true -target = output -timeout = 5000 +path = data.GetByDOI.* +timeout = 30000 retries = 3 noerror = false -# Reformatage des résulats (output) -[map] -path = output.data.GetByDOI - # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') reverse = true -# Création d'un objet reponse +# Création d'un objet réponse [map/replace] path = __id value = get('doi').toLower() -path = value.is_oa -value = get('is_oa') - -path = value.oa_status -value = get('oa_status') - -path = value.has_repository_copy -value = get('has_repository_copy') - -path = value.oa_locations -value = get('oa_locations') +path = value +value = self() # Reformatage des DOIS (input) [map] @@ -105,7 +96,7 @@ # Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] -value = get('output.data.GetByDOI').unionBy(self.input, '__id') +value = get('output').unionBy(self.input, '__id') # Fin du traitement par lot [ungroup] @@ -125,7 +116,3 @@ [dump] indent = env('indent') - - - - diff --git a/biblio-tools/v1/unpaywall/expand.ini b/biblio-tools/v1/unpaywall/expand.ini index 620494f..8ed8fb7 100644 --- a/biblio-tools/v1/unpaywall/expand.ini +++ b/biblio-tools/v1/unpaywall/expand.ini @@ -18,6 +18,9 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') + # Necessary plugins [use] plugin = basics @@ -48,33 +51,30 @@ # Création d'une requete graphql avec une liste de DOI [replace] -path = request.query +path = output.0.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi, is_oa, oa_status, has_repository_copy, best_oa_location { host_type }}}`) path = input value = self() +[map] +path = output + # Envoi de la requete -[URLFetch] +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') -path = request -json = true -target = output -timeout = 5000 +path = data.GetByDOI.* +timeout = 30000 retries = 3 noerror = false -# Reformatage des résulats (output) -[map] -path = output.data.GetByDOI - # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') reverse = true -# Création d'un objet reponse +# Création d'un objet réponse [map/replace] path = __id value = get('doi').toLower() @@ -105,7 +105,7 @@ # Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] -value = get('output.data.GetByDOI').unionBy(self.input, '__id') +value = get('output').unionBy(self.input, '__id') # Fin du traitement par lot [ungroup] diff --git a/biblio-tools/v1/unpaywall/is_oa.ini b/biblio-tools/v1/unpaywall/is_oa.ini index d7221f0..972fc4c 100644 --- a/biblio-tools/v1/unpaywall/is_oa.ini +++ b/biblio-tools/v1/unpaywall/is_oa.ini @@ -18,6 +18,8 @@ post.parameters.0.name = indent post.parameters.0.schema.type = boolean +# Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' +value = fix('').join('') # Necessary plugins [use] @@ -49,33 +51,30 @@ # Création d'une requete graphql avec une liste de DOI [replace] -path = request.query +path = output.0.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi, is_oa}}`) path = input value = self() +[map] +path = output + # Envoi de la requete -[URLFetch] +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') -path = request -json = true -target = output -timeout = 5000 +path = data.GetByDOI.* +timeout = 30000 retries = 3 noerror = false -# Reformatage des résulats (output) -[map] -path = output.data.GetByDOI - # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') reverse = true -# Création d'un objet reponse +# Création d'un objet réponse [map/replace] path = __id value = get('doi').toLower() @@ -97,7 +96,7 @@ # Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] -value = get('output.data.GetByDOI').unionBy(self.input, '__id') +value = get('output').unionBy(self.input, '__id') # Fin du traitement par lot [ungroup] diff --git a/biblio-tools/v1/unpaywall/works/expand.ini b/biblio-tools/v1/unpaywall/works/expand.ini index 3fd9473..3ed9c8c 100644 --- a/biblio-tools/v1/unpaywall/works/expand.ini +++ b/biblio-tools/v1/unpaywall/works/expand.ini @@ -51,27 +51,24 @@ # Création d'une requete graphql avec une liste de DOI [replace] -path = request.query +path = output.0.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,data_standard,genre,is_paratext,is_oa,journal_is_in_doaj,journal_is_oa,journal_issns,journal_issn_l,journal_name,oa_status,has_repository_copy,published_date,publisher,title,updated,year,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf},first_oa_location{host_type,is_best,license,pmh_id,updated,url,url_for_landing_page,url_for_pdf,version}}}`) path = input value = self() +[map] +path = output + # Envoi de la requete -[URLFetch] +[map/URLStream] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') -path = request -json = true -target = output -timeout = 5000 +path = data.GetByDOI.* +timeout = 30000 retries = 3 noerror = false -# Reformatage des résulats (output) -[map] -path = output.data.GetByDOI - # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') @@ -95,11 +92,11 @@ value = get('value') path = value -value = get('value') +value = self() # Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] -value = get('output.data.GetByDOI').unionBy(self.input, '__id') +value = get('output').unionBy(self.input, '__id') # Fin du traitement par lot [ungroup]