Index: tmp/org.txm.groovy.core/src/groovy/org/txm/macro/export/ExportTextContentMacro.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/macro/export/ExportTextContentMacro.groovy	(revision 2923)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/macro/export/ExportTextContentMacro.groovy	(revision 2924)
@@ -1,3 +1,6 @@
+// Copyright © 2020 ENS de Lyon, CNRS, University of Franche-Comté
+// @author mdecorde
+
 // STANDARD DECLARATIONS
 package org.txm.macro.export
 
@@ -11,19 +14,17 @@
 import groovy.transform.Field
 import org.txm.rcp.swt.widget.parameters.*
 
-println "corpora selection: "+corpusViewSelection
-
 if (!(corpusViewSelection instanceof CQPCorpus)) {
 	println "Please select a corpus"
-	return;
+	return
 }
 
 // PARAMETERS
 
-@Field @Option(name="exportDirectory", usage="Result directory ", widget="Folder", required=true, def="export")
+@Field @Option(name="exportDirectory", usage="results directory", widget="Folder", required=true, def="export")
 File exportDirectory
 
-@Field @Option(name="lineSeparatorStructureName", usage="line separator structure", widget="String", required=false, def="p")
+@Field @Option(name="lineSeparatorStructureName", usage="name of the structure to use to produce the output lines", widget="String", required=false, def="p")
 def lineSeparatorStructureName
 
 if (!ParametersDialog.open(this)) return
@@ -32,50 +33,60 @@
 
 if (!exportDirectory.exists()) exportDirectory.mkdirs()
 
-CQPCorpus corpus = corpusViewSelection
-CQI = CQPSearchEngine.getCqiClient();
+def corpus = corpusViewSelection
+def CQI = CQPSearchEngine.getCqiClient()
 
 def lineSeparatorStructure = corpus.getStructuralUnit(lineSeparatorStructureName)
 
 if (lineSeparatorStructure == null) {
-	println "The $lineSeparatorStructureName structure does not exists in the $corpus corpus"
-	return;
+	println "** The $lineSeparatorStructureName structure does not exist in the $corpus corpus"
+	return
 }
 
 def breaks_pos = Arrays.asList(corpus.query(new CQLQuery("[]</"+lineSeparatorStructureName+">"),"test", false).getEnds())
-println breaks_pos
+println "End of structure positions = "+breaks_pos
 
-println "Exporting $corpus text content to $exportDirectory"
+println "Exporting $corpus text content to $exportDirectory..."
 
 def wordProperty = corpus.getWordProperty()
 def textidProperty = corpus.getStructuralUnit("text").getProperty("id")
-def textStartBoundaries = corpus.getTextStartLimits();
-def textEndBoundaries = corpus.getTextEndLimits();
+def textStartBoundaries = corpus.getTextStartLimits()
+def textEndBoundaries = corpus.getTextEndLimits()
 int[] struct_pos = CQI.cpos2Struc(textidProperty.getQualifiedName(), textStartBoundaries)
 String[] textids =  CQI.struc2Str(textidProperty.getQualifiedName(), struct_pos)
-println ""+textStartBoundaries.size()+" texts"
+if (textStartBoundaries.size() == 1) {
+	println "1 text"
+	} else {
+	println ""+textStartBoundaries.size()+" texts"
+}
 
 for (int i = 0 ; i < textStartBoundaries.size() ; i++) {
-	int start = textStartBoundaries[i];
+	int start = textStartBoundaries[i]
 	int end = textEndBoundaries[i]
 
 	File txtFile = new File(exportDirectory, textids[i]+".txt")
-	print ".."
+	print "."
 	def writer = txtFile.newWriter("UTF-8")
 	int[] positions = new int[end - start + 1]
-	int c = 0;
+	int c = 0
 	for (int p : start..end) {
 		positions[c++] = p
 	}
 	int[] idx = CQI.cpos2Id(wordProperty.getQualifiedName(), positions)
 	def words = CQI.id2Str(wordProperty.getQualifiedName(), idx)
+	def tmp = []
 	for (int j = 0 ; j < positions.length ; j++) {
 		int p = positions[j]
-		if (breaks_pos.contains(p)) words[j] = words[j] +"\n" 
+		tmp << words[j]
+		if (breaks_pos.contains(p)) {
+			writer.println LangFormater.format(tmp.join(" "), corpus.getLang())
+			tmp = []
+		} 
 	}
-	writer.println LangFormater.format(StringUtils.join(words, " "),
-				corpus.getLang());
-	writer.close();
+	if (tmp.size() > 0) {
+		writer.println LangFormater.format(tmp.join(" "), corpus.getLang())
+	} 
+	writer.close()
 }  
 
 println "\nDone, result saved in "+exportDirectory.getAbsolutePath()
