Index: tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/URSAnnotationsImporter.java
===================================================================
--- tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/URSAnnotationsImporter.java	(revision 3014)
+++ tmp/org.txm.analec.rcp/src/org/txm/annotation/urs/imports/URSAnnotationsImporter.java	(revision 3015)
@@ -34,16 +34,23 @@
 import visuAnalec.vue.Vue;
 
 public class URSAnnotationsImporter {
-
+	
 	protected MainCorpus mainCorpus;
+	
 	protected Corpus analecCorpus;
+	
 	protected File annotationsDirectory;
+	
 	protected Vue analecVue;
+	
 	protected IProgressMonitor monitor;
+	
 	protected XMLInputFactory factory;
+	
 	protected File aamFile;
+	
 	protected static PersonalNamespaceContext Nscontext = new PersonalNamespaceContext();
-
+	
 	public URSAnnotationsImporter(IProgressMonitor monitor, File outputDirectory, File aamFile, MainCorpus mainCorpus, Corpus analecCorpus, Vue analecVue) {
 		this.annotationsDirectory = outputDirectory;
 		this.aamFile = aamFile;
@@ -52,112 +59,116 @@
 		this.analecVue = analecVue;
 		this.monitor = monitor;
 	}
-
+	
 	public boolean process() throws Exception {
 		if (!annotationsDirectory.exists()) {
-			System.out.println("Error: annotationsDirectory does not exist: "+annotationsDirectory.getAbsolutePath());
+			System.out.println("Error: annotationsDirectory does not exist: " + annotationsDirectory.getAbsolutePath());
 			return false;
 		}
 		if (!annotationsDirectory.isDirectory()) {
-			System.out.println("Error: annotationsDirectory is not a directory: "+annotationsDirectory.getAbsolutePath());
+			System.out.println("Error: annotationsDirectory is not a directory: " + annotationsDirectory.getAbsolutePath());
 			return false;
 		}
 		if (!aamFile.exists()) {
-			System.out.println("Warning: aamFile does not exist: "+aamFile.getAbsolutePath());
-		} else {
-
+			System.out.println("Warning: aamFile does not exist: " + aamFile.getAbsolutePath());
+		}
+		else {
+			
 			if (!FichiersGlozz.importerModeleGlozz(analecCorpus, aamFile)) {
-				System.out.println("Error while importing Glozz model: "+aamFile);
+				System.out.println("Error while importing Glozz model: " + aamFile);
 				return false;
 			}
 		}
 		File[] ursFiles = annotationsDirectory.listFiles(new FilenameFilter() {
+			
 			@Override
 			public boolean accept(File dir, String name) {
 				return name.matches(".+-urs\\.xml");
 			}
 		});
-
+		
 		if (ursFiles == null) {
-			System.out.println("No XML files found in "+annotationsDirectory);
+			System.out.println("No XML files found in " + annotationsDirectory);
 			return false;
 		}
 		if (ursFiles.length == 0) {
-			System.out.println("No XML files found in "+annotationsDirectory);
+			System.out.println("No XML files found in " + annotationsDirectory);
 			return false;
 		}
 		Arrays.sort(ursFiles);
-
+		
 		factory = XMLInputFactory.newInstance();
 		List<String> cqpTextIds = Arrays.asList(mainCorpus.getCorpusTextIdsList());
-
-		List<Integer> all_result_summary = Arrays.asList(0,0,0,0,0,0,0,0);
-
-		if (monitor != null) monitor.subTask("Processing "+ursFiles.length+" texts...");
+		
+		List<Integer> all_result_summary = Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0);
+		
+		if (monitor != null) monitor.subTask("Processing " + ursFiles.length + " texts...");
 		for (File xmlTXMFile : ursFiles) {
 			String textid = xmlTXMFile.getName().substring(0, xmlTXMFile.getName().length() - 8);
-			System.out.println("Processing text: "+textid);
+			System.out.println("Processing text: " + textid);
 			if (cqpTextIds.contains(textid)) {
-				if (monitor != null) monitor.subTask("Processing "+textid+" text...");
+				if (monitor != null) monitor.subTask("Processing " + textid + " text...");
 				// N unit, N unit error, N unit no match error, N unit too much match error, N Relation, N Relation error, N Schema, N Schema error
 				List<Integer> result_summary = processText(textid, xmlTXMFile);
-
-				System.out.println(textid+" import report: ");
-				System.out.println(" N Units added: "+result_summary.get(0));
-				System.out.println(" N Units error: "+result_summary.get(1));
-				System.out.println(" N Units no match error: "+result_summary.get(2));
-				System.out.println(" N Units too much match error: "+result_summary.get(3));
-				System.out.println(" N Relations added: "+result_summary.get(4));
-				System.out.println(" N Relations error: "+result_summary.get(5));
-				System.out.println(" N Schemas added: "+result_summary.get(6));
-				System.out.println(" N Schemas error: "+result_summary.get(7));
-
-				for (int i = 0 ; i < all_result_summary.size() ; i++) all_result_summary.set(i, all_result_summary.get(i)+result_summary.get(i));
-
-			} else {
-				System.out.println("Warning: cannot found text with ID="+textid+" in current CQP corpus.");
+				
+				System.out.println(textid + " import report: ");
+				System.out.println(" N Units added: " + result_summary.get(0));
+				System.out.println(" N Units error: " + result_summary.get(1));
+				System.out.println(" N Units no match error: " + result_summary.get(2));
+				System.out.println(" N Units too much match error: " + result_summary.get(3));
+				System.out.println(" N Relations added: " + result_summary.get(4));
+				System.out.println(" N Relations error: " + result_summary.get(5));
+				System.out.println(" N Schemas added: " + result_summary.get(6));
+				System.out.println(" N Schemas error: " + result_summary.get(7));
+				
+				for (int i = 0; i < all_result_summary.size(); i++)
+					all_result_summary.set(i, all_result_summary.get(i) + result_summary.get(i));
+				
 			}
-
+			else {
+				System.out.println("Warning: cannot found text with ID=" + textid + " in current CQP corpus.");
+			}
+			
 			if (monitor != null && monitor.isCanceled()) {
 				return false;
 			}
 		}
-
+		
 		if (!aamFile.exists()) {
 			Vue vue = URSCorpora.getVue(analecCorpus);
 			vue.retablirVueParDefaut();
 		}
-
+		
 		System.out.println("Final import report: ");
-		System.out.println(" N Units added: "+all_result_summary.get(0));
-		System.out.println(" N Units error: "+all_result_summary.get(1));
-		System.out.println(" N Units no match error: "+all_result_summary.get(2));
-		System.out.println(" N Units too much match error: "+all_result_summary.get(3));
-		System.out.println(" N Relations added: "+all_result_summary.get(4));
-		System.out.println(" N Relations error: "+all_result_summary.get(5));
-		System.out.println(" N Schemas added: "+all_result_summary.get(6));
-		System.out.println(" N Schemas error: "+all_result_summary.get(7));
-
+		System.out.println(" N Units added: " + all_result_summary.get(0));
+		System.out.println(" N Units error: " + all_result_summary.get(1));
+		System.out.println(" N Units no match error: " + all_result_summary.get(2));
+		System.out.println(" N Units too much match error: " + all_result_summary.get(3));
+		System.out.println(" N Relations added: " + all_result_summary.get(4));
+		System.out.println(" N Relations error: " + all_result_summary.get(5));
+		System.out.println(" N Schemas added: " + all_result_summary.get(6));
+		System.out.println(" N Schemas error: " + all_result_summary.get(7));
+		
 		return true;
 	}
-
+	
 	private int getPosition(Subcorpus textSubcorpus, HashMap<String, int[]> id2position, String id) {
 		int[] positions = id2position.get(id);
 		int start = textSubcorpus.getMatches().get(0).getStart();
 		int end = textSubcorpus.getMatches().get(0).getEnd();
 		if (positions.length == 0) { // no word for id=deb
 			return -1;
-		} 
-
+		}
+		
 		for (int p : positions) {
 			if (start <= p && p <= end) {
 				return p;
 			}
 		}
-
+		
 		return -2;
 	}
-
+	
 	private List<Integer> processText(String textid, File xmlTXMFile) throws Exception {
 		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
 		// N unit, N unit error, N unit no match error, N unit too much match error, N Relation, N Relation error, N Schema, N Schema error
@@ -169,46 +180,45 @@
 		int nRelationsError = 0;
 		int nSchemaAdded = 0;
 		int nSchemaError = 0;
-
+		
 		unites.clear();
 		relations.clear();
 		schemas.clear();
 		elementProperties.clear();
-
+		
 		if (!parseXMLTXMFile(xmlTXMFile)) return null; // fill unites, relations, schemas and elementProperties
-
-		//		if (unites.size() > 0) System.out.println(unites);
-		//		if (relations.size() > 0) System.out.println(relations);
-		//		if (schemas.size() > 0) System.out.println(schemas);
-		//		if (elementProperties.size() > 0) System.out.println(elementProperties);
-		//		for (String u : unites.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
-		//		for (String u : relations.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
-		//		for (String u : schemas.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
-
-
-		CQLQuery textQuery = new CQLQuery("[_.text_id=\""+textid+"\"] expand to text");
+		
+		// if (unites.size() > 0) System.out.println(unites);
+		// if (relations.size() > 0) System.out.println(relations);
+		// if (schemas.size() > 0) System.out.println(schemas);
+		// if (elementProperties.size() > 0) System.out.println(elementProperties);
+		// for (String u : unites.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+		// for (String u : relations.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+		// for (String u : schemas.keySet()) if (!elementProperties.containsKey(u+"-fs")) System.out.println("MISSIGN ELEM PROPERTIES: "+u);
+		
+		CQLQuery textQuery = new CQLQuery("[_.text_id=\"" + textid + "\"] expand to text");
 		Subcorpus textSubCorpus = mainCorpus.createSubcorpus(textQuery, "TXTTMP");
 		textSubCorpus.compute();
-
-		HashSet<String> ids = new HashSet<String>();
+		
+		HashSet<String> ids = new HashSet<>();
 		for (String id : unites.keySet()) {
 			ids.add(unites.get(id)[2]);
 			ids.add(unites.get(id)[3]);
 		}
 		String[] idsArray = ids.toArray(new String[ids.size()]);
 		int[] idsIds = CQI.str2Id(mainCorpus.getProperty("id").getQualifiedName(), idsArray);
-
-		HashMap<String, int[]> id2position = new HashMap<String, int[]>();
-		for (int i = 0 ; i < idsArray.length ; i++) {
+		
+		HashMap<String, int[]> id2position = new HashMap<>();
+		for (int i = 0; i < idsArray.length; i++) {
 			int[] positions = CQI.id2Cpos(mainCorpus.getProperty("id").getQualifiedName(), idsIds[i]);
 			id2position.put(idsArray[i], positions);
 		}
-
+		
 		Structure structure = analecCorpus.getStructure();
 		HashSet<String> unitesStructure = structure.getUnites();
 		HashSet<String> relationsStructure = structure.getRelations();
 		HashSet<String> schemasStructure = structure.getSchemas();
-
+		
 		ConsoleProgressBar cpb = new ConsoleProgressBar(unites.size());
 		for (String id : unites.keySet()) {
 			cpb.tick();
@@ -220,31 +230,35 @@
 			String deb = unites.get(id)[2];
 			String fin = unites.get(id)[3];
 			if (elementProperties.containsKey(ana)) {
-
+				
 				int start = getPosition(textSubCorpus, id2position, deb);
 				int end = getPosition(textSubCorpus, id2position, fin);
-
+				
 				if (start < 0) {
 					nUnitsError++;
 					if (start == -1) {
-						System.out.println("WARNING: no position found word id = "+deb);
+						System.out.println("WARNING: no position found word id = " + deb);
 						nUnitsNoMatchError++;
-					} else {
-						System.out.println("WARNING: too many positions found for word id = "+deb);
+					}
+					else {
+						System.out.println("WARNING: too many positions found for word id = " + deb);
 						nUnitsTooMuchMatchError++;
 					}
-				} else if (end < 0) {
+				}
+				else if (end < 0) {
 					nUnitsError++;
 					if (end == -1) {
-						System.out.println("WARNING: no position found word id = "+fin);
+						System.out.println("WARNING: no position found word id = " + fin);
 						nUnitsNoMatchError++;
-					} else {
-						System.out.println("WARNING: too many positions found for word id = "+fin);
+					}
+					else {
+						System.out.println("WARNING: too many positions found for word id = " + fin);
 						nUnitsTooMuchMatchError++;
 					}
-				} else { // OK
-
-					//System.out.println("create unite: "+type+" ["+deb+", "+fin+"]");
+				}
+				else { // OK
+					
+					// System.out.println("create unite: "+type+" ["+deb+", "+fin+"]");
 					Unite unite = analecCorpus.addUniteSaisie(type, start, end);
 					HashMap<String, String> props = elementProperties.get(ana);
 					HashSet<String> nomsProps = structure.getNomsProps(Unite.class, type);
@@ -257,12 +271,13 @@
 					unitesRef.put(id, unite);
 					nUnitsAdded++;
 				}
-			} else {
-				System.out.println("Warning no properties found for element id="+id+" and ana="+ana);
 			}
+			else {
+				System.out.println("Warning no properties found for element id=" + id + " and ana=" + ana);
+			}
 		}
 		cpb.done();
-
+		
 		cpb = new ConsoleProgressBar(relations.size());
 		for (String id : relations.keySet()) {
 			cpb.tick();
@@ -272,18 +287,19 @@
 				structure.ajouterType(Relation.class, type);
 			}
 			String target = relations.get(id)[2];
-
+			
 			if (elementProperties.containsKey(ana)) {
-
+				
 				String[] wordsref = target.split(" ");
 				String[] wordsid = new String[wordsref.length];
-				for (int i = 0 ; i < wordsref.length ; i++) wordsid[i] = wordsref[i].substring(1);
+				for (int i = 0; i < wordsref.length; i++)
+					wordsid[i] = wordsref[i].substring(1);
 				try {
 					Unite elt1 = unitesRef.get(wordsid[0]);
 					Unite elt2 = unitesRef.get(wordsid[1]);
 					if (elt1 != null && elt2 != null) {
-						//System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
-
+						// System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
+						
 						Relation relation = analecCorpus.addRelationSaisie(type, elt1, elt2);
 						HashMap<String, String> props = elementProperties.get(ana);
 						HashSet<String> nomsProps = structure.getNomsProps(Relation.class, type);
@@ -294,19 +310,22 @@
 							relation.putProp(prop, props.get(prop));
 						}
 						nRelationsAdded++;
-					} else {
-						System.out.println("ERROR: relation element not found "+Arrays.toString(wordsref));
+					}
+					else {
+						System.out.println("ERROR: relation element not found " + Arrays.toString(wordsref));
 						nRelationsError++;
 					}
-				} catch(Exception e) {
-
 				}
-			} else {
-				System.out.println("Warning no properties found for element id="+id);
+				catch (Exception e) {
+					
+				}
 			}
+			else {
+				System.out.println("Warning no properties found for element id=" + id);
+			}
 		}
 		cpb.done();
-
+		
 		cpb = new ConsoleProgressBar(schemas.size());
 		for (String id : schemas.keySet()) {
 			cpb.tick();
@@ -319,15 +338,16 @@
 			if (elementProperties.containsKey(ana)) {
 				String[] unitsref = target.split(" ");
 				try {
-					//System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
+					// System.out.println("create relation: "+type+" ["+deb+", "+fin+"]");
 					Schema schema = new Schema(type);
 					for (String unitid : unitsref) {
 						unitid = unitid.substring(1); // remove '#'
 						if (unitesRef.containsKey(unitid)) {
 							Unite unite = unitesRef.get(unitid);
 							schema.ajouter(unite);
-						} else {
-							System.out.println("Warning: missing unit id: "+unitid);
+						}
+						else {
+							System.out.println("Warning: missing unit id: " + unitid);
 							nSchemaError++;
 						}
 					}
@@ -341,177 +361,201 @@
 						schema.putProp(prop, props.get(prop));
 					}
 					nSchemaAdded++;
-				} catch(Exception e) {
-					System.out.println("Error while creating schema with id="+id);
 				}
-			} else {
-				System.out.println("Warning no properties found for element id="+id);
+				catch (Exception e) {
+					System.out.println("Error while creating schema with id=" + id);
+				}
 			}
