diff --git a/loterre-resolvers/v1/annotate.cfg b/loterre-resolvers/v1/annotate.cfg index abbcdf4..2c3b0fd 100644 --- a/loterre-resolvers/v1/annotate.cfg +++ b/loterre-resolvers/v1/annotate.cfg @@ -2,6 +2,7 @@ plugin = basics plugin = xslt +# on définti queqleus variables globales [env] path = lang value = env('lang', 'en') @@ -9,18 +10,25 @@ path = skosFilename value = fix(`${env('TMPDIR', '/tmp')}/${env('loterreID', 'noid')}.skos`) +# On reçoit un tableau (array) en JSON que l'on découpe [JSONParse] separator = * -[assign] +# Pour le premier élement du tableau +[singleton] + +# on ajoute le nom du fichier skos qu el'on utilisera +[singleton/assign] path = skos-file value = env('skosFilename') -[expand] +# et on le télécharge (sauf si le fichier est déjà dans le cache) +[singleton/expand] path = skos-file file = ./v1/fetch.cfg cacheName = fix(`${env('loterreID', 'noid')}-${env('weekNumber')}`) +# on reformat le json pour une structure compatible avec le le json2xml de saxon [replace] path = string.0.key value = id @@ -34,18 +42,63 @@ path = string.1.$t value = get('value') -[XMLString] +# On fait des paquets de 10 objets +[group] +length = 10 + +[replace] +path = items +value = self() + +# Pour chaqu paquet de 10 objets +[map] +path = items + +# On transform le JSON en chaine XML +[map/XMLString] rootElement = array contentElement = map rootNamespace = http://www.w3.org/2005/xpath-functions -[xslt] +# On tranform le XML produit via une feuille xslt +[map/xslt] stylesheet = ./v1/annotate.xsl param = env('lang').prepend('lang=') param = env('skosFilename').prepend('vocabulary=') +; For local test param = vocabulary=/src/temp/QX8.skos -[JSONParse] -separator = data.* +# on récupére le xml produit pour le transformer en JSON +[map/XMLParse] +separator = /root/record + +# On dégroupe les paquets de 10 +[exchange] +value = get('items') + +# pour en faire un flux unique +[ungroup] + +# on parcours le annotation produit par le feuille xsl +[map] +path = annotation + +# on simplfie la structure json fabriquée automatique par xmlparse +[map/OBJFlatten] + +# on supprimer les clé $t générée par xmlparse +[map/exchange] +value = self().mapKeys((value, key) => key.replace(/\/\$t/g, '')) + +[map/assign] +path = arbreHierarchique +value = get('arbreHierarchique', []).castArray().map(item => (item.$t ? item.$t : item)) + +# on renome la clé annoatino en value pour être réciproque avec l'input +[replace] +path = id +value = get('id') +path = value +value = get('annotation', []) # # A noter : diff --git a/loterre-resolvers/v1/annotate.xsl b/loterre-resolvers/v1/annotate.xsl index 5846017..4430c40 100644 --- a/loterre-resolvers/v1/annotate.xsl +++ b/loterre-resolvers/v1/annotate.xsl @@ -1,1000 +1,501 @@ - - - - - - - - - - - - - - - - - - - - - - - - articleId - Identifiant article - - - - paragraphCount - Nombre paragraphes - - - - sectionLevels - Niveaux section - - - level - Niveau - - - sectionCount - Nombre sections - - - sectionDepth - Profondeur section - - - imageCount - Nombre images - - - tableCount - Nombre tableaux - - - refCount - Nombre références - - - tdmReady - Prêt TDM - - - score - Score qualité - - - pdfWordCount - Nombre mots PDF - - - pdfCharCount - Nombre caractères PDF - - - pdfVersion - Version PDF - - - pdfPageCount - Nombre pages PDF - - - pdfPageSize - Taille page PDF - - - pdfWordsPerPage - Nombre mots par page PDF - - - pdfText - PDF texte - - - refBibsNative - Références bibliographiques origine - - - abstractWordCount - Nombre mots résumé - - - abstractCharCount - Nombre caractères résumé - - - keywordCount - Nombre mots-clés - - - hasFormula - Formule - - - refBibs - Références bibliographiques - - - title - Titre - - - author - Auteur(s) - - - name - Nom - - - host - Source - - - pages - Pages - - - first - Première - - - last - Dernière - - - publicationDate - Date publication - - - volume - Volume - - - editor - Éditeur - - - - publisher - Publisher - - - - issn - ISSN - - - eissn - e-ISSN - - - journalId - Identifiant journal - - - - issue - Numéro - - - - genre - Genre - - - subject - Sujet - - - - namedEntities - Entités nommées - - - unitex - Unitex - - - date - Date - - - geogName - Nom géographique - - - orgName - Nom organisme - - - persName - Nom personne - - - placeName - Nom lieu - - - copyrightDate - Date copyright - - - enrichments - Enrichissements - - - type - Type - - - - - frequency - Fréquence - - - - keywords - Mots-clés - - - arkIstex - ARK - - - - qualityIndicators - Indicateurs qualité - - - - teiSource - Source TEI - - - xmlStats - Statistiques XML - - - - - - - - - - - - - - fr - pref - - - - - - - - - - - - fr - syn - - - - - - - - - - - - - - - en - pref - - - - - - - - - - - - - en - syn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - annotations - - - - - - - - - - - - - - - - - - - - fre - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - eng - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - 1 - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - - - - - - - - - Loterre_Annot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "total": , - "data": [ - - - - - - - - - - , - - - - ] - } - - - - - - + + + + + + + + + + + + + + + + + + + + + fr + pref + + + + + + + + + + + + fr + syn + + + + + + + + + + + + + + + en + pref + + + + + + + + + + + + + en + syn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fre + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eng + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + 1 + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + Loterre_Annot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +