Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy	(revision 2092)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInDirectoryMacro.groovy	(revision 2093)
@@ -23,48 +23,54 @@
 //
 
 // imports
+
 import org.kohsuke.args4j.*
 import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
+import org.txm.rcpapplication.swt.widget.parameters.*
 
 // parameters
 
-// **change this parameter**
-@Field @Option(name="inputDirectory",usage="Dossier qui contient les fichiers à modifier", widget="Folder", required=true, def='voeux')
-		inputDirectory = new File(System.getProperty("user.home"), "Bureau/voeux")
+@Field @Option(name="inputDirectory",usage="Dossier qui contient les fichiers à modifier", widget="Folder", required=true, def='')
+def inputDirectory
 
-// **change this parameter**
 @Field @Option(name="extension",usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
-		extension = "\\.txt"
+def extension
 
-// **change this parameter**
-@Field @Option(name="find",usage="Expression régulière", widget="String", required=true, def='’')
-		find = "’"
+@Field @Option(name="find",usage="Expression régulière", widget="String", required=true, def='')
+def find
 
-// **change this parameter**
-@Field @Option(name="replaceWith",usage="Chaîne de remplacement", widget="String", required=false, def='\'')
-		replaceWith = "'"
+@Field @Option(name="replaceWith",usage="Chaîne de remplacement", widget="String", required=false, def='')
+def replaceWith
 
-// **change this parameter**
 @Field @Option(name="encoding",usage="Encodage des fichiers", widget="String", required=true, def='UTF-8')
-		encoding = "utf-8"
+def encoding
 
-// **change this parameter**
-// 'true' = only display matching lines, 'false' = replace in matching files
 //@Field @Option(name="showMatchingFilesOnly",usage="Montrer seulement les matchs", widget="Boolean", required=false, def='false')
-		showMatchingFilesOnly = false;
+def showMatchingFilesOnly = false
 
-if (!ParametersDialog.open(this)) return;
+if (!ParametersDialog.open(this)) return
 
-replaceWith = org.apache.commons.lang.StringEscapeUtils.unescapeJava(replaceWith)
+println "Working in $inputDirectory on files with extension "+/$extension/
 
-println "Working with $inputDirectory files with extension="+/.*$extension/
 if (showMatchingFilesOnly) {
-	println "Search '$find'"
+	println "Searching '$find'"
 } else {
-	println "Replace '$find' with '$replaceWith'"
+	println "Replacing '$find' by '$replaceWith'"
 }
 
+/* parse Java escape characters in replace string
+
+\t 	Insert a tab in the text at this point.
+\b 	Insert a backspace in the text at this point.
+\n 	Insert a newline in the text at this point.
+\r 	Insert a carriage return in the text at this point.
+\f 	Insert a formfeed in the text at this point.
+\' 	Insert a single quote character in the text at this point.
+\" 	Insert a double quote character in the text at this point.
+\\ 	Insert a backslash character in the text at this point.
+*/
+replaceWith = org.apache.commons.lang.StringEscapeUtils.unescapeJava(replaceWith)
+
 //find = /date="([0-9]+)-([0-9]+-[0-9]+)"/
 // **change this parameter**
 //replaceWith = 'date="$1-$2" year="$1"'
@@ -94,8 +100,7 @@
 	def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", file.getParentFile()) // create temporary file
 	tmp.write('')                                // create empty file
 	tmp.withWriter(encoding) { writer ->
-		String txt = file.getText(encoding);
-		writer.println txt.replaceAll(find, replaceWith)
+		writer.print file.getText(encoding).replaceAll(find, replaceWith)
 //		file.eachLine(encoding) { line ->                  // for each line
 //			writer.println line.replaceAll(find, replaceWith) // find&replace and print
 //		}
@@ -103,4 +108,6 @@
 	}
 	file.delete()
 	tmp.renameTo(file)                           // save results
-}
\ No newline at end of file
+}
+
+return 1
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInFileMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInFileMacro.groovy	(revision 2092)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/txt/SearchReplaceInFileMacro.groovy	(revision 2093)
@@ -23,44 +23,58 @@
 //
 
 // imports
+
 import org.kohsuke.args4j.*
 import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
+import org.txm.rcpapplication.swt.widget.parameters.*
 
 // parameters
 
-// **change this parameter**
-@Field @Option(name="file",usage="Dossier qui contient les fichiers à modifier", widget="File", required=true, def='/home/mdecorde/xml/qgraalc/qgraal_cm-c.xml')
-		file = new File(System.getProperty("user.home"), "Bureau/voeux")
+@Field @Option(name="file", usage="Dossier qui contient les fichiers à modifier", widget="File", required=true, def='')
+def file
 
-// **change this parameter**
-@Field @Option(name="extension",usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
-		extension = "\\.txt"
+@Field @Option(name="extension", usage="Regexp de l'extension des fichiers à modifier", widget="String", required=true, def='\\.txt')
+def extension
 
-// **change this parameter**
-@Field @Option(name="find",usage="Expression régulière", widget="String", required=true, def='’')
-		find = "’"
+@Field @Option(name="find", usage="Expression régulière", widget="String", required=true, def='')
+def find
 
-// **change this parameter**
-@Field @Option(name="replaceWith",usage="Chaîne de remplacement", widget="String", required=false, def='\'')
-		replaceWith = "'"
+@Field @Option(name="replaceWith", usage="Chaîne de remplacement", widget="String", required=true, def='')
+def replaceWith
 
-// **change this parameter**
-@Field @Option(name="encoding",usage="Encodage des fichiers", widget="String", required=true, def='UTF-8')
-		encoding = "utf-8"
+@Field @Option(name="encoding", usage="Encodage des fichiers", widget="String", required=true, def='UTF-8')
+def encoding
 
-if (!ParametersDialog.open(this)) return;
+if (!ParametersDialog.open(this)) return
 
+/* parse Java escape characters in replace string
+
+\t 	Insert a tab in the text at this point.
+\b 	Insert a backspace in the text at this point.
+\n 	Insert a newline in the text at this point.
+\r 	Insert a carriage return in the text at this point.
+\f 	Insert a formfeed in the text at this point.
+\' 	Insert a single quote character in the text at this point.
+\" 	Insert a double quote character in the text at this point.
+\\ 	Insert a backslash character in the text at this point.
+*/
 replaceWith = org.apache.commons.lang.StringEscapeUtils.unescapeJava(replaceWith)
 
 println "SearchAndReplace in $file"
 
-	def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", file.getParentFile()) // create temporary file
-	tmp.write('')                                // create empty file
-	tmp.withWriter(encoding) { writer ->
-		String txt = file.getText(encoding);
-		writer.println txt.replaceAll(find, replaceWith)
-		writer.close()
-	}
-	file.delete()
-	tmp.renameTo(file)                           // save results
+// create temporary file
+def tmp = File.createTempFile("SearchReplaceInDirectoryTemp", ".tmp", file.getParentFile())
+
+// create empty file
+tmp.write('')
+
+tmp.withWriter(encoding) { writer ->
+	writer.print file.getText(encoding).replaceAll(find, replaceWith)
+	writer.close()
+}
+
+// save results
+file.delete()
+tmp.renameTo(file)
+
+return 1
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/Struct.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/Struct.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/Struct.groovy	(revision 2093)
@@ -1,45 +0,0 @@
-package org.txm.macro.urs.exploit;
-
-class Struct implements Comparable<Struct> {
-
-	String  name
-	Integer start
-	Integer end
-
-	Struct(String n, Integer s, Integer e) {
-		name  = n
-		start = s
-		end   = e
-	}
-
-	public int compareTo(Struct s) {
-		if (start < s.start && end > s.end) { 			// self contains s : [ { } ]
-			//println sprintf("%s[%d, %d] ^ %s[%d, %d]", name, start, end, s.name, s.start, s.end)
-			return -1
-		} else if (start > s.start && end < s.end) { 	// s contains self : { [ ] }
-			//println sprintf("%s[%d, %d] v %s[%d, %d]", name, start, end, s.name, s.start, s.end)
-			return 1
-		} else if (start == s.start && end == s.end) { 	// self and s have the same intervals : [{ }]
-			//println sprintf("%s[%d, %d] = %s[%d, %d]", name, start, end, s.name, s.start, s.end)
-			return name.compareTo(s.name) // use the lexicographic order of the structure names
-		} else if (start < s.start) { 					// interval starting on the left comes first : [ { ...
-			return -1
-		} else if (start > s.start) { 					// interval starting on the right comes after : { [ ...
-			return 1
-		} else if (end > s.end) { 						// same start, interval ending on the right comes before : [{ } ]...
-			return -1
-		} else if (end < s.end) { 						// same start, interval ending on the right comes before : [{ ] }...
-			return -1
-		} else {										// same start, same end : [{ ]}...
-			return name.compareTo(s.name) // use the lexicographic order of the structure names
-		}
-	}
-
-	public toString(Struct s) {
-		sprintf("%s[%d, %d]", s.name, s.start, s.end)
-	}
-
-	public print(Struct s) {
-		print(s.toString())
-	}
-}
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/StructuresIndexMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/StructuresIndexMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/StructuresIndexMacro.groovy	(revision 2093)
@@ -1,514 +0,0 @@
-package org.txm.macro.urs.exploit
-// Copyright © 2017 ENS de Lyon, CNRS, University of Franche-Comté
-// Licensed under the terms of the GNU General Public License (http://www.gnu.org/licenses)
-// @author sheiden
-
-/*
- Macro affichant les statistiques de différentes structures d'un corpus
- Paramètres de la macro :
- - corpus : le corpus sélectionné dans la vue Corpus
- - structures : liste des structures à interroger. Séparer les noms par une virgule.
- - structProperties : liste des propriétés de structures. Séparer les noms par une virgule.
- Il doit y avoir autant de propriétés de structures que de structures indiquées dans le paramètre structures.
- Les structures doivent posséder la propriété demandée.
- Ce paramètre peut être laissé vide, dans ce cas la colonne 'prop' n'est pas affichée.
- - query : requête CQL de sélection de mots exprimée obligatoirement en format complet : [...]
- Par exemple :
- - [frpos="N.*"] pour sélectionner les noms communs et les noms propres
- - [] pour sélectionner tous les mots
- - wordProperty : propriété de mot utilisée pour calculer le vocabulaire et les fréquences
- - displayIndex : calculer l'index hiérarchique des valeurs de la propriété wordProperty pour la requête query sur chaque structure
- - Vmax : nombre maximum des mots les plus fréquents à afficher dans l'index
- Résultat :
- Le résultat est un tableau TSV affiché dans la console.
- On peut l'exploiter avec un copier/coller dans Calc.
- Chaque ligne correspond à une structure du corpus.
- Les lignes sont ordonnées par ordre hiérarchique des structures du début à la fin du corpus.
- Les colonnes sont :
- - struct : nom de la structure
- - prop : valeur de la propriété de la structure
- (si le paramètre structProperties est vide, cette colonne est absente du résultat)
- - start : position du premier mot de la structure dans le corpus
- (les positions du corpus sont numérotées à partir de 0).
- Les colonnes start et end sont pratiques quand on n'a pas de propriété de structure à afficher pour se repérer dans le corpus.
- - end : position du dernier mot de la structure
- - T : taille de la structure (end-start)
- - t : nombre de mots sélectionnés dans la structure
- - v : nombre de valeurs différentes de la propriété des mots sélectionnés dans la structure
- - fmin : fréquence minimale des valeurs de la propriété de mots sélectionnés dans la structure
- - fmax : fréquence maximale des valeurs de la propriété de mots sélectionnés dans la structure
- - index : l'index hiérarchique des valeurs de la propriété de mot choisie des mots sélectionnés par la requête CQL
- Exemple de résultats sur le texte "Essais sur la peinture" de Diderot :
- struct	prop	start	end	T	t	v	fmin	fmax	index
- text	DiderotEssais	46203	56871	10668	2011	903	1	38	[nature, couleur, homme, tableau, lumière, objets, œil, toile, art, effet, corps, artiste, ombre, ombres, deux, peintre, peinture, dessin, couleurs, tête]
- div	0	46214	49223	3009	549	327	1	16	[nature, homme, modèle, figure, deux, école, artiste, chose, âge, figures, dessin, actions, fois, professeur, action, attitude, manière, femme, col, tête]
- p	0	46220	46259	39	5	5	1	1	[nature, forme, cause, êtres, un]
- p	1	46260	46456	196	36	25	1	3	[yeux, col, épaules, gorge, femme, jeunesse, nature, accroissement, orbe, paupières, cavité, absence, organe, sourcils, joues, lèvre, mouvement, altération, parties, visage]
- p	2	46457	46578	121	28	26	1	2	[pieds, nature, regards, homme, dos, poitrine, forme, cartilages, col, vertèbres, tête, mains, articulation, poignet, coudes, arrière, membres, centre, gravité, système]
- p	3	46579	46622	43	5	4	1	2	[causes, effets, êtres, imitation]
- p	4	46623	46727	104	22	20	1	2	[ignorance, règles, effets, causes, convention, suites, peine, artiste, imitation, nature, pieds, jambes, genoux, têtes, tact, observation, phénomènes, liaison, enchaînement, difformités]
- p	5	46728	46797	69	10	6	1	4	[nez, Antinoüs, nature, difformité, altérations, reste]
- p	6	46798	46859	61	9	7	1	2	[règles, nature, homme, rue, chose, statue, proportions]
- p	7	46860	46942	82	13	11	1	2	[extrémité, pied, voile, bossu, Venus, Medicis, nature, figure, crayons, monstre, chose]
- p	8	46943	46982	39	11	11	1	1	[figure, système, suites, inconséquence, principe, production, art, mille, lieues, œuvre, nature]
- p	9	46983	47196	213	38	30	1	5	[homme, figure, âge, fonctions, mystères, art, artiste, proportions, despotisme, nature, condition, sacrifice, cent, manières, organisation, habitude, facilité, grandeur, proportion, membre]
- ... [13 paragraphes] ...
- div	1	49224	52163	2939	531	307	1	23	[couleur, nature, chair, artiste, toile, art, homme, yeux, œil, couleurs, tableau, harmonie, effet, dessin, palette, organe, ton, coloriste, vie, ami]
- p	24	49230	49258	28	7	7	1	1	[C', dessin, forme, êtres, couleur, vie, souffle]
- p	25	49259	49284	25	6	6	1	1	[maîtres, art, juges, dessin, monde, couleur]
- p	26	49285	49354	69	16	16	1	1	[dessinateurs, coloristes, littérature, Cent, froids, orateur, Dix, orateurs, poète, intérêt, homme, Helvétius, dix, bons, peine, mort]
- p	27	49355	49485	130	24	21	1	2	[artiste, besoin, échelle, ami, atelier, teintes, demi-, palette, quart, heure, travail, ordre, pendant, passage, auteur, bureau, ligne, livre, place, allure]
- p	28	49486	49680	194	46	42	1	2	[yeux, toile, chaos, œuvre, sentiment, couleur, bouche, palette, image, pinceau, création, oiseaux, nuances, plumage, fleurs, velouté, arbres, verdures, azur, ciel]
- p	29	49681	49967	286	48	43	1	3	[nature, organe, homme, arbre, artistes, chose, monde, variété, coloristes, couleur, disposition, doute, œil, couleurs, tableau, effets, rouges, blancs, tapisserie, murs]
- p	30	49968	50068	100	20	17	1	3	[fois, organe, peintre, ouvrage, littérateur, caractère, disposition, pente, homme, voix, explosion, état, silence, artiste, tableau, couleur, coloris]
- p	31	50069	50105	36	7	7	1	1	[coup, organe, affection, corps, vapeur, nature, imitation]
- p	32	50106	50267	161	26	19	1	4	[couleur, palette, artiste, effet, tableau, teintes, couleurs, idée, endroit, fois, appréciation, scène, composition, manie, travail, teinte, composé, substances, unes]
- p	33	50268	50319	51	7	7	1	1	[général, harmonie, composition, peintre, effet, pinceau, couleur]
- ... [etc.]
- Avec les paramètres :
- - structures : text,div,p
- - structProperties : id,n,n
- - query : [frpos="N.*"]
- - wordProperty : word
- - displayIndex : true
- - Vmax : 20
- */
-
-// Déclarations
-
-import org.kohsuke.args4j.*
-
-import groovy.transform.Field
-
-import org.txm.rcp.swt.widget.parameters.*
-import org.txm.Toolbox
-import org.eclipse.ui.console.*
-import org.txm.macro.cqp.*
-import org.txm.searchengine.cqp.CQPSearchEngine
-import org.txm.searchengine.cqp.corpus.CQPCorpus
-import org.txm.searchengine.cqp.corpus.Partition
-import org.txm.searchengine.cqp.corpus.Property
-import org.txm.searchengine.cqp.corpus.QueryResult
-import org.txm.searchengine.cqp.corpus.Subcorpus;
-import org.txm.searchengine.cqp.corpus.query.CQLQuery
-import org.txm.rcp.commands.*
-import org.txm.statsengine.r.core.RWorkspace
-
-byte CQI_CONST_FIELD_MATCH = (byte) 0x10
-
-def scriptName = this.class.getSimpleName()
-
-def selection = []
-for (def s : corpusViewSelections) {
-	if (s instanceof CQPCorpus) selection << s
-	else if (s instanceof Partition) selection.addAll(s.getParts())
-}
-
-if (selection.size() == 0) {
-	println "** $scriptName: please select a Corpus or a Partition in the Corpus view: "+corpusViewSelections
-	return false
-}
-println "WORKING WITH $selection"
-// BEGINNING OF PARAMETERS
-
-@Field @Option(name="structures", usage="act,scene", widget="String", required=true, def="text,div,p")
-		def structures
-@Field @Option(name="structProperties", usage="n,n", widget="String", required=false, def="id,n,n")
-		def structProperties
-@Field @Option(name="query", usage="[word!='\\p{P}']", widget="String", required=true, def="[pos=\"NOM.*\"|frpos=\"N.*\"]")
-		def query
-@Field @Option(name="wordProperty", usage="word", widget="String", required=true, def="word")
-		def wordProperty
-@Field @Option(name="displayIndex", usage="display a hierarchical index", widget="Boolean", required=true, def="true")
-		def displayIndex
-@Field @Option(name="Vmax", usage="size of index", widget="Integer", required=false, def="20")
-		def Vmax
-// END OF PARAMETERS
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return;
-
-def CQI = CQPSearchEngine.getCqiClient()
-
-def corpusStructs = structures.split(",") 			// ["act", "scene"]
-structProperties = structProperties.trim()
-
-if (structProperties.size() > 0) {
-	propParam = true
-	corpusStructPropNames = structProperties.split(",")	// ["n", "n"]
-	corpusStructProps = [corpusStructs, corpusStructPropNames].transpose().collectEntries()
-} else {
-	propParam = false
-}
-
-// First define the order theory over corpus structures intervals
-// by defining a binary comparator that will be used to build the
-// TreeSet of intervals
-
-// function to print the hierarchical index of a query
-def print_index = { c, q, p, cut ->
-
-	QueryResult qr = c.query(new CQLQuery(q), "RES1", false);
-	Subcorpus subcorpus = c.createSubcorpus("RES1", qr);
-	p = subcorpus.getProperty(p)
-	def tC = subcorpus.getSize()
-	def matches_target_p = CQI.cpos2Str(p.getQualifiedName(), CQI.dumpSubCorpus(qr.getQualifiedCqpId(), CQI_CONST_FIELD_MATCH, 0, tC-1))
-	if (cut > 0) {
-		println matches_target_p.countBy { it }.sort { -it.value }.take(cut)
-	} else {
-		println matches_target_p.countBy { it }.sort { -it.value }
-	}
-	subcorpus.delete()
-}
-
-// function to print the statistics of an index of a query
-def print_freq = { CQPCorpus c, q, p ->
-
-	// appel du moteur
-	//println "QUERY=$q"
-	QueryResult qr = c.query(new CQLQuery(q), "RES1", false);
-	Subcorpus subcorpus = c.createSubcorpus("RES1", qr);
-	p = subcorpus.getProperty(p)
-	int csize = c.getSize()
-	if (csize == 0) {
-		if (displayIndex) {
-			println "0\t0\t0\t0\t[]"
-		} else {
-			println "0\t0\t0\t0"
-		}
-	} else {
-		def tC = CQI.subCorpusSize(subcorpus.getQualifiedCqpId())
-		def matches_target_p = CQI.cpos2Id(p.getQualifiedName(), CQI.dumpSubCorpus(subcorpus.getQualifiedCqpId(), CQI_CONST_FIELD_MATCH, 0, tC-1))
-
-		//println ""
-
-		// afficher les positions de mots du résultat
-		//println CQI.dumpSubCorpus("${c}:RES1", CQI_CONST_FIELD_MATCH, 0, CQI.subCorpusSize("${c}:RES1")-1)
-
-		// afficher les codes des occurrences de la propriété du résultat
-		//println matches_target_p
-
-		// afficher l'index hiérarchique des codes du résultat
-		//println matches_target_p.collect { it }.countBy { it }.sort { -it.value }
-
-		// calculer la fréquence de chaque valeur et ne garder que les fréquences
-		def index = matches_target_p.collect { it }.countBy { it }
-		def freqs = index.values()
-
-		// afficher la liste décroissante des fréquences du résultat
-		//println freqs.sort { -it.value }
-
-
-		//def tF = freqs.sum() // control value
-		def v = freqs.size()
-		def fmin = freqs.min()
-		def fmax = freqs.max()
-		//println sprintf("t %d, v %d, fmin %d, fmax %d", tC, v, fmin, fmax)
-		print sprintf("%d\t%d\t%d\t%d", tC, v, fmin, fmax)
-		// afficher les valeurs des occurrences de la propriété du résultat
-		if (displayIndex) {
-			heads = index.sort { -it.value }.take(Vmax).keySet()
-			println "\t"+heads.collect { CQI.id2Str(p.getQualifiedName(), it)[0] }
-		} else {
-			println ""
-		}
-	}
-	subcorpus.delete()
-}
-
-def r = RWorkspace.getRWorkspaceInstance()
-
-/**
- * group units by CQP match
- *
- * units are sorted for faster processing
- *
- * @param allUnites
- * @param matches
- * @param strict_inclusion
- * @return
- */
-static def inter(def allUnites, def matches) {
-	//println allUnites.collect() {it -> it[0]}
-	allUnites = allUnites.sort() { a, b -> a[0] <=> b[0] ?: a[1] <=> b[1] }
-	//println allUnites.collect() {it -> it[0]}
-	def unitsSize = allUnites.size()
-	def iCurrentUnit = 0
-	def selectedUnits = []
-
-	def matchesSize = matches.size()
-	def iCurrentMatch = 0
-
-
-	while (iCurrentMatch < matchesSize && iCurrentUnit < unitsSize) {
-
-		def unit = allUnites[iCurrentUnit]
-		def match = matches[iCurrentMatch]
-		if (unit[1] < match.getStart()) {
-			iCurrentUnit++
-		} else if (unit[0] > match.getEnd()) {
-			iCurrentMatch++
-		} else {
-
-			if (match.getStart() <= unit[0] && unit[1] <= match.getEnd()) {
-				selectedUnits << unit
-			}
-
-			iCurrentUnit++
-		}
-	}
-	return selectedUnits
-}
-
-selection.each { corpus ->
-
-	corpusName = corpus.getID()
-	mainCorpusName = corpus.getMainCorpus().getID()
-	println "Corpus = "+corpusName
-	println "Corpus QualifiedCqpId = "+corpus.getCqpId()
-	println "MainCorpus = "+mainCorpusName
-	println "Corpus QualifiedCqpId = "+corpus.getMainCorpus().getCqpId()
-
-	def struct_names = (CQI.corpusStructuralAttributes(corpus.getMainCorpus().getCqpId()) as List)
-	struct_names.removeAll { it.contains('_') }
-	struct_names=(struct_names-"txmcorpus").grep(corpusStructs)
-	//println "struct_names = "+struct_names
-
-	if (struct_names.size() == 0) {
-		println "** Impossible to find the structures (${corpusStructs}), aborting."
-		return
-	}
-
-	def level = [:]
-
-	// Now build the TreeSet of corpus structures intervals
-
-	def h = new TreeSet<Struct>()
-
-	struct_names.each {
-		def matches = []
-		for (i in 0..CQI.attributeSize("${mainCorpusName}.${it}")-1) {
-			(start, end) = CQI.struc2Cpos("${mainCorpusName}.${it}", i)
-			matches << [start, end]
-			//println sprintf("Adding %s[%d, %d]", it, start, end)
-		}
-		def intersection = inter(matches, corpus.getMatches())
-		for (def item : intersection)
-			h.add(new Struct(it, item[0], item[1]))
-	}
-
-	if (propParam) {
-		print sprintf("struct\tprop\tstart\tend\tT\tt\tv\tfmin\tfmax")
-	} else {
-		print sprintf("struct\tstart\tend\tT\tt\tv\tfmin\tfmax")
-	}
-
-	if (displayIndex) {
-		println sprintf("\tindex")
-	} else {
-		println ""
-	}
-
-	def env = System.getenv()
-	def localPath = env["HOME"]+"/Documents/d3test"
-	new File(localPath).mkdirs()
-
-	// reset output file
-	def resultFile = new File(localPath, "desc-partition.html")
-	def result = new PrintWriter(resultFile)
-	result.print("")
-	result.close()
-
-	resultFile << '''\
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" charset="UTF-8"/>
-    <link type="text/css" rel="stylesheet" href="style.css"/>
-    <script type="text/javascript" src="d3/d3.v3.js" charset="utf-8"></script>
-    <script type="text/javascript" src="d3/layout/partition.js" charset="utf-8"></script>
-    <style type="text/css">
-
-.chart {
-  display: block;
-  margin: auto;
-  margin-top: 60px;
-  font-size: 11px;
-}
-
-rect {
-  stroke: #eee;
-  fill: #aaa;
-  fill-opacity: .8;
-}
-
-rect.parent {
-  cursor: pointer;
-  fill: steelblue;
-}
-
-text {
-  pointer-events: none;
-}
-
-    </style>
-  </head>
-  <body>
-    <div id="body">
-      <div id="footer">
-        Structures hierarchy
-        <div class="hint">click or shift-alt-click to zoom-in or out</div>
-      </div>
-    </div>
-    <script type="text/javascript">
-
-var w = 1120,
-    h = 600,
-    x = d3.scale.linear().range([0, w]),
-    y = d3.scale.linear().range([0, h]);
-
-var vis = d3.select("#body").append("div")
-    .attr("class", "chart")
-    .style("width", w + "px")
-    .style("height", h + "px")
-  .append("svg:svg")
-    .attr("width", w)
-    .attr("height", h);
-
-var partition = d3.layout.partition()
-    .value(function(d) { return d.size; }).sort(null);
-
-var tree = `{'''
-
-	// Now iterate on the TreeSet to get a depth first search on the structure intervals
-
-	def rec_struct_regex = /([^0-9]+)[0-9]+/
-
-	/*
-	 "name": "sha-hamlet",
-	 "children": [
-	 {
-	 "name": "sha-hamcast",
-	 "children": [
-	 {
-	 "name": "sha-ham1",
-	 "children": [
-	 {"name": "sha-ham102", "size": 855},
-	 {"name": "sha-ham103", "size": 464},
-	 {"name": "sha-ham104", "size": 296},
-	 {"name": "sha-ham105", "size": 635}
-	 ]
-	 }
-	 ]
-	 }
-	 ]
-	 }`;
-	 */
-
-	def displayTree = { head ->
-		if (head) {
-			subtree = h.tailSet(head)
-			subtree.each { print sprintf("%s[%d, %d], ", it.name, it.start, it.end) }
-			println ""
-			if (subtree.size() == 0) {
-				println sprintf("%s[%d, %d]", head.name, head.start, head.end)
-			} else {
-				displayTree(subtree)
-			}
-		}
-	}
-
-	//displayTree(h.first())
-
-	def divPropVals = []
-	def divLengths = []
-	def textDivPropVals = []
-	def textDivLengths = []
-
-	h.each {
-
-		//println sprintf("Displaying %s[%d, %d]", it.name, it.start, it.end)
-		if (propParam) {
-
-			def rec_match = (it.name =~ rec_struct_regex)
-			if (rec_match.size() == 1) {
-				println "Rec struct match = "+rec_match[0][1]
-				istruct_name = rec_match[0][1]
-			} else {
-				//println "Struct match = "+it.name
-				istruct_name = it.name
-			}
-
-			def struct_name = "${mainCorpusName}.${istruct_name}_${corpusStructProps[it.name]}"
-			def propVal = CQI.struc2Str(struct_name, CQI.cpos2Struc(struct_name, [it.start] as int[]))[0]
-			if (it.name == "text") {
-				textDivPropVals.push(divPropVals)
-				divPropVals = []
-				textDivLengths.push(divLengths)
-				divLengths = []
-			} else if (it.name == "div") {
-				divPropVals.push(propVal)
-				divLengths.push(it.end-it.start)
-			}
-
-
-			print sprintf("%s\t%s\t%d\t%d\t%d\t", it.name, propVal, it.start, it.end, it.end-it.start)
-		} else {
-			def struct_name = "${mainCorpusName}.${it.name}"
-			print sprintf("%s\t%d\t%d\t%d\t", it.name, it.start, it.end, it.end-it.start)
-		}
-		print_freq(corpus, sprintf("a:%s :: a>=%d & a<=%d", query, it.start, it.end), wordProperty)
-	}
-
-	textDivPropVals.push(divPropVals)
-	textDivPropVals.remove(0)
-	textDivLengths.push(divLengths)
-	textDivLengths.remove(0)
-
-	println textDivPropVals
-	println textDivLengths
-
-	def textDivPropVals1 = textDivPropVals[0] as String[]
-	r.addVectorToWorkspace("textDivPropVals1", textDivPropVals1)
-	def textDivLengths1 = textDivLengths[0] as int[]
-	r.addVectorToWorkspace("textDivLengths1", textDivLengths1)
-
-	def PNGFile = File.createTempFile("txm", ".png", new File(Toolbox.getTxmHomePath(), "results"))
-	def PNGFilePath = PNGFile.getAbsolutePath()
-	println "PNG file: "+PNGFilePath
-
-	def SVGFile = File.createTempFile("txm", ".svg", new File(Toolbox.getTxmHomePath(), "results"))
-	def SVGFilePath = SVGFile.getAbsolutePath()
-	println "SVG file: "+SVGFilePath
-
-	/// BEGINNING OF R SCRIPT
-	def script ="""
-df <- data.frame(structure=textDivPropVals1,
-                 longueur=textDivLengths1)
-p<-ggplot(data=df, aes(x=structure, y=longueur)) +
-  geom_bar(stat="identity", fill="steelblue") +
-  geom_text(aes(label=longueur), vjust=1.6, color="white", size=3.5) +
-  labs(title="${corpusName}", x="Structure div", y = "Longueur") +
-  theme_minimal()
-"""
-	/// END OF R SCRIPT
-
-	// execute R script
-	try {
-		r.eval("library(ggplot2)")
-		try {
-			r.eval(script+"ggsave(file=\"${PNGFilePath}\", plot=p)")
-			r.eval(script+"ggsave(file=\"${SVGFilePath}\", plot=p)")
-	
-			//display the SVG results graphic
-			monitor.syncExec(new Runnable() {
-						@Override
-						public void run() { try { OpenSVGGraph.OpenSVGFile(SVGFilePath, "Longueur des structures de "+corpusName) } catch(Exception e) {e.printStackTrace()} }
-					})
-		} catch (Exception e) {
-			println "** Error: "+e
-		}
-	} catch (Exception e) {
-		println "** The 'ggplot2' R package is not installed. Start R ("+RWorkspace.getExecutablePath()+") and run 'install.packages(\"ggplot2\");'."
-	}
-}
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsIndexMacro.groovy	(revision 2093)
@@ -94,8 +94,20 @@
 	def word = mainCorpus.getWordProperty()
 	def analecCorpus = URSCorpora.getCorpus(mainCorpus)
 
+	def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+	if (errors.size() > 0) {
+		println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
+		return;
+	}
+	
+	errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)
+	if (errors.size() > 0) {
+		println "** $unit_ursql unit URSQL cannot be computed in the corpus with types: $errors."
+		return;
+	}
+	
 	if (unit_property_display.length() > 0) {
-		def errors = AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql, unit_property_display).size()
+		errors = AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, AnalecUtils.getFilterParameters(unit_ursql)[0], unit_property_display).size()
 		if (errors > 0) {
 			println "Error: some Unit types don't contain the $unit_property_display property: $errors"
 			return
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasProgressionMacro.groovy	(revision 2093)
@@ -97,8 +97,14 @@
 	def word = mainCorpus.getWordProperty()
 	def analecCorpus = URSCorpora.getCorpus(mainCorpus)
 
+	def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+	if (errors.size() > 0) {
+		println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
+		return;
+	}
+	
 	if (schema_property_display.length() > 0) {
-		def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql, schema_property_display).size()
+		errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, AnalecUtils.getFilterParameters(schema_ursql)[0], schema_property_display).size()
 		if (errors > 0) {
 			println "Error: some Schema types don't contain the $schema_property_display property: $errors"
 			return
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsListMacro.groovy	(revision 2093)
@@ -50,7 +50,7 @@
 		String unit_ursql
 @Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
 		int limit_distance_in_schema
-@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
+@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=false, def="")
 		limit_cql
 @Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
 		boolean strict_inclusion
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasListMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasListMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemasListMacro.groovy	(revision 2093)
@@ -52,13 +52,15 @@
 CQPCorpus corpus = corpusViewSelection
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
-if (!AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)) {
-	println "** The $schema_ursql schema URSQL cannot be computed in the corpus."
+def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+if (errors.size() > 0) {
+	println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
-if (!AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)) {
-	println "** $unit_ursql unit URSQL cannot be computed in the corpus."
+errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)
+if (errors.size() > 0) {
+	println "** $unit_ursql unit URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsInterDistanceMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsInterDistanceMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsInterDistanceMacro.groovy	(revision 2093)
@@ -42,13 +42,15 @@
 CQPCorpus corpus = corpusViewSelection
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
-if (!AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)) {
-	println "** The $schema_ursql schema URSQL cannot be computed in the corpus."
+def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+if (errors.size() > 0) {
+	println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
-if (!AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)) {
-	println "** $unit_ursql unit URSQL cannot be computed in the corpus."
+errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)
+if (errors.size() > 0) {
+	println "** $unit_ursql unit URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/UnitsStabilityScoreMacro.groovy	(revision 2093)
@@ -46,16 +46,17 @@
 def corpus = corpusViewSelection
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
-if (!AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)) {
-	println "** The $schema_ursql schema URSQL cannot be computed in the corpus."
+def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+if (errors.size() > 0) {
+	println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
-if (!AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)) {
-	println "** $unit_ursql unit URSQL cannot be computed in the corpus."
+errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)
+if (errors.size() > 0) {
+	println "** $unit_ursql unit URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
-
 def CQI = CQPSearchEngine.getCqiClient()
 
 def prop = corpus.getProperty(word_property)
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemaLengthsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemaLengthsMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/exploit/SchemaLengthsMacro.groovy	(revision 2093)
@@ -43,13 +43,15 @@
 def corpus = corpusViewSelection
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
-if (!AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)) {
-	println "** The $schema_ursql schema URSQL cannot be computed in the corpus."
+def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+if (errors.size() > 0) {
+	println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
-if (!AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)) {
-	println "** $unit_ursql unit URSQL cannot be computed in the corpus."
+errors=AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, unit_ursql)
+if (errors.size() > 0) {
+	println "** $unit_ursql unit URSQL cannot be computed in the corpus with types: $errors."
 	return;
 }
 
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAnnotationsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAnnotationsMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAnnotationsMacro.groovy	(revision 2093)
@@ -1,52 +0,0 @@
-// STANDARD DECLARATIONS
-package org.txm.macro.urs.edit
-
-import org.kohsuke.args4j.*
-import groovy.transform.Field
-import org.txm.rcp.swt.widget.parameters.*
-import org.txm.annotation.urs.*
-import org.txm.searchengine.cqp.corpus.*
-import visuAnalec.elements.*
-
-if (!(corpusViewSelection instanceof MainCorpus)) {
-	println "Corpora selection is not a Corpus"
-	return;
-}
-
-@Field @Option(name="I_AM_SURE_IWANT_TO_RESET_THE_ANNOTATIONS", usage="an example boolean", widget="Boolean", required=false, def="false")
-def I_AM_SURE_IWANT_TO_RESET_THE_ANNOTATIONS
-
-// Open the parameters input dialog box
-if (!ParametersDialog.open(this)) return;
-
-MainCorpus corpus = corpusViewSelection
-def analecCorpus = URSCorpora.getCorpus(corpus);
-def structure = analecCorpus.getStructure()
-
-Class[] classes = [Unite.class, Relation.class, Schema.class]
-println "Removing unites..."
-for (String type : structure.getTypes(Unite.class)) {
-	for (Unite unite : analecCorpus.getUnites(type).toArray(new Unite[0])) {
-		analecCorpus.supUnite(unite)
-	}
-//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Unite.class, type));
-}
-
-println "Removing relations..."
-for (String type : structure.getTypes(Relation.class)) {
-	for (Relation relation : analecCorpus.getRelations(type).toArray(new Relation[0])) {
-		analecCorpus.supRelation(relation)
-	}
-//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Relation.class, type));
-}
-
-println "Removing schemas..."
-for (String type : structure.getTypes(Schema.class)) {
-	for (Schema schema : analecCorpus.getSchemas(type).toArray(new Schema[0])) {
-		analecCorpus.supSchema(schema)
-	}
-//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Schema.class, type));
-}
-
-println "Done. Save the corpus to finish the reset."
-
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsDeleteMacro.groovy	(revision 2093)
@@ -0,0 +1,87 @@
+// Copyright © 2016 ENS de Lyon, CNRS, University of Franche-Comté
+// Licensed under the terms of the GNU General Public License (http://www.gnu.org/licenses)
+// @author mdecorde
+// @author sheiden
+// STANDARD DECLARATIONS
+package org.txm.macro.urs.edit
+
+import org.apache.commons.lang.StringUtils
+import org.kohsuke.args4j.*
+
+import groovy.transform.Field
+
+import org.txm.Toolbox
+import org.txm.rcp.swt.widget.parameters.*
+import org.txm.annotation.urs.*
+import org.txm.macro.urs.AnalecUtils
+import org.txm.searchengine.cqp.AbstractCqiClient
+import org.txm.searchengine.cqp.corpus.*
+import org.txm.searchengine.cqp.corpus.query.CQLQuery
+
+import visuAnalec.donnees.Corpus
+import visuAnalec.donnees.Structure
+import visuAnalec.elements.*
+import visuAnalec.vue.Vue
+
+def scriptName = this.class.getSimpleName()
+
+def selection = []
+for (def s : corpusViewSelections) {
+	if (s instanceof CQPCorpus) selection << s
+	else if (s instanceof Partition) selection.addAll(s.getParts())
+}
+
+if (selection.size() == 0) {
+	println "** $scriptName: please select a Corpus or a Partition in the Corpus view: "+corpusViewSelections
+	return false
+}
+
+// BEGINNING OF PARAMETERS
+@Field @Option(name="schema_ursql", usage="TYPE@PROP=VALUE", widget="String", required=true, def="CHAINE")
+		String schema_ursql
+@Field @Option(name="minimum_schema_size", usage="Minimum size needed to consider a schema", widget="Integer", required=true, def="3")
+		int minimum_schema_size
+@Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
+		String unit_ursql
+@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int limit_distance_in_schema
+@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
+		limit_cql
+@Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
+		boolean strict_inclusion
+@Field @Option(name="limit_distance", usage="Unit distance to structure limit (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
+		int limit_distance
+
+@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
+		debug
+if (!ParametersDialog.open(this)) return
+	if (debug == "OFF") debug = 0; else if (debug == "ON") debug = 1; else if (debug == "ALL") debug = 2 else if (debug == "REALLY ALL") debug = 3
+
+//corpus = corpusViewSelection
+def allResults = [:]
+def errors = new HashSet()
+for (def corpus : selection) {
+	println "Deleting '$unit_ursql' units of '$schema_ursql' schemas in the '$corpus' corpus..."
+
+	def word = corpus.getWordProperty()
+	def analecCorpus = URSCorpora.getCorpus(corpus)
+	Vue analecView = URSCorpora.getVue(corpus)
+	Structure structure = analecCorpus.getStructure()
+
+	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, Integer.MAX_VALUE,
+			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
+		
+	def n = 0
+	def nerrors = 0
+	for (Unite unit : selectedUnits) {
+		analecCorpus.supUnite(unit);
+		n++
+	}
+	
+	corpus.getMainCorpus().setIsModified(true)
+	allResults[corpus] = selectedUnits
+	allResults["n"] = n
+	println " $n units deleted"
+}
+
+return allResults
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAllAnnotationsMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAllAnnotationsMacro.groovy	(revision 0)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/ResetAllAnnotationsMacro.groovy	(revision 2093)
@@ -0,0 +1,52 @@
+// STANDARD DECLARATIONS
+package org.txm.macro.urs.edit
+
+import org.kohsuke.args4j.*
+import groovy.transform.Field
+import org.txm.rcp.swt.widget.parameters.*
+import org.txm.annotation.urs.*
+import org.txm.searchengine.cqp.corpus.*
+import visuAnalec.elements.*
+
+if (!(corpusViewSelection instanceof MainCorpus)) {
+	println "Corpora selection is not a Corpus"
+	return;
+}
+
+@Field @Option(name="I_AM_SURE_IWANT_TO_RESET_THE_ANNOTATIONS", usage="an example boolean", widget="Boolean", required=false, def="false")
+def I_AM_SURE_IWANT_TO_RESET_THE_ANNOTATIONS
+
+// Open the parameters input dialog box
+if (!ParametersDialog.open(this)) return;
+
+MainCorpus corpus = corpusViewSelection
+def analecCorpus = URSCorpora.getCorpus(corpus);
+def structure = analecCorpus.getStructure()
+
+Class[] classes = [Unite.class, Relation.class, Schema.class]
+println "Removing unites..."
+for (String type : structure.getTypes(Unite.class)) {
+	for (Unite unite : analecCorpus.getUnites(type).toArray(new Unite[0])) {
+		analecCorpus.supUnite(unite)
+	}
+//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Unite.class, type));
+}
+
+println "Removing relations..."
+for (String type : structure.getTypes(Relation.class)) {
+	for (Relation relation : analecCorpus.getRelations(type).toArray(new Relation[0])) {
+		analecCorpus.supRelation(relation)
+	}
+//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Relation.class, type));
+}
+
+println "Removing schemas..."
+for (String type : structure.getTypes(Schema.class)) {
+	for (Schema schema : analecCorpus.getSchemas(type).toArray(new Schema[0])) {
+		analecCorpus.supSchema(schema)
+	}
+//	fireMessage(new StructureEvent(analecCorpus, TypeModifStructure.SUPPR_TYPE, Schema.class, type));
+}
+
+println "Done. Save the corpus to finish the reset."
+
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/AnalecUtils.groovy	(revision 2093)
@@ -11,6 +11,7 @@
 
 
 static def isPropertyDefined(Class clazz, Corpus analecCorpus, String ursql) {
+	if (ursql == null || ursql.length() == 0) return new HashSet() 
 	def params = getFilterParameters(ursql)
 	def typeRegexp = params[0]
 	def propRegexp = params[1]
@@ -19,6 +20,7 @@
 
 static def isPropertyDefined(Class clazz, Corpus analecCorpus, String typeRegexp, String propRegexp) {
 	def errors = new HashSet()
+	if (propRegexp == null || propRegexp.length() == 0) return errors;
 	Structure structure = analecCorpus.getStructure();
 	for (def type : structure.getTypes(clazz)) {
 		if (!type.matches(typeRegexp)) continue; // test only types matching with typeRegexp
Index: tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy	(revision 2092)
+++ tmp/org.txm.analec.rcp/src/org/txm/macro/urs/check/CheckDuplicatesInSchemasMacro.groovy	(revision 2093)
@@ -46,8 +46,16 @@
 def word = corpus.getWordProperty()
 def analecCorpus = URSCorpora.getCorpus(corpus)
 
+
+
+def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql)
+if (errors.size() > 0) {
+	println "** The $schema_ursql schema URSQL cannot be computed in the corpus with types: $errors."
+	return;
+}
+
 if (schema_property_display.length() > 0) {
-	def errors = AnalecUtils.isPropertyDefined(Schema.class, analecCorpus, schema_ursql, schema_property_display).size()
+	errors = AnalecUtils.isPropertyDefined(Unite.class, analecCorpus, AnalecUtils.getFilterParameters(schema_ursql)[0], schema_property_display).size()
 	if (errors > 0) {
 		println "Error: some Schema types don't contain the $schema_property_display property: $errors"
 		return
Index: tmp/org.txm.analec.rcp/build.properties
===================================================================
--- tmp/org.txm.analec.rcp/build.properties	(revision 2092)
+++ tmp/org.txm.analec.rcp/build.properties	(revision 2093)
@@ -2,8 +2,8 @@
 source.. = src/
 output.. = bin/
 bin.includes = META-INF/,\
-               OSGI-INF/,\
                icons/,\
                plugin.xml,\
-               libs/
+               libs/,\
+               OSGI-INF/
 qualifier=svn
Index: tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties	(revision 2092)
+++ tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle.properties	(revision 2093)
@@ -39,3 +39,11 @@
 
 view.name   = Properties
 view.name.0 = Search
+
+menu.label.1 = Tools
+menu.label.2 = Annotation
+menu.label.3 = Verification
+menu.label.4 = Exploitation
+menu.label.5 = Export
+command.label.3 = URS
+PostTXMHOMEInstallationStep.description = Install URS Files
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 2092)
+++ tmp/org.txm.analec.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 2093)
@@ -59,3 +59,11 @@
 view.name = Propri\u00E9t\u00E9s
 
 view.name.0 = chercher
+
+menu.label.1 = Outils
+menu.label.2 = Annotation
+menu.label.3 = V�rification
+menu.label.4 = Exploitation
+menu.label.5 = Export
+command.label.3 = URS
+PostTXMHOMEInstallationStep.description = Installe les fichiers URS
\ No newline at end of file
Index: tmp/org.txm.analec.rcp/plugin.xml
===================================================================
--- tmp/org.txm.analec.rcp/plugin.xml	(revision 2092)
+++ tmp/org.txm.analec.rcp/plugin.xml	(revision 2093)
@@ -21,30 +21,30 @@
             </command>
             <menu
                   id="menu.urs.tools"
-                  label="Tools">
+                  label="%menu.label.1">
                <menu
-                     label="Annotation">
+                     label="%menu.label.2">
                   <dynamic
                         class="org.txm.annotation.urs.commands.URSToolsMenuContribution"
                         id="edit">
                   </dynamic>
                </menu>
                <menu
-                     label="Verification">
+                     label="%menu.label.3">
                   <dynamic
                         class="org.txm.annotation.urs.commands.URSToolsMenuContribution"
                         id="check">
                   </dynamic>
                </menu>
                <menu
-                     label="Exploitation">
+                     label="%menu.label.4">
                   <dynamic
                         class="org.txm.annotation.urs.commands.URSToolsMenuContribution"
                         id="exploit">
                   </dynamic>
                </menu>
                <menu
-                     label="Export">
+                     label="%menu.label.5">
                   <dynamic
                         class="org.txm.annotation.urs.commands.URSToolsMenuContribution"
                         id="export">
@@ -194,7 +194,7 @@
             locationURI="menu:menu.help.plugins">
          <command
                commandId="org.txm.rcp.commands.OpenBrowser"
-               label="URS"
+               label="%command.label.3"
                style="push">
             <parameter
                   name="org.txm.rcp.commands.commandParameter2"
@@ -377,7 +377,7 @@
          point="org.txm.PostTXMHOMEInstallationStep">
       <PostTXMHOMEInstallationStep
             class="org.txm.annotation.urs.InstallURSFiles"
-            description="Install URS Files"
+            description="%PostTXMHOMEInstallationStep.description"
             name="URS macro">
       </PostTXMHOMEInstallationStep>
    </extension>