+			else {
+				System.out.println("Warning no properties found for element id=" + id);
+			}
 		}
 		cpb.done();
-
+		
 		textSubCorpus.delete();
 		return Arrays.asList(nUnitsAdded, nUnitsError, nUnitsNoMatchError, nUnitsTooMuchMatchError,
 				nRelationsAdded, nRelationsError,
 				nSchemaAdded, nSchemaError);
 	}
-
+	
 	private boolean parseXMLTXMFile(File xmlTXMFile) throws XMLStreamException, MalformedURLException, IOException {
 		InputStream inputData = xmlTXMFile.toURI().toURL().openStream();
 		factory = XMLInputFactory.newInstance();
 		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
-
+		
 		String currentType = null;
 		String currentN = null;
 		String currentAna = null;
 		String currentName = null;
 		String currentPropValue = null;
-
+		
 		int processMode = 0; // 0 nothing, 1 elements 2 properties
-
+		
 		if (!goToStandOff(parser)) {
-			System.out.println("Error: cannot find the 'standOff' element in "+xmlTXMFile);
+			System.out.println("Error: cannot find the 'standOff' element in " + xmlTXMFile);
 			return false;
 		}
 		String localname = null;
 		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 			switch (event) {
-			case XMLStreamConstants.START_ELEMENT:
-				localname = parser.getLocalName();
-
-				if (localname.equals("annotationGrp")) {
-					currentType = parser.getAttributeValue(null, "type");
-					currentN = parser.getAttributeValue(null, "subtype");
-					if (currentType != null && currentN != null) {
-						processMode = 1;
-					} else {
-						System.out.println("Warning found "+localname+" without 'type' and 'n' attribute");
+				case XMLStreamConstants.START_ELEMENT:
+					localname = parser.getLocalName();
+					
+					if (localname.equals("annotationGrp")) {
+						currentType = parser.getAttributeValue(null, "type");
+						currentN = parser.getAttributeValue(null, "subtype");
+						if (currentType != null && currentN != null) {
+							processMode = 1;
+						}
+						else {
+							System.out.println("Warning found " + localname + " without 'type' and 'n' attribute");
+							processMode = 0;
+						}
+					}
+					else if (localname.equals("div")) {
+						String type = parser.getAttributeValue(null, "type");
+						if (type == null) type = "";
+						if (type.endsWith("-fs"))
+							processMode = 2;
+					}
+					
+					if (processMode == 1) {
+						if (localname.equals("span") || localname.equals("link")) {
+							String id = parser.getAttributeValue(null, "id");
+							String ana = parser.getAttributeValue(null, "ana");
+							// System.out.println("SPAN id="+id +" ana="+ana+" currentType="+currentType+" currentN="+currentN);
+							if ("Unit".equals(currentType)) {
+								String from = parser.getAttributeValue(null, "from");
+								String to = parser.getAttributeValue(null, "to");
+								registerUnite(id, ana, currentN, from, to);
+							}
+							else if ("Relation".equals(currentType)) {
+								String target = parser.getAttributeValue(null, "target");
+								registerRelation(id, ana, currentN, target);
+							}
+							else if ("Schema".equals(currentType)) {
+								String target = parser.getAttributeValue(null, "target");
+								registerSchema(id, ana, currentN, target);
+							}
+						}
+					}
+					else if (processMode == 2) {
+						if (localname.equals("fs")) {
+							currentAna = parser.getAttributeValue(null, "id");
+							if (elementProperties.get(currentAna) != null) System.out.println("WARNING: duplicated element properties: " + currentAna);
+							elementProperties.put(currentAna, new HashMap<String, String>());
+						}
+						else if (localname.equals("f")) {
+							currentName = parser.getAttributeValue(null, "name");
+							currentPropValue = "";
+						}
+					}
+					else {
+						// nothing to do
+					}
+					
+					break;
+				case XMLStreamConstants.CHARACTERS:
+					if (processMode == 2 && currentAna != null && currentName != null) {
+						currentPropValue += parser.getText();
+					}
+					break;
+				case XMLStreamConstants.END_ELEMENT:
+					localname = parser.getLocalName();
+					if (localname.equals("standOff")) { // stop all
+						parser.close();
+						inputData.close();
+						return true;
+					}
+					else if (processMode == 1 && localname.equals("annotationGrp")) { // stop all
+						currentType = null;
+						currentN = null;
 						processMode = 0;
 					}
-				} else if (localname.equals("div")) {
-					String type = parser.getAttributeValue(null, "type");
-					if (type == null) type = "";
-					if (type.endsWith("-fs"))
-						processMode = 2;
-				} 
-
-				if (processMode == 1) {
-					if (localname.equals("span") || localname.equals("link")) {
-						String id = parser.getAttributeValue(null, "id");
-						String ana = parser.getAttributeValue(null, "ana");
-						//System.out.println("SPAN id="+id +" ana="+ana+" currentType="+currentType+" currentN="+currentN);
-						if ("Unit".equals(currentType)) {
-							String from = parser.getAttributeValue(null, "from");
-							String to = parser.getAttributeValue(null, "to");
-							registerUnite(id, ana, currentN, from, to);
-						} else if ("Relation".equals(currentType)) {
-							String target = parser.getAttributeValue(null, "target");
-							registerRelation(id, ana, currentN, target);
-						} else if ("Schema".equals(currentType)) {
-							String target = parser.getAttributeValue(null, "target");
-							registerSchema(id, ana, currentN, target);
+					else if (processMode == 2 && localname.equals("div")) {
+						processMode = 0;
+					}
+					
+					if (processMode == 1) {
+						
+					}
+					else if (processMode == 2) {
+						if (localname.equals("fs")) {
+							currentAna = null;
 						}
+						else if (localname.equals("f")) {
+							if (currentName != null && currentAna != null) {
+								elementProperties.get(currentAna).put(currentName, currentPropValue);
+							}
+							currentName = null;
+						}
 					}
-				} else if (processMode == 2) {
-					if (localname.equals("fs")) {
-						currentAna = parser.getAttributeValue(null, "id");
-						if (elementProperties.get(currentAna) != null) System.out.println("WARNING: duplicated element properties: "+currentAna);
-						elementProperties.put(currentAna, new HashMap<String, String>());
-					} else if (localname.equals("f")) {
-						currentName= parser.getAttributeValue(null, "name");
-						currentPropValue = "";
+					else {
+						// nothing to do
 					}
-				} else {
-					// nothing to do
-				} 
-
-				break;		
-			case XMLStreamConstants.CHARACTERS:
-				if (processMode == 2 && currentAna != null && currentName != null) {
-					currentPropValue += parser.getText();
-				}
-				break;
-			case XMLStreamConstants.END_ELEMENT:
-				localname = parser.getLocalName();
-				if (localname.equals("standOff")) { // stop all
+					
+					break;
+				
+				case XMLStreamConstants.END_DOCUMENT:
 					parser.close();
 					inputData.close();
-					return true;
-				} else if (processMode == 1 && localname.equals("annotationGrp")) { // stop all
-					currentType = null;
-					currentN = null;
-					processMode = 0;
-				} else if (processMode == 2 && localname.equals("div")) {
-					processMode = 0;
-				}
-
-				if (processMode == 1) {
-
-				} else if (processMode == 2) {
-					if (localname.equals("fs")) {
-						currentAna = null;
-					} else if (localname.equals("f")) {
-						if (currentName != null && currentAna != null) {
-							elementProperties.get(currentAna).put(currentName, currentPropValue);
-						}
-						currentName = null;
-					}
-				} else {
-					// nothing to do
-				}
-
-				break;
-
-			case XMLStreamConstants.END_DOCUMENT:
-				parser.close();
-				inputData.close();
-				return false;
+					return false;
 			}
 		}
 		parser.close();
 		inputData.close();
-
+		
 		return false; // standOff not found
 	}
-
-	HashMap<String, HashMap<String, String>> elementProperties = new HashMap<String, HashMap<String, String>>();
-	HashMap<String, String[]> unites = new HashMap<String, String[]>(); // id -> {ana, type, from, to}
-	HashMap<String, Unite> unitesRef = new HashMap<String, Unite>(); // id -> Unite
+	
+	HashMap<String, HashMap<String, String>> elementProperties = new HashMap<>();
+	
+	HashMap<String, String[]> unites = new HashMap<>(); // id -> {ana, type, from, to}
+	
+	HashMap<String, Unite> unitesRef = new HashMap<>(); // id -> Unite
+	
 	private void registerUnite(String id, String ana, String type, String from, String to) {
-		String[] data = {ana.substring(1), type, from.substring(5), to.substring(5)};
+		String[] data = { ana.substring(1), type, from.substring(5), to.substring(5) };
 		if (unites.containsKey(id)) {
-			System.out.println("Warning: duplicated Unite id: "+id);
-		} else {
+			System.out.println("Warning: duplicated Unite id: " + id);
+		}
+		else {
 			unites.put(id, data);
 		}
 	}
-	HashMap<String, String[]> relations = new HashMap<String, String[]>(); // id -> {ana, type, target}
+	
+	HashMap<String, String[]> relations = new HashMap<>(); // id -> {ana, type, target}
+	
 	private void registerRelation(String id, String ana, String type, String target) {
-		String[] data = {ana.substring(1), type, target};
+		String[] data = { ana.substring(1), type, target };
 		if (relations.containsKey(id)) {
-			System.out.println("Warning: duplicated Relation id: "+id);
-		} else {
+			System.out.println("Warning: duplicated Relation id: " + id);
+		}
+		else {
 			relations.put(id, data);
 		}
 	}
-	HashMap<String, String[]> schemas = new HashMap<String, String[]>(); // id -> {ana, type, target}
+	
+	HashMap<String, String[]> schemas = new HashMap<>(); // id -> {ana, type, target}
+	
 	private void registerSchema(String id, String ana, String type, String target) {
-		String[] data = {ana.substring(1), type, target};
-		//System.out.println("R schema: "+id+" : "+Arrays.toString(data));
+		String[] data = { ana.substring(1), type, target };
+		// System.out.println("R schema: "+id+" : "+Arrays.toString(data));
 		if (schemas.containsKey(id)) {
-			System.out.println("Warning: duplicated Schema id: "+id);
-		} else {
+			System.out.println("Warning: duplicated Schema id: " + id);
+		}
+		else {
 			schemas.put(id, data);
 		}
 	}
-
+	
 	private boolean goToStandOff(XMLStreamReader parser) throws XMLStreamException {
 		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 			switch (event) {
-			case XMLStreamConstants.START_ELEMENT:
-				String localname = parser.getLocalName();
-				if (localname.equals("standOff")) return true;
-				break;		
+				case XMLStreamConstants.START_ELEMENT:
+					String localname = parser.getLocalName();
+					if (localname.equals("standOff")) return true;
+					break;
 			}
 		}
 		return false;
Index: tmp/org.txm.core/src/java/org/txm/importer/SAttributesListener.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/importer/SAttributesListener.java	(revision 3014)
+++ tmp/org.txm.core/src/java/org/txm/importer/SAttributesListener.java	(revision 3015)
@@ -20,153 +20,164 @@
  *
  */
 public class SAttributesListener {
-
-	public HashMap<String,HashSet<String>> structs = new HashMap<String, HashSet<String>>();
-	public HashSet<String> anatypes = new HashSet<String>();
-	public HashMap<String, Integer> structsCountProf = new HashMap<String, Integer>();
-	public HashMap<String, Integer> structsMaxProf = new HashMap<String, Integer>();
+	
+	public HashMap<String, HashSet<String>> structs = new HashMap<>();
+	
+	public HashSet<String> anatypes = new HashSet<>();
+	
+	public HashMap<String, Integer> structsCountProf = new HashMap<>();
+	
+	public HashMap<String, Integer> structsMaxProf = new HashMap<>();
+	
 	private String structPath = "/";
+	
 	private XMLStreamReader parser;
-
+	
 	SAttributesListener() {
-		structs = new HashMap<String, HashSet<String>>();
-		structsCountProf = new HashMap<String, Integer>();
-		structsMaxProf = new HashMap<String, Integer>();
+		structs = new HashMap<>();
+		structsCountProf = new HashMap<>();
+		structsMaxProf = new HashMap<>();
 		structPath = "/";
-		anatypes = new HashSet<String>(); // store scanned word attributes
+		anatypes = new HashSet<>(); // store scanned word attributes
 	}
-
+	
 	SAttributesListener(XMLStreamReader parser) {
 		this();
 		this.parser = parser;
 	}
-
+	
 	public void appendResultsTo(SAttributesListener another) {
 		structs = another.structs;
 		structsCountProf = another.structsCountProf;
 		structsMaxProf = another.structsMaxProf;
 		anatypes = another.anatypes; // store scanned word attributes
 	}
-
+	
 	public void start(XMLStreamReader parser) {
 		this.parser = parser;
 	}
-
+	
 	String W = "w";
+	
 	String ANA = "ana";
+	
 	String FORM = "form";
+	
 	/**
 	 * Call this method for each START_ELEMENT stax event
+	 * 
 	 * @param localname the element localname
 	 */
 	public void startElement(String localname) {
 		localname = localname.toLowerCase();
-
-		//String localname = parser.getLocalName();
-		if(localname.equals(W)) return;
-		if(localname.equals(ANA)) return;
-		if(localname.equals(FORM)) return;
-
-		structPath += localname+"/";
-		//println "add: "+structPath
+		
+		// String localname = parser.getLocalName();
+		if (localname.equals(W)) return;
+		if (localname.equals(ANA)) return;
+		if (localname.equals(FORM)) return;
+		
+		structPath += localname + "/";
+		// println "add: "+structPath
 		HashSet<String> attrs = structs.get(localname);
 		if (!structs.containsKey(localname)) {
-			attrs = new HashSet<String>();
+			attrs = new HashSet<>();
 			structs.put(localname, attrs);
 			structsCountProf.put(localname, 0);
 			structsMaxProf.put(localname, 0);
-		} //else {
-
+		} // else {
+		
 		// get structure recursion
-		int prof = structsCountProf.get(localname)+1;
+		int prof = structsCountProf.get(localname) + 1;
 		structsCountProf.put(localname, prof);
 		if (structsMaxProf.get(localname) < prof) {
 			structsMaxProf.put(localname, prof);
 		}
-
+		
 		// get the structure attributes
-		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
+		for (int i = 0; i < parser.getAttributeCount(); i++) {
 			attrs.add(parser.getAttributeLocalName(i).toLowerCase());
 		}
 	}
-
+	
 	/**
 	 * Call this method for each END_ELEMENT stax event
+	 * 
 	 * @param localname the element localname
 	 */
 	public void endElement(String localname) {
 		localname = localname.toLowerCase();
-		//String localname = parser.getLocalName();
-		if(localname.equals(W)) return;
-		if(localname.equals(ANA)) return;
-		if(localname.equals(FORM)) return;
-
+		// String localname = parser.getLocalName();
+		if (localname.equals(W)) return;
+		if (localname.equals(ANA)) return;
+		if (localname.equals(FORM)) return;
+		
 		if (structPath.length() > 1) {
 			int idx = structPath.lastIndexOf("/");
 			if (idx > 0) {
 				structPath = structPath.substring(0, idx);
-				//println "end of $localname "+(structsCountProf.get(localname))
-				//if (structsCountProf.get(localname) != null)
-				structsCountProf.put(localname, structsCountProf.get(localname)-1);
+				// println "end of $localname "+(structsCountProf.get(localname))
+				// if (structsCountProf.get(localname) != null)
+				structsCountProf.put(localname, structsCountProf.get(localname) - 1);
 			}
-			//println "pop: "+structPath
+			// println "pop: "+structPath
 		}
 	}
-
-//	boolean firstGetStructs = true;
-	public HashMap<String,HashSet<String>> getStructs() {
-		if (structsCountProf.containsKey("div")) {
-			if (structsCountProf.get("div") > 0)
+	
+	// boolean firstGetStructs = true;
+	public HashMap<String, HashSet<String>> getStructs() {
+		if (structsMaxProf.containsKey("div")) {
+			if (structsMaxProf.get("div") > 0)
 				structs.remove("div1");
-			if (structsCountProf.get("div") > 1)
+			if (structsMaxProf.get("div") > 1)
 				structs.remove("div2");
-			if (structsCountProf.get("div") > 2)
+			if (structsMaxProf.get("div") > 2)
 				structs.remove("div3");
-			if (structsCountProf.get("div") > 3)
+			if (structsMaxProf.get("div") > 3)
 				structs.remove("div4");
-			if (structsCountProf.get("div") > 4)
+			if (structsMaxProf.get("div") > 4)
 				structs.remove("div5");
-			if (structsCountProf.get("div") > 5)
+			if (structsMaxProf.get("div") > 5)
 				structs.remove("div6");
 		}
-//		if (firstGetStructs) {
-//			firstGetStructs = false;
+		// if (firstGetStructs) {
+		// firstGetStructs = false;
 		// fix min&maj names for CQP
-			ArrayList<String> keys = new ArrayList<String>();
-			keys.addAll(structs.keySet());
-			for (String key : keys) {
-				HashSet<String> value = structs.get(key);
-				structs.remove(key);
-				structs.put(key.toLowerCase(), value);
-			}
-//		}
-
+		ArrayList<String> keys = new ArrayList<>();
+		keys.addAll(structs.keySet());
+		for (String key : keys) {
+			HashSet<String> value = structs.get(key);
+			structs.remove(key);
+			structs.put(key.toLowerCase(), value);
+		}
+		// }
+		
 		return structs;
 	}
-
+	
 	boolean firstGetstructsCountProf = true;
+	
 	public HashMap<String, Integer> getProfs() {
-
-		//		if (firstGetstructsCountProf) {
-		//			firstGetstructsCountProf = false;
-		//			def keys = []
-		//			keys.addAll(structsCountProf.keySet());
-		//			for( String key : keys) {
-		//				def value = structsCountProf.get(key);
-		//				structsCountProf.remove(key)
-		//				structsCountProf.put(key.toLowerCase(), value);
-		//			}
-		//		}
-		HashMap<String, Integer> clone = new HashMap<String, Integer>();
+		
+		// if (firstGetstructsCountProf) {
+		// firstGetstructsCountProf = false;
+		// def keys = []
+		// keys.addAll(structsCountProf.keySet());
+		// for( String key : keys) {
+		// def value = structsCountProf.get(key);
+		// structsCountProf.remove(key)
+		// structsCountProf.put(key.toLowerCase(), value);
+		// }
+		// }
+		HashMap<String, Integer> clone = new HashMap<>();
 		for (String key : structsMaxProf.keySet()) {
 			if (structsMaxProf.get(key) > 0)
-				clone.put(key, structsMaxProf.get(key)-1);
+				clone.put(key, structsMaxProf.get(key) - 1);
 			else
 				clone.put(key, 0);
 		}
 		return clone;
 	}
-
+	
 	public void initialize(ArrayList<String> pattributes, HashMap<String, HashSet<String>> sAttributesMap, HashMap<String, Integer> sAttributesProfs) {
 		this.anatypes.addAll(pattributes);
 		for (String s : sAttributesMap.keySet()) {
@@ -179,65 +190,67 @@
 	public HashSet<String> getAnatypes() {
 		return anatypes;
 	}
-
-//	public SAttributesListener scanFile(File xmlFile) throws MalformedURLException, IOException, XMLStreamException {
-//		return scanFile(xmlFile, this);
-//	}
-
+	
+	// public SAttributesListener scanFile(File xmlFile) throws MalformedURLException, IOException, XMLStreamException {
+	// return scanFile(xmlFile, this);
+	// }
+	
 	public void setParser(XMLStreamReader parser) {
 		this.parser = parser;
 	}
-
+	
 	/**
 	 * Merge results in the parentListener
 	 * 
 	 * @param xmlFile
 	 * @param parentListener results are appended to the parentListener if any
 	 * @return
-	 * @throws IOException 
-	 * @throws MalformedURLException 
-	 * @throws XMLStreamException 
+	 * @throws IOException
+	 * @throws MalformedURLException
+	 * @throws XMLStreamException
 	 */
 	public SAttributesListener scanFile(File xmlFile) throws MalformedURLException, IOException, XMLStreamException {
-
+		
 		boolean startText = false;
 		boolean startWord = false;
 		InputStream inputData = xmlFile.toURI().toURL().openStream();
 		XMLInputFactory factory = XMLInputFactory.newInstance();
 		XMLStreamReader parser = factory.createXMLStreamReader(inputData);
-
-//		SAttributesListener listener;
-//		if (parentListener != null) {
-//			listener = parentListener;
-//			listener.setParser(parser);
-//		} else {
-//			listener = new SAttributesListener(parser);
-//		}
+		
+		// SAttributesListener listener;
+		// if (parentListener != null) {
+		// listener = parentListener;
+		// listener.setParser(parser);
+		// } else {
+		// listener = new SAttributesListener(parser);
+		// }
 		String TEXT = "text";
 		String ANA = "ana";
 		String TYPE = "type";
-		//HashSet<String> types = new HashSet<String>();
+		// HashSet<String> types = new HashSet<String>();
 		this.setParser(parser);
 		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 			if (event == XMLStreamConstants.START_ELEMENT) { // start elem
 				if (TEXT.equals(parser.getLocalName())) startText = true;
-
+				
 				if (startText) this.startElement(parser.getLocalName());
-
+				
 				if (this.W.equals(parser.getLocalName())) {
 					startWord = true;
-				} else if (startWord && ANA.equals(parser.getLocalName())) { // ana elem
-					for (int i = 0 ; i < parser.getAttributeCount(); i++) { // find @type
+				}
+				else if (startWord && ANA.equals(parser.getLocalName())) { // ana elem
+					for (int i = 0; i < parser.getAttributeCount(); i++) { // find @type
 						if (TYPE.equals(parser.getAttributeLocalName(i))) { // @type
-							this.anatypes.add(parser.getAttributeValue(i).substring(1)); //remove the #
+							this.anatypes.add(parser.getAttributeValue(i).substring(1)); // remove the #
 							break;
 						}
 					}
 				}
-			} else if (event == XMLStreamConstants.END_ELEMENT) { // end elem
+			}
+			else if (event == XMLStreamConstants.END_ELEMENT) { // end elem
 				if (startText) this.endElement(parser.getLocalName());
 				if (TEXT.equals(parser.getLocalName())) startText = false;
-
+				
 				if (this.W.equals(parser.getLocalName())) {
 					startWord = false;
 				}
@@ -245,18 +258,19 @@
 		}
 		if (parser != null) parser.close();
 		if (inputData != null) inputData.close();
-
+		
 		return this;
 	}
-
+	
 	/**
 	 * scan the XML files of a directory to list the structures with their properties and levels. Also list the word properties
+	 * 
 	 * @param xmlDirectory
 	 * @param wordTag
 	 * @return
-	 * @throws XMLStreamException 
-	 * @throws IOException 
-	 * @throws MalformedURLException 
+	 * @throws XMLStreamException
+	 * @throws IOException
+	 * @throws MalformedURLException
 	 */
 	public static SAttributesListener scanFiles(File xmlDirectory, String wordTag) throws MalformedURLException, IOException, XMLStreamException {
 		SAttributesListener listener = new SAttributesListener();
@@ -264,13 +278,13 @@
 		for (File xmlFile : xmlDirectory.listFiles(IOUtils.HIDDENFILE_FILTER)) {
 			if (xmlFile.isFile() && !xmlFile.isHidden() && xmlFile.getName().toLowerCase().endsWith(".xml")) {
 				listener.scanFile(xmlFile); // results saved in 'listener' data
-				//				println "LISTENER RESULT with ${xmlFile.getName()}: "+listener
-				//				println " prof: "+listener.getStructs()
-				//				println " prof: "+listener.getProfs()
-				//				println " path: "+listener.structPath
+				// println "LISTENER RESULT with ${xmlFile.getName()}: "+listener
+				// println " prof: "+listener.getStructs()
+				// println " prof: "+listener.getProfs()
+				// println " path: "+listener.structPath
 			}
 		}
-
+		
 		return listener;
 	}
 }