\ No newline at end of file
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 2923)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZDefaultPagerStep.groovy	(revision 2924)
@@ -12,78 +12,78 @@
 import org.txm.importer.xtz.*
 
 public class XTZDefaultPagerStep {
-
+	
 	List<String> NoSpaceBefore;
-
+	
 	/** The No space after. */
 	List<String> NoSpaceAfter;
-
+	
 	/** The wordcount. */
 	int wordcount = 0;
-
+	
 	/** The pagecount. */
 	int pagecount = 0;
-
+	
 	/** The wordmax. */
 	int wordmax = 0;
-
+	
 	/** The basename. */
 	String basename = "";
 	String txtname = "";
 	File outdir;
-
+	
 	/** The wordid. */
 	String wordid;
-
+	
 	/** The first word. */
 	boolean firstWord = true;
-
+	
 	/** The wordvalue. */
 	String wordvalue = "";
-
+	
 	/** The interpvalue. */
 	String interpvalue = "";
-
+	
 	/** The lastword. */
 	String lastword = " ";
-
+	
 	/** The wordtype. */
 	String wordtype;
-
+	
 	/** The flagform. */
 	boolean flagform = false;
-
+	
 	/** The flaginterp. */
 	boolean flaginterp = false;
-
+	
 	/** The url. */
 	private def url;
-
+	
 	/** The input data. */
 	private def inputData;
-
+	
 	/** The factory. */
 	private def factory;
-
+	
 	/** The parser. */
 	private XMLStreamReader parser;
-
+	
 	/** The writer. */
 	OutputStreamWriter writer;
-
+	
 	/** The pagedWriter. */
 	StaxStackWriter pagedWriter = null;
-
+	
 	/** The infile. */
 	File infile;
-
+	
 	/** The outfile. */
 	File outfile;
-
+	
 	/** The pages. */
 	//TODO enhance this to store the page name/id as well
 	ArrayList<File> pages = new ArrayList<File>();
-
+	
 	/** The idxstart. */
 	ArrayList<String> idxstart = new ArrayList<String>();
 	String paginationElement;
@@ -92,7 +92,7 @@
 	def noteElements = new HashSet<String>();
 	def outOfTextElements = new HashSet<String>();
 	XTZPager pager;
-
+	
 	/**
 	 * Instantiates a new pager.
 	 *
@@ -118,20 +118,20 @@
 		this.infile = infile;
 		this.wordTag= pager.wordTag;
 		outdir.mkdirs()
-
+		
 		inputData = new BufferedInputStream(url.openStream());
 		factory = XMLInputFactory.newInstance();
 		parser = factory.createXMLStreamReader(inputData);
-
+		
 		String notesListString = pager.getImportModule().getProject().getTextualPlan("Note")
 		if (notesListString != null) for (def s : notesListString.split(",")) noteElements << s;
-
+		
 		String elems = pager.getImportModule().getProject().getTextualPlan("OutSideTextTagsAndKeepContent")
 		if (elems != null) for (def s : elems.split(",")) outOfTextElements << s;
-
+		
 		//process();
 	}
-
+	
 	public String getAttributeValue(def parser, String ns, String name) {
 		for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
 			if (name == parser.getAttributeLocalName(i)) {
@@ -140,15 +140,15 @@
 		}
 		return "";
 	}
-
+	
 	private def closeMultiWriter() {
 		if (pagedWriter != null) {
 			def tags = pagedWriter.getTagStack().clone();
-//			println "STACK="+pagedWriter.getTagStack()
-//			def stack = Thread.currentThread().getStackTrace();
-//			int m = Math.min(15, stack.size()-1)
-//			for (def s : stack[1..m]) println s
-//			println "FILE ="+outfile
+			//			println "STACK="+pagedWriter.getTagStack()
+			//			def stack = Thread.currentThread().getStackTrace();
+			//			int m = Math.min(15, stack.size()-1)
+			//			for (def s : stack[1..m]) println s
+			//			println "FILE ="+outfile
 			if (firstWord) { // there was no words
 				pagedWriter.writeCharacters("");
 				this.idxstart.add("${wordTag}_0")
@@ -174,26 +174,26 @@
 				}
 				notes.clear()
 			}
-
+			
 			pagedWriter.close();
 			
-//			println "STACK TO REWRITE: $tags"
+			//			println "STACK TO REWRITE: $tags"
 			for (int i = 0 ; i < tags.size() ; i++) {
 				String tag = tags.remove(0)
 				i--
-//				println "	tag=$tag"
+				//				println "	tag=$tag"
 				if (tag == "div") {
 					break; // remove elements until first "div" tag
 				}
 			}
-//			println "STACK TO REWRITE2: $tags"
+			//			println "STACK TO REWRITE2: $tags"
 			
 			return tags;
 		} else {
 			return [];
 		}
 	}
-
+	
 	/**
 	 * Creates the next output.
 	 *
@@ -207,9 +207,9 @@
 			outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
 			pages.add(outfile)
 			firstWord = true; // waiting for next word
-
+			
 			pagedWriter = new StaxStackWriter(outfile, "UTF-8")
-
+			
 			//pagedWriter.writeStartDocument()
 			pagedWriter.writeDTD("<!DOCTYPE html>")
 			pagedWriter.writeCharacters("\n")
@@ -227,7 +227,7 @@
 			pagedWriter.writeCharacters("\n")
 			pagedWriter.writeStartElement("body") //<body>
 			pagedWriter.writeStartElement("div", ["class": "txmeditionpage"]) //<div>
-//			println "OPENING: $tags"
+			//			println "OPENING: $tags"
 			pagedWriter.writeStartElements(tags)
 			return true;
 		} catch (Exception e) {
@@ -236,7 +236,7 @@
 			return false;
 		}
 	}
-
+	
 	/**
 	 * Creates the output.
 	 *
@@ -251,7 +251,7 @@
 			return false;
 		}
 	}
-
+	
 	/**
 	 * Gets the page files.
 	 *
@@ -260,7 +260,7 @@
 	public ArrayList<File> getPageFiles() {
 		return pages;
 	}
-
+	
 	/**
 	 * Gets the idx.
 	 *
@@ -269,7 +269,7 @@
 	public ArrayList<String> getIdx() {
 		return idxstart;
 	}
-
+	
 	/**
 	 * Go to text.
 	 */
@@ -280,7 +280,7 @@
 					return;
 		}
 	}
-
+	
 	def notes = []
 	def currentOutOfTextElements = [] // stack of element with out of text to edit opened element
 	def writeOutOfTextToEditText = false
@@ -288,18 +288,18 @@
 	 * Process.
 	 */
 	public boolean process() {
-
+		
 		try {
 			boolean flagNote = false;
 			String noteContent = "";
 			String rend = ""
 			goToText();
-
+			
 			String localname = "";
 			if (!createNextOutput()) {
 				return false;
 			}
-
+			
 			for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
 				rend = "";
 				switch (event) {
@@ -311,7 +311,7 @@
 						} else if (currentOutOfTextElements.size() > 0) {
 							currentOutOfTextElements << localname
 						}
-
+					
 						if (localname == paginationElement) {
 							createNextOutput()
 							wordcount=0;
@@ -320,29 +320,29 @@
 								pagedWriter.writeElement("p", ["class":"txmeditionpb", "align":"center"], getAttributeValue(parser, null,"n"))
 							}
 						}
-
+					
 						rend = getAttributeValue(parser, null, "rend")
 						if (rend == null) rend = "";
-						
+					
 						switch (localname) {
 							case "text":
 								LinkedHashMap attributes = new LinkedHashMap();
 								for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
 									attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i).toString()
 								}
-
+							
 								pagedWriter.write("\n")
 								pagedWriter.writeStartElement("p")
 								pagedWriter.writeAttribute("class", rend)
 								if (attributes.containsKey("id")) {
 									pagedWriter.writeElement("h3", attributes["id"])
 								}
-
+							
 								pagedWriter.writeStartElement("table")
 								for (String k : attributes.keySet()) {
 									if (k == "id") continue;
 									if (k == "rend") continue;
-
+									
 									pagedWriter.writeStartElement("tr")
 									pagedWriter.writeElement("td", k)
 									pagedWriter.writeElement("td", attributes[k])
@@ -414,17 +414,23 @@
 								break;
 							case "sp":
 								pagedWriter.writeStartElement("p", ["class":"turn"])
-								pagedWriter.writeStartElement("span")
-								pagedWriter.writeAttribute("class", "spk")
-								pagedWriter.writeCharacters(parser.getAttributeValue(null,"speaker")+": ")
-								pagedWriter.writeEndElement() // span@class=spk
+							
+								if (parser.getAttributeValue(null,"speaker") != null) {
+									pagedWriter.writeStartElement("span")
+									pagedWriter.writeAttribute("class", "spk")
+									pagedWriter.writeCharacters(parser.getAttributeValue(null,"speaker")+": ")
+									pagedWriter.writeEndElement() // span@class=spk
+								}
+							
 								break;
 							case "u":
-								//pagedWriter.writeStartElement("p", ["class":"u"])
-								pagedWriter.writeStartElement("span")
-								pagedWriter.writeAttribute("class", "sync")
-								pagedWriter.writeCharacters(parser.getAttributeValue(null,"time"))
-								//pagedWriter.writeEndElement(); // span@class=spk
+							//pagedWriter.writeStartElement("p", ["class":"u"])
+								if (parser.getAttributeValue(null,"time") != null) {
+									pagedWriter.writeStartElement("span")
+									pagedWriter.writeAttribute("class", "sync")
+									pagedWriter.writeCharacters(parser.getAttributeValue(null,"time"))
+								}
+							//pagedWriter.writeEndElement(); // span@class=spk
 								break;
 							case "div":
 							case "div1":
@@ -440,17 +446,17 @@
 								break;
 							case wordTag:
 								wordid = getAttributeValue(parser, null,"id");
-
+							
 								wordcount++;
 								if (wordcount >= wordmax) {
 									createNextOutput();
 								}
-
+							
 								if (firstWord) {
 									firstWord = false;
 									this.idxstart.add(wordid);
 								}
-
+							
 								break;
 							case "ana":
 								flaginterp=true;
@@ -476,7 +482,7 @@
 						localname = parser.getLocalName();
 						if (currentOutOfTextElements.size() > 0) currentOutOfTextElements.pop()
 						writeOutOfTextToEditText = currentOutOfTextElements.size() > 0
-
+					
 						switch (localname) {
 							case "text":
 								break;
@@ -541,7 +547,7 @@
 								if (l > 0) {
 									endOfLastWord = lastword.subSequence(l-1, l)
 								}
-								
+							
 								if (interpvalue != null) {
 									interpvalue = interpvalue
 								}
@@ -554,10 +560,10 @@
 									pagedWriter.writeCharacters("\n")
 									pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid])
 								}
-
+							
 								pagedWriter.writeCharacters(wordvalue)
 								pagedWriter.writeEndElement()
-								//pagedWriter.writeComment("\n")
+							//pagedWriter.writeComment("\n")
 								lastword=wordvalue;
 								break;
 							default:
Index: tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 2923)
+++ tmp/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 2924)
@@ -87,10 +87,10 @@
 	File xmlfile;
 	
 	/** The metadatas. */
-	ArrayList<Metadata> metadatas = new ArrayList<Metadata>();
+	ArrayList<Metadata> metadatas = new ArrayList<>();
 	
 	/** The headers list. */
-	ArrayList<String> headersList = new ArrayList<String>();
+	ArrayList<String> headersList = new ArrayList<>();
 	
 	/** The isinialize. */
 	boolean isInitialize = false;
@@ -353,7 +353,7 @@
 	
 	public HashMap<String, String> getTextMetadata(File f) {
 		
-		HashMap<String, String> data = new HashMap<String, String>();
+		HashMap<String, String> data = new HashMap<>();
 		String txtname = f.getName();
 		int idx = txtname.lastIndexOf(".");
 		if (idx > 0) txtname = txtname.substring(0, idx);
@@ -383,153 +383,160 @@
 	 */
 	public static boolean convertCsvToXml(File csvfile, File xmlFile, String encoding, String separator, String txtseparator, int nbheaderline) throws Exception {
 		
-		if (separator == null || separator.length() == 0) {
-			separator = "\t";
-		}
-		if (encoding == null || encoding.length() == 0) {
-			encoding = "UTF-8";
-		}
-		xmlFile.createNewFile();
-		
-		if (!csvfile.exists()) {
-			System.out.println("Error: CSV file does not exists");
-			return false;
-		}
-		
-		XMLOutputFactory factory = XMLOutputFactory.newInstance();
-		FileOutputStream output = new FileOutputStream(xmlFile);
-		XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");// create a new file
-		
-		CsvReader reader = new CsvReader(csvfile.getAbsolutePath(), separator.charAt(0), Charset.forName(encoding));
-		if (txtseparator != null && txtseparator.length() > 0)
-			reader.setTextQualifier(txtseparator.charAt(0));
-		
-		reader.readHeaders();
-		
-		String[] headers = reader.getHeaders();
-		
-		if (headers.length == 0) {
-			System.out.println("Error: No header in the metadata file " + csvfile + " with separators: column='" + separator + "' and text='" + txtseparator + "'");
-			writer.close();
-			output.close();
-			return false;
-		}
-		
-		if (!headers[0].equals("id")) {
-			System.out.println("Error: The first column name in the header line of the metadata file '$csvfile' must be 'id' and found '" + headers[0]
-					+ "' column separator='\"+separator+\"' and text separator='\"+txtseparator+\"'");
-			writer.close();
-			output.close();
-			if (!separator.equals("\t")) {
-				System.out.println("\tTrying with separators: column='\t' and text=''...");
-				return convertCsvToXml(csvfile, xmlFile, encoding, "\t", "", nbheaderline);
+		try {
+			if (separator == null || separator.length() == 0) {
+				separator = "\t";
 			}
-		}
-		
-		// check for double columns
-		HashSet<String> testhash = new HashSet<String>();
-		HashSet<String> doubles = new HashSet<String>();
-		for (String str : headers) {
-			if (testhash.contains(str))
-				doubles.add(str);
-			testhash.add(str);
-		}
-		if (doubles.size() > 0) {
-			System.out.println("Error: the metadata file '$csvfile' contains duplicated column names: " + doubles);
-			return false;
-		}
-		
-		String[] longnames = new String[headers.length];
-		String[] types = new String[headers.length];
-		if (nbheaderline > 1) {// get longnames
-			reader.readRecord();
-			for (int i = 0; i < headers.length; i++) {
-				longnames[i] = reader.get(headers[i]);
+			if (encoding == null || encoding.length() == 0) {
+				encoding = "UTF-8";
 			}
-		}
-		else {
-			for (int i = 0; i < headers.length; i++) {
-				longnames[i] = headers[i];
+			xmlFile.createNewFile();
+			
+			if (!csvfile.exists()) {
+				System.out.println("Error: CSV file does not exists");
+				return false;
 			}
-		}
-		
-		if (nbheaderline > 2) {// got types
-			reader.readRecord();
-			for (int i = 0; i < headers.length; i++) {
-				types[i] = reader.get(headers[i]);
+			
+			XMLOutputFactory factory = XMLOutputFactory.newInstance();
+			FileOutputStream output = new FileOutputStream(xmlFile);
+			XMLStreamWriter writer = factory.createXMLStreamWriter(output, "UTF-8");// create a new file
+			
+			CsvReader reader = new CsvReader(csvfile.getAbsolutePath(), separator.charAt(0), Charset.forName(encoding));
+			if (txtseparator != null && txtseparator.length() > 0)
+				reader.setTextQualifier(txtseparator.charAt(0));
+			
+			reader.readHeaders();
+			
+			String[] headers = reader.getHeaders();
+			
+			if (headers.length == 0) {
+				System.out.println("Error: No header in the metadata file " + csvfile + " with separators: column='" + separator + "' and text='" + txtseparator + "'");
+				writer.close();
+				output.close();
+				return false;
 			}
-		}
-		else {
-			for (int i = 0; i < headers.length; i++) {
-				types[i] = "String";
+			
+			if (!headers[0].equals("id")) {
+				System.out.println("Error: The first column name in the header line of the metadata file '$csvfile' must be 'id' and found '" + headers[0]
+						+ "' column separator='\"+separator+\"' and text separator='\"+txtseparator+\"'");
+				writer.close();
+				output.close();
+				if (!separator.equals("\t")) {
+					System.out.println("\tTrying with separators: column='\t' and text=''...");
+					return convertCsvToXml(csvfile, xmlFile, encoding, "\t", "", nbheaderline);
+				}
 			}
-		}
-		
-		writer.writeStartDocument("UTF-8", "1.0");
-		writer.writeStartElement("enrichissement");
-		writer.writeStartElement("metadatas");
-		writer.writeCharacters("\n");
-		// println "headers : "+Arrays.toString(headers)
-		for (int i = 1; i < headers.length; i++) {
-			if (headers[i].length() == 0) {
-				headers[i] = "noname";
-				System.out.println("Warning: the " + (i + 1) + "th column name is empty");
+			
+			// check for double columns
+			HashSet<String> testhash = new HashSet<>();
+			HashSet<String> doubles = new HashSet<>();
+			for (String str : headers) {
+				if (testhash.contains(str))
+					doubles.add(str);
+				testhash.add(str);
 			}
-			// if(!headers[i].equals("id"))// the first
-			// {
-			writer.writeStartElement("metadata");
-			writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
-			writer.writeAttribute("shortname", headers[i]);
-			writer.writeAttribute("longname", longnames[i]);
-			writer.writeAttribute("type", types[i]);
-			writer.writeAttribute("colwidth", "100");
-			writer.writeAttribute("selection", "true");
-			writer.writeAttribute("partition", "true");
-			writer.writeAttribute("display", "true");
+			if (doubles.size() > 0) {
+				System.out.println("Error: the metadata file '$csvfile' contains duplicated column names: " + doubles);
+				return false;
+			}
 			
-			writer.writeEndElement();
-			writer.writeCharacters("\n");
-			// }
-		}
-		writer.writeEndElement();// close metadatas
-		writer.writeCharacters("\n");
-		
-		writer.writeStartElement("texts");
-		writer.writeCharacters("\n");
-		while (reader.readRecord()) {
-			writer.writeStartElement("text");
-			for (int i = 0; i < headers.length; i++)
-				if (headers[i].equals("id")) {
-					writer.writeAttribute("id", reader.get(headers[i]));
+			String[] longnames = new String[headers.length];
+			String[] types = new String[headers.length];
+			if (nbheaderline > 1) {// get longnames
+				reader.readRecord();
+				for (int i = 0; i < headers.length; i++) {
+					longnames[i] = reader.get(headers[i]);
 				}
-				else if (headers[i].equals("xpath")) {
-					writer.writeAttribute("xpath", reader.get(headers[i]));
+			}
+			else {
+				for (int i = 0; i < headers.length; i++) {
+					longnames[i] = headers[i];
 				}
+			}
 			
-			for (int i = 0; i < headers.length; i++)
-				if (!headers[i].equals("id") && !headers[i].equals("xpath")) {
-					writer.writeEmptyElement("entry");
-					writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
-					String value = reader.get(headers[i]);
-					if (value.length() == 0)
-						writer.writeAttribute("value", "N/A");
-					else
-						writer.writeAttribute("value", value);
-					
+			if (nbheaderline > 2) {// got types
+				reader.readRecord();
+				for (int i = 0; i < headers.length; i++) {
+					types[i] = reader.get(headers[i]);
 				}
-			writer.writeEndElement();
+			}
+			else {
+				for (int i = 0; i < headers.length; i++) {
+					types[i] = "String";
+				}
+			}
+			
+			writer.writeStartDocument("UTF-8", "1.0");
+			writer.writeStartElement("enrichissement");
+			writer.writeStartElement("metadatas");
 			writer.writeCharacters("\n");
+			// println "headers : "+Arrays.toString(headers)
+			for (int i = 1; i < headers.length; i++) {
+				if (headers[i].length() == 0) {
+					headers[i] = "noname";
+					System.out.println("Warning: the " + (i + 1) + "th column name is empty");
+				}
+				// if(!headers[i].equals("id"))// the first
+				// {
+				writer.writeStartElement("metadata");
+				writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
+				writer.writeAttribute("shortname", headers[i]);
+				writer.writeAttribute("longname", longnames[i]);
+				writer.writeAttribute("type", types[i]);
+				writer.writeAttribute("colwidth", "100");
+				writer.writeAttribute("selection", "true");
+				writer.writeAttribute("partition", "true");
+				writer.writeAttribute("display", "true");
+				
+				writer.writeEndElement();
+				writer.writeCharacters("\n");
+				// }
+			}
+			writer.writeEndElement();// close metadatas
+			writer.writeCharacters("\n");
+			
+			writer.writeStartElement("texts");
+			writer.writeCharacters("\n");
+			while (reader.readRecord()) {
+				writer.writeStartElement("text");
+				for (int i = 0; i < headers.length; i++)
+					if (headers[i].equals("id")) {
+						writer.writeAttribute("id", reader.get(headers[i]));
+					}
+					else if (headers[i].equals("xpath")) {
+						writer.writeAttribute("xpath", reader.get(headers[i]));
+					}
+				
+				for (int i = 0; i < headers.length; i++)
+					if (!headers[i].equals("id") && !headers[i].equals("xpath")) {
+						writer.writeEmptyElement("entry");
+						writer.writeAttribute("id", AsciiUtils.buildId(headers[i]));
+						String value = reader.get(headers[i]);
+						if (value.length() == 0)
+							writer.writeAttribute("value", "N/A");
+						else
+							writer.writeAttribute("value", value);
+						
+					}
+				writer.writeEndElement();
+				writer.writeCharacters("\n");
+			}
+			writer.writeEndElement();// close texts
+			writer.writeCharacters("\n");
+			writer.writeEndElement();// close metadatas
+			
+			reader.close();
+			writer.close();
+			output.close();
+			
+			output = null;
+			writer = null;
 		}
-		writer.writeEndElement();// close texts
-		writer.writeCharacters("\n");
-		writer.writeEndElement();// close metadatas
-		
-		reader.close();
-		writer.close();
-		output.close();
-		
-		output = null;
-		writer = null;
+		catch (Exception e) {
+			Log.warning("Error:" + e);
+			Log.printStackTrace(e);
+			return false;
+		}
 		return true;
 	}
 	
@@ -619,7 +626,7 @@
 			return false;
 		}
 		
-		//ensure attribute names format
+		// ensure attribute names format
 		for (org.txm.metadatas.Entry e : metas) {
 			e.o1 = AsciiUtils.buildId(e.o1);
 		}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 2923)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 2924)
@@ -129,8 +129,6 @@
 	@Override
 	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
 		
-		
-		
 		if (!CQPSearchEngine.isInitialized()) {
 			Log.warning("** TXM can't load MainCorpus when CQP search engine is not ready.");
 			return false;
@@ -167,13 +165,32 @@
 				PatchCwbRegistry.patch(this.registryFile, this.dataDirectory);
 			}
 			catch (IOException e) {
-				Log.severe(TXMCoreMessages.bind("Error while updating the {0} registry file .", this.registryFile));
+				Log.severe(TXMCoreMessages.bind("Error while updating the {0} registry file.", this.registryFile));
 				Log.printStackTrace(e);
 				return false;
 			}
 			
+			Log.fine(NLS.bind("Call CQI: load_a_system_corpus with {0} and {1}", this.registryFile.getParent(), this.pID));
 			CQPSearchEngine.getCqiClient().load_a_system_corpus(this.registryFile.getParent(), this.pID);
 			
+			List tmp = Arrays.asList(CQPSearchEngine.getCqiClient().listCorpora());
+			if (tmp.contains(this.pID)) {
+				Log.fine("Corpus registered: " + pID);
+				Log.fine(NLS.bind("Call CQI: corpusProperties with {0}.", this.pID));
+				try {
+					String[] props = CQPSearchEngine.getCqiClient().corpusProperties(this.pID);
+					Log.fine(NLS.bind("Corpus {0} loaded with properties: {1}.", pID, Arrays.asList(props)));
+				}
+				catch (Exception e) {
+					Log.warning(TXMCoreMessages.bind("Error while loading the {0} corpus: ", pID, e.getMessage()));
+					return false;
+				}
+			}
+			else {
+				Log.severe(TXMCoreMessages.bind("Error while loading the {0} corpus. Not found in {1}", this.pID, tmp));
+				return false;
+			}
+			
 			corpora.put(this.pID, this); // register the corpus
 		}
 		catch (Exception e) {
@@ -263,7 +280,7 @@
 	public void clean() {
 		super.clean();
 		
-		if (CorpusManager.getCorpusManager().getCorpora().get(this.pID) == this) { // un register the MainCorpus
+		if (CorpusManager.getCorpusManager().getCorpora().get(this.pID) == this) { // unregister the MainCorpus
 			CorpusManager.getCorpusManager().getCorpora().remove(this.pID);
 		}
 		
@@ -274,7 +291,7 @@
 		}
 		catch (Exception e) {
 			Log.fine(e.getLocalizedMessage());
-			//Log.printStackTrace(e);
+			// Log.printStackTrace(e);
 		}
 		
 		if (dataDirectory != null) {
@@ -381,34 +398,22 @@
 	 */
 	@Override
 	public List<WordProperty> getProperties() throws CqiClientException {
-		if (this.lexicalUnitsProperties != null)
+		if (this.lexicalUnitsProperties != null) {
 			return this.lexicalUnitsProperties;
+		}
 		
 		String[] propertiesName;
-		CorpusManager cm = null;
-		AbstractCqiClient cc = null;
 		try {
-			cm = CorpusManager.getCorpusManager();
-			cc = cm.getCqiClient();
-			
-			// if (cc != null)
-			// System.out.println("cqiclient OK");
-			
+			propertiesName = CQPSearchEngine.getCqiClient().corpusPositionalAttributes(this.pID);
 		}
 		catch (Exception e) {
 			throw new CqiClientException(e);
 		}
-		try {
-			// System.out.println(this.pID); // temp : toLowerCAse
-			propertiesName = cc.corpusPositionalAttributes(this.pID);
+		
+		List<WordProperty> properties = new ArrayList<>(propertiesName.length);
+		for (int i = 0; i < propertiesName.length; i++) {
+			properties.add(new WordProperty(propertiesName[i], this));
 		}
-		catch (Exception e) {
-			throw new CqiClientException(e);
-		}
-		List<WordProperty> properties = new ArrayList<>(
-				propertiesName.length);
-		for (int i = 0; i < propertiesName.length; i++)
-			properties.add(new WordProperty(propertiesName[i], this));
 		this.lexicalUnitsProperties = properties;
 		return properties;
 	}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 2923)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/AbstractCqiClient.java	(revision 2924)
@@ -56,14 +56,15 @@
  *
  * @author mdecorde
  */
-public abstract class AbstractCqiClient implements ICqiClient{
-
+public abstract class AbstractCqiClient implements ICqiClient {
+	
 	static Pattern pattern = Pattern.compile("\\p{Upper}(\\p{Upper}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
+	
 	static Pattern pattern2 = Pattern.compile("\\p{Upper}(\\p{Lower}|\\p{Digit}|[_-])*"); //$NON-NLS-1$
-
+	
 	String lastError;
-
 	
+	
 	/**
 	 * Check wether <code>id</code> is a valid CQi for a corpus.
 	 *
@@ -71,24 +72,24 @@
 	 * @return true if <code>id</code> is in uppercase chararcters
 	 */
 	public static synchronized boolean checkCorpusId(String id) {
-		//System.out.println("Pattern: "+pattern+" test with "+id);
+		// System.out.println("Pattern: "+pattern+" test with "+id);
 		return pattern.matcher(id).matches();
 	}
-
+	
 	/**
 	 * Check whether <code>id</code> is a valid CQi for a subcorpus.
 	 *
 	 * @param id the id
 	 * @return true if <code>id</code> is an uppercase character followed by
-	 * lowercase characters
+	 *         lowercase characters
 	 */
 	public static synchronized boolean checkSubcorpusId(String id) {
-		//System.out.println("Pattern: "+pattern+" test with "+id);
+		// System.out.println("Pattern: "+pattern+" test with "+id);
 		return pattern2.matcher(id).matches();
 	}
 	
-	public synchronized String getLastError(){	
-		if(lastError != null && lastError.length() > 0) {
+	public synchronized String getLastError() {
+		if (lastError != null && lastError.length() > 0) {
 			return lastError;
 		}
 		return CQPSearchEngineCoreMessages.noError;
@@ -101,13 +102,14 @@
 		
 		if (!isWordProperty) {
 			StructuralUnitProperty sprop = (StructuralUnitProperty) prop;
-			QueryResult qresult = prop.getCorpus().query(new CQLQuery("<"+sprop.getFullName()+">[] expand to "+sprop.getName()), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			QueryResult qresult = prop.getCorpus().query(new CQLQuery("<" + sprop.getFullName() + ">[] expand to " + sprop.getName()), "TMP", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 			int[] strucs = this.cpos2Struc(qname, qresult.getStarts());
 			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
-		} else {
-			int[] positions = {0,1,2,3};
-			return Arrays.asList(cqiClient.cpos2Str(qname,positions));
 		}
+		else {
+			int[] positions = { 0, 1, 2, 3 };
+			return Arrays.asList(cqiClient.cpos2Str(qname, positions));
+		}
 	}
 	
 	public List<String> getSingleData(Property prop, int[] positions) throws UnexpectedAnswerException, IOException, CqiServerError {
@@ -118,22 +120,23 @@
 			int[] strucs = cqiClient.cpos2Struc(qname, positions);
 			return Arrays.asList(cqiClient.struc2Str(qname, strucs));
 			
-		} else {
-			return Arrays.asList(cqiClient.cpos2Str(qname,positions));
 		}
+		else {
+			return Arrays.asList(cqiClient.cpos2Str(qname, positions));
+		}
 	}
 	
 	public List<List<String>> getData(Property prop, List<Integer> positions,
 			List<Integer> nWords) throws CqiClientException, IOException, CqiServerError {
 		
-		//System.out.println("START prop: "+prop);
-		//System.out.println("positions : "+positions);
-		//System.out.println("nwords    : "+nWords);
+		// System.out.println("START prop: "+prop);
+		// System.out.println("positions : "+positions);
+		// System.out.println("nwords : "+nWords);
 		
-		List<List<String>> result = new ArrayList<List<String>>();
+		List<List<String>> result = new ArrayList<>();
 		
 		// get all the positions needed, possible overlap
-		HashSet<Integer> allPositionsNeeded = new HashSet<Integer>();
+		HashSet<Integer> allPositionsNeeded = new HashSet<>();
 		for (int i = 0; i < positions.size(); i++) {
 			int n = nWords.get(i);
 			for (int j = 0; j < n; j++) {
@@ -144,44 +147,47 @@
 		// conversion from List<Integer> to int[]
 		int[] cpos = new int[allPositionsNeeded.size()];
 		int c = 0;
-		for (int i : allPositionsNeeded) cpos[c++] = i;
+		for (int i : allPositionsNeeded)
+			cpos[c++] = i;
 		
 		// get values for positions
 		String[] values;
 		boolean isWordProperty = !(prop instanceof StructuralUnitProperty);
 		if (!isWordProperty) {
-			String qname = ((StructuralUnitProperty)prop).getQualifiedName();
+			String qname = ((StructuralUnitProperty) prop).getQualifiedName();
 			int[] structs = this.cpos2Struc(qname, cpos);
 			values = this.struc2Str(qname, structs);
-		} else {
+		}
+		else {
 			String qname = prop.getQualifiedName();
 			values = this.cpos2Str(qname, cpos);
 		}
 		
 		// sort results by position
-		TreeMap<Integer, String> map = new TreeMap<Integer, String>();
-		for (int i = 0 ; i < values.length ; i++) {
+		TreeMap<Integer, String> map = new TreeMap<>();
+		for (int i = 0; i < values.length; i++) {
 			map.put(cpos[i], values[i]);
 		}
 		
 		// fill results
 		int start, end;
 		SortedMap<Integer, String> smap;
-		for (int i = 0 ; i < positions.size() ; i++) {
+		for (int i = 0; i < positions.size(); i++) {
 			start = positions.get(i);
 			end = positions.get(i) + nWords.get(i);
 			if (start > end) {
-				Log.warning("Error: trying to get "+prop+" values from "+start+" to "+end);
+				Log.warning("Error: trying to get " + prop + " values from " + start + " to " + end);
 				result.add(new ArrayList<String>());
-			} else {
+			}
+			else {
 				smap = map.subMap(start, end);
-				result.add(new ArrayList<String>(smap.values()));
+				result.add(new ArrayList<>(smap.values()));
 			}
 		}
-
+		
 		return result;
 	}
-
+	
 	/**
 	 * Return lists of strings.
 	 *
@@ -189,12 +195,12 @@
 	 * @throws CqiClientException the cqi client exception
 	 */
 	public List<String> getData(StructuralUnitProperty property, CQPCorpus corpus) throws CqiClientException {
-			QueryResult tmp = corpus.query(new CQLQuery("<" + property.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
-			List<Match> matches = tmp.getMatches();
-			tmp.drop();
-			ArrayList<String> ret =  new ArrayList<String>(new HashSet<String>(Match
-					.getValuesForProperty(property, matches)));
-			return ret;
+		QueryResult tmp = corpus.query(new CQLQuery("<" + property.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+		List<Match> matches = tmp.getMatches();
+		tmp.drop();
+		ArrayList<String> ret = new ArrayList<>(new HashSet<>(Match
+				.getValuesForProperty(property, matches)));
+		return ret;
 	}
 	
 	/**
@@ -206,15 +212,15 @@
 	 */
 	public List<String> getData(StructuralUnitProperty prop, int number) throws CqiClientException {
 		
-			QueryResult tmp = prop.getCorpus()
-					.query(
-							new CQLQuery("<" + prop.getFullName() + ">[] expand to "+prop.getName()), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
-			if (number > tmp.getNMatch()) number = tmp.getNMatch();
-			List<Match> matches = tmp.getMatches(0, number);
-			tmp.drop();
-			return new ArrayList<String>(new HashSet<String>(Match
-					.getValuesForProperty(prop, matches)));
-			// System.out.println("Data "+property.getQualifiedName()+": "+data);
+		QueryResult tmp = prop.getCorpus()
+				.query(
+						new CQLQuery("<" + prop.getFullName() + ">[] expand to " + prop.getName()), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
+		if (number > tmp.getNMatch()) number = tmp.getNMatch();
+		List<Match> matches = tmp.getMatches(0, number);
+		tmp.drop();
+		return new ArrayList<>(new HashSet<>(Match
+				.getValuesForProperty(prop, matches)));
+		// System.out.println("Data "+property.getQualifiedName()+": "+data);
 		
 	}
 	
@@ -227,8 +233,8 @@
 	 * @return true, if successful
 	 */
 	@Override
-	public abstract boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError ;
-
+	public abstract boolean connect(String username, String password) throws UnexpectedAnswerException, IOException, CqiServerError;
+	
 	// None
 	/**
 	 * Disconnect.
@@ -237,7 +243,7 @@
 	 */
 	@Override
 	public abstract boolean disconnect() throws UnexpectedAnswerException, CqiServerError, IOException;
-
+	
 	// CQI_CTRL_LAST_GENERAL_ERROR
 	/**
 	 * return the last CQP error.
@@ -245,8 +251,8 @@
 	 * @return the last error
 	 */
 	@Override
-	public abstract String getLastCqiError() throws UnexpectedAnswerException, IOException,	CqiServerError;
-
+	public abstract String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
 	// CQI_CTRL_LAST_CQP_ERROR
 	/**
 	 * return the last CQP error.
@@ -254,8 +260,8 @@
 	 * @return the last error
 	 */
 	@Override
-	public abstract String getLastCQPError() throws UnexpectedAnswerException, IOException,	CqiServerError;
-
+	public abstract String getLastCQPError() throws UnexpectedAnswerException, IOException, CqiServerError;
+	
 	// None
 	/**
 	 * Lists the corpora available on the server.
@@ -264,7 +270,7 @@
 	 */
 	@Override
 	public abstract String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// None
 	/**
 	 * Gives the corpus charset.
@@ -274,7 +280,7 @@
 	 */
 	@Override
 	public abstract String corpusCharset(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// None (not really implemented anyway)
 	/**
 	 * Gives the corpus properties.
@@ -284,7 +290,7 @@
 	 */
 	@Override
 	public abstract String[] corpusProperties(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS
 	/**
 	 * Gives the corpus positional attributes.
@@ -294,7 +300,7 @@
 	 */
 	@Override
 	public abstract String[] corpusPositionalAttributes(String corpusID) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS
 	/**
 	 * Gives the corpus structural attributes.
@@ -307,7 +313,7 @@
 	 */
 	@Override
 	public abstract String[] corpusStructuralAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
 	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE
 	/**
@@ -321,8 +327,8 @@
 	 */
 	@Override
 	public abstract boolean corpusStructuralAttributeHasValues(String attribute) throws UnexpectedAnswerException, IOException,
-	CqiServerError;
-
+			CqiServerError;
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS
 	/**
 	 * Gives the corpus alignement attributes.
@@ -335,7 +341,7 @@
 	 */
 	@Override
 	public abstract String[] corpusAlignementAttributes(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS
 	/**
 	 * Gives the corpus full name.
@@ -348,7 +354,7 @@
 	 */
 	@Override
 	public abstract String corpusFullName(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Gives the corpus info listed in the .INFO file.
 	 *
@@ -360,7 +366,7 @@
 	 */
 	@Override
 	public abstract String[] corpusInfo(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Drop a corpus.
 	 * 
@@ -369,7 +375,7 @@
 	 */
 	@Override
 	public abstract void dropCorpus(String corpus) throws Exception;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
 	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
 	/**
@@ -383,7 +389,7 @@
 	 */
 	@Override
 	public abstract int attributeSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	// CQI_CQP_ERROR_NO_SUCH_CORPUS, CQI_CL_ERROR_NO_SUCH_ATTRIBUTE,
 	// CQI_CL_ERROR_WRONG_ATTRIBUTE_TYPE, CQI_CL_ERROR_CORPUS_ACCESS
 	/**
@@ -398,7 +404,7 @@
 	 */
 	@Override
 	public abstract int lexiconSize(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Drop attribute.
 	 *
@@ -409,7 +415,7 @@
 	 */
 	@Override
 	public abstract void dropAttribute(String attribute) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Converts an array of attribute values to their ID.
 	 *
@@ -422,7 +428,7 @@
 	 */
 	@Override
 	public abstract int[] str2Id(String attribute, String[] strings) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Converts an array of attribute ID to their values.
 	 *
@@ -435,7 +441,7 @@
 	 */
 	@Override
 	public abstract String[] id2Str(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Converts an array of attribute IDs to their frequency.
 	 *
@@ -448,7 +454,7 @@
 	 */
 	@Override
 	public abstract int[] id2Freq(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Converts an array of position to their ID given an attribute.
 	 *
@@ -461,7 +467,7 @@
 	 */
 	@Override
 	public abstract int[] cpos2Id(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Converts an array of position to their value given an attribute.
 	 *
@@ -474,7 +480,7 @@
 	 */
 	@Override
 	public abstract String[] cpos2Str(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Computes for each position of an array the Id of the enclosing structural
 	 * attribute.
@@ -488,7 +494,7 @@
 	 */
 	@Override
 	public abstract int[] cpos2Struc(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Computes for each position of an array the position of the left boundary
 	 * of the enclosing structural attribute.
@@ -502,7 +508,7 @@
 	 */
 	@Override
 	public abstract int[] cpos2LBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Computes for each position of an array the position of the right boundary
 	 * of the enclosing structural attribute.
@@ -516,7 +522,7 @@
 	 */
 	@Override
 	public abstract int[] cpos2RBound(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Computes for each position of an array the Id of the enclosing alignment
 	 * attribute.
@@ -530,7 +536,7 @@
 	 */
 	@Override
 	public abstract int[] cpos2Alg(String attribute, int[] cpos) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves annotated string values of structure regions in <strucs>; "" if
 	 * out of range.
@@ -544,7 +550,7 @@
 	 */
 	@Override
 	public abstract String[] struc2Str(String attribute, int[] strucs) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves all corpus positions where the given token occurs.
 	 *
@@ -557,7 +563,7 @@
 	 */
 	@Override
 	public abstract int[] id2Cpos(String attribute, int id) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves all corpus positions where one of the tokens in <id_list>
 	 * occurs; the returned list is sorted as a whole, not per token id.
@@ -571,7 +577,7 @@
 	 */
 	@Override
 	public abstract int[] idList2Cpos(String attribute, int[] ids) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves the lexicon IDs of all tokens that match <regex>; the returned
 	 * list may be empty (size 0).
@@ -585,7 +591,7 @@
 	 */
 	@Override
 	public abstract int[] regex2Id(String attribute, String regex) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves the start and end corpus positions of structure region <struc>.
 	 *
@@ -598,7 +604,7 @@
 	 */
 	@Override
 	public abstract int[] struc2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Retrieves start and end corpus positions of an alignement region in the
 	 * source and target corpora<struc>.
@@ -606,14 +612,14 @@
 	 * @param attribute the attribute
 	 * @param struc the struc
 	 * @return an array of size 4 containing (src_start, src_end, target_start,
-	 * target_end)
+	 *         target_end)
 	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
 	 * @throws IOException Signals that an I/O exception has occurred.
 	 * @throws CqiServerError the cqi server error
 	 */
 	@Override
 	public abstract int[] alg2Cpos(String attribute, int struc) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Runs a CQL query.
 	 *
@@ -626,7 +632,7 @@
 	 */
 	@Override
 	public abstract void cqpQuery(String motherCorpus, String subcorpus, String query) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Runs a CQP query line.
 	 *
@@ -639,21 +645,20 @@
 	 */
 	@Override
 	public abstract void query(String query) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
-	 * Runs a CQP query.
+	 * Load a CQP corpus (system) from a registry file
 	 *
 	 * @param motherCorpus the mother corpus
-	 * @param subcorpus the subcorpus
 	 * @param query the query
-	 * @return 
+	 * @return
 	 * @throws IOException Signals that an I/O exception has occurred.
 	 * @throws UnexpectedAnswerException Signals that the data read on the socket is unexpected
 	 * @throws CqiServerError the cqi server error
 	 */
 	@Override
 	public abstract boolean load_a_system_corpus(String regfilepath, String entry) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Lists all the subcorpora of a corpus.
 	 *
@@ -665,7 +670,7 @@
 	 */
 	@Override
 	public abstract String[] listSubcorpora(String corpus) throws UnexpectedAnswerException, IOException, CqiServerError;
-
+	
 	/**
 	 * Gives the size of a subcorpus .
 	 * 
@@ -683,8 +688,8 @@
 	 */
 	@Override
 	public abstract int subCorpusSize(String subcorpus) throws IOException,
-	UnexpectedAnswerException, CqiServerError;
-
+			UnexpectedAnswerException, CqiServerError;
+	
 	/**
 	 * Checks wether a subcorpus has a field.
 	 * 
@@ -704,7 +709,7 @@
 	 */
 	@Override
 	public abstract boolean subCorpusHasField(String subcorpus, byte field) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Dumps the values of <field> for match ranges <first> .. <last> in
 	 * <subcorpus>. <field> is one of the CQI_CONST_FIELD_* constants.
@@ -729,8 +734,8 @@
 	 */
 	@Override
 	public abstract int[] dumpSubCorpus(String subcorpus, byte field, int first, int last) throws IOException, UnexpectedAnswerException,
-	CqiServerError;
-
+			CqiServerError;
+	
 	/**
 	 * Drops a subcorpus.
 	 * 
@@ -746,8 +751,8 @@
 	 */
 	@Override
 	public abstract void dropSubCorpus(String subcorpus) throws IOException,
-	UnexpectedAnswerException, CqiServerError;
-
+			UnexpectedAnswerException, CqiServerError;
+	
 	/**
 	 * Returns <n> (id, frequency) pairs flattened into a list of size 2*<n> NB:
 	 * pairs are sorted by frequency desc.
@@ -775,7 +780,7 @@
 	public abstract int[][] fdist1(String subcorpus, int cutoff,
 			byte field, String attribute) throws IOException,
 			UnexpectedAnswerException, CqiServerError;
-
+	
 	/**
 	 * Returns <n> (id1, id2, frequency) pairs flattened into a list of size
 	 * 3*<n> NB: triples are sorted by frequency desc. .
@@ -805,7 +810,7 @@
 	@Override
 	public abstract int[][] fdist2(String subcorpus, int cutoff,
 			byte field1, String attribute1, byte field2, String attribute2) throws IOException, UnexpectedAnswerException, CqiServerError;
-
+	
 	@Override
-	public abstract boolean reconnect() ;
-}
\ No newline at end of file
+	public abstract boolean reconnect();
+}
