Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 1007)
@@ -51,7 +51,6 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-// TODO: Auto-generated Javadoc
 /**
  * The Class Subcorpus.
  * 
@@ -308,7 +307,7 @@
 					Partition partition = this.createPartition(name, queries, names, true);
 					partition.setSelfElement(partitionElem);
 					partition.load();
-				} catch (CqiClientException e) {
+				} catch (Exception e) {
 					Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
 							+ " : " + e); //$NON-NLS-1$
 					//c.getParentNode().removeChild(c);
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java	(revision 1007)
@@ -62,7 +62,7 @@
 	 * @throws InvalidCqpIdException the invalid cqp id exception
 	 */
 	protected Part(String cqpId, String partitionName, String shortName, Partition partition, Query query) throws InvalidCqpIdException {
-		super(cqpId, partitionName + "_" + shortName, partition.getCorpus(), query, false); //$NON-NLS-1$
+		super(cqpId, partitionName + "_" + shortName, partition.getParent(), query, false); //$NON-NLS-1$
 		this.shortName = shortName;
 		this.name = shortName;
 		this.partition = partition;
@@ -160,7 +160,7 @@
 	 */
 	@Override
 	public Base getBase() {
-		return this.partition.getCorpus().getBase();
+		return this.partition.getParent().getBase();
 	}
 
 	/* (non-Javadoc)
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 1007)
@@ -41,14 +41,21 @@
 import java.util.List;
 import java.util.Locale;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.osgi.util.NLS;
 import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TBXPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.Parameter;
+import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
 import org.txm.objects.TxmObject;
+import org.txm.searchengine.cqp.CQPPreferences;
 import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.query.Query;
 import org.txm.searchengine.cqp.corpus.query.QueryPart;
+import org.txm.utils.io.IOUtils;
 import org.txm.utils.logger.Log;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -69,23 +76,112 @@
 	/** The Constant serialVersionUID. */
 	private static final long serialVersionUID = 4420732757687971253L;
 
-	/** The parts. */
-	private List<Part> parts;
+	/**
+	 * Get the safe values (spacial char regexp safe).
+	 *
+	 * @param property the property
+	 * @param corpus the corpus
+	 * @return the safe values
+	 * @throws CqiClientException the cqi client exception
+	 */
+	private static List<String> getSafeValues(StructuralUnitProperty property, Corpus corpus) throws CqiClientException	{
+		List<String> values = property.getValues(corpus);
+		for(int i = 0 ; i < values.size() ; i++)
+			values.set(i, Query.addBackSlash(values.get(i)));
+		return values;
+	}
 
-	/** The structure. */
-	private StructuralUnit structure;
+	/** The property, if not null the partition will forge its own queries */
+	@Parameter(key=TXMPreferences.STRUCTURAL_UNIT_PROPERTY)
+	protected StructuralUnitProperty pProperty;
+	/**
+	 * the parts property values to use, may be null
+	 */
+	@Parameter(key=TXMPreferences.VALUES)
+	protected List<String> pValues;
+	/**
+	 * the parts queries
+	 */
+	@Parameter(key=TXMPreferences.QUERIES)
+	protected List<String> pQueries;
+	/**
+	 * the parts names -> do the parts order
+	 */
+	@Parameter(key=CQPPreferences.PARTNAMES)
+	protected List<String> pPartNames;
+	/**
+	 * the partition name to set
+	 */
+	@Parameter(key=TXMPreferences.LAZY_NAME)
+	protected String pName;
+	/** sum of parts size, stored for efficiency reasons**/
+	int totalsize = -1;
 
-	/** The property. */
-	private Property property;
 
-	
-	
-	int totalsize = -1;
-	int[] partSizes;
+	//	/**
+	//	 * Create a partition with a set of raw queries.
+	//	 *
+	//	 * @param corpus the corpus
+	//	 * @param name the name
+	//	 * @param queries the queries
+	//	 * @throws CqiClientException the cqi client exception
+	//	 * @author Sylvain Loiseau
+	//	 */
+	//	protected Partition(Corpus corpus, String name, List<String> queries) throws CqiClientException {
+	//		this(corpus, name, queries, null);
+	//	}
 
+	public Partition(Corpus corpus) {
+		super(corpus);
+	}
+
+	public Partition(String uuid) {
+		super(uuid);
+	}
 	/**
+	 * Instantiates a new partition.
+	 *
+	 * @param corpus the corpus
+	 * @param name the name
+	 * @param queries the queries
+	 * @param partnames the partnames
+	 * @throws Exception 
+	 */
+	public boolean _compute_with_lists() throws Exception {
+
+		if (pName == null || pName.length() == 0) {
+			pName = "no_name";
+		}
+		
+		if (name == null || name.trim().length() == 0) {
+			this.name = pName;
+		}
+
+		Log.info(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getParent(), this.name));
+		long start = System.currentTimeMillis();
+		for (int i = 0; i < pQueries.size(); i++) {
+			String queryS = pQueries.get(i);
+			String partitionName = this.getName();
+
+			String partName = String.valueOf(i);
+			if(pPartNames != null && i < pPartNames.size())	{
+				partName = pPartNames.get(i);
+			}
+			if (partName.trim().length() == 0) {
+				partName = "-"; //$NON-NLS-1$
+			}
+
+			Part part = createPart(partitionName, partName, queryS);
+		}
+		long end = System.currentTimeMillis();
+		Log.info(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+
+		return pQueries.size() > 0;
+	}
+
+	/**
 	 * Creates a new partition on a corpus given a structure, a property of this
-	 * structure and a liste of values this property can take
+	 * structure and a list of values this property can take
 	 * 
 	 * The partition has as many parts as the size of the list of value. The ith
 	 * part is composed by all the structure <code>structure</code> such as
@@ -98,31 +194,32 @@
 	 * @param property
 	 *            the property
 	 * @param values
-	 *            the values
-	 * 
-	 * @throws CqiClientException
-	 *             the cqi client exception
+	 *            the values, raw values special chars will be backslashed
+	 * @throws Exception 
 	 */
-	protected Partition(Corpus corpus, StructuralUnit structure, StructuralUnitProperty property, List<String> values)	throws CqiClientException {
-		super(corpus);
-		
-		this.name = corpus.getName()+ "_" + structure.getName() + "_" + property.getName(); //$NON-NLS-1$ //$NON-NLS-2$
-		
-		Log.finest(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getCorpus(), this.name)); 
-		
-		long start = System.currentTimeMillis();
-		this.structure = structure;
-		this.property = property;
-		this.parts = new ArrayList<Part>();
-		HashMap<String, String> infos = this.getCorpus().getSAttributesInfos().get(property.getFullName());
+
+	protected boolean _compute_with_property()	throws Exception {
+
+		Corpus corpus = getParent();
+		if (pName == null || pName.length() == 0) {
+			pName = corpus.getName()+ "_" + pProperty.getFullName(); //$NON-NLS-1$
+		}
+
+		if (pValues == null) {
+			pValues = pProperty.getValues(corpus);
+		}
+
+		// sort parts
+		HashMap<String, String> infos = this.getParent().getSAttributesInfos().get(pProperty.getFullName());
+
 		String type = "String"; //$NON-NLS-1$
 		if (infos != null) {
 			type = infos.get("type"); //$NON-NLS-1$
 		}
 		if (type == null || type.trim().length() == 0 || type.equals("String")) { //$NON-NLS-1$
-			Collections.sort(values, Collator.getInstance(Locale.getDefault())); // alpha sort
+			Collections.sort(pValues, Collator.getInstance(Locale.getDefault())); // alpha sort
 		} else if (type.equals("Integer")) { //$NON-NLS-1$
-			Collections.sort(values, new Comparator<String>() {
+			Collections.sort(pValues, new Comparator<String>() {
 				@Override
 				public int compare(String arg0, String arg1) {
 					int i0 = Integer.parseInt(arg0);
@@ -133,7 +230,7 @@
 		} else if (type.equals("Date")) { //$NON-NLS-1$
 			String format = infos.get("inputFormat"); //$NON-NLS-1$
 			final DateFormat formater = new SimpleDateFormat(format);
-			Collections.sort(values, new Comparator<String>() {
+			Collections.sort(pValues, new Comparator<String>() {
 				@Override
 				public int compare(String arg0, String arg1) {
 					try {
@@ -147,118 +244,119 @@
 			}); 
 		} else  if(type.contains("|")){ //$NON-NLS-1$
 			final List<String> sortedValues = Arrays.asList(type.split("\\|")); //$NON-NLS-1$
-			Collections.sort(values, new Comparator<String>() {
+			Collections.sort(pValues, new Comparator<String>() {
 				@Override
 				public int compare(String arg0, String arg1) {
-						int i0 = sortedValues.indexOf(arg0);
-						int i1 = sortedValues.indexOf(arg1);
-						return i0-i1;
+					int i0 = sortedValues.indexOf(arg0);
+					int i1 = sortedValues.indexOf(arg1);
+					return i0-i1;
 				}
 			}); 
 		}
-		//System.out.println("Parts sorted with type: "+type);
-		//System.out.println("values: "+values);
-		for (String value : values) {
-			String partitionName = this.getName();
+
+		pQueries = new ArrayList<>();
+		pPartNames = new ArrayList<>();
+		for (String value : pValues) {
 			String partName = value.replace("\\",""); //$NON-NLS-1$ //$NON-NLS-2$
-			//System.out.println("VALUE: "+value);
-			Query query = new QueryPart(structure, property, Query.addBackSlash(value));
-			Part part = createPart(partitionName, partName, query);
-			// System.out.println("part id: "+part.getQualifiedCqpId());
-			parts.add(part);
+			pPartNames.add(partName);
+			Query query = new QueryPart(pProperty.getStructuralUnit(), pProperty, Query.addBackSlash(value));
+			pQueries.add(query.getQueryString());
 		}
-		long end = System.currentTimeMillis();
-		Log.finest(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+
+		return _compute_with_lists();
 	}
 
-	
-	/**
-	 * Instantiates a new partition.
-	 *
-	 * @param corpus the corpus
-	 * @param name the name
-	 * @param queries the queries
-	 * @param partnames the partnames
-	 * @throws CqiClientException the cqi client exception
+
+	@Override
+	protected boolean _compute() throws Exception {
+
+		name = null;
+		Log.finest(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getParent(), this.name));
+		
+		if (pProperty != null) {
+			_compute_with_property();
+		} else {
+			_compute_with_lists();
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#load()
 	 */
-	public Partition(Corpus corpus, String name, List<String> queries, List<String> partnames) throws CqiClientException {
-		super(corpus);
+	@Override
+	protected boolean _load() {
+		if (this.getUUID().length() > 0) return true; // partition already persisted
 
-		this.structure = null;
-		this.property = null;
-		if (name == null || name.trim().length() == 0) {
-			name = "noname"; //$NON-NLS-1$
-		}
-		this.name = name;
-		Log.info(NLS.bind(TXMCoreMessages.NEW_PARTION, this.getCorpus(), this.name));
-		long start = System.currentTimeMillis();
-		this.parts = new ArrayList<Part>();
-		for (int i = 0; i < queries.size(); i++) {
-			String queryS = queries.get(i);
-			String partitionName = this.getName();
-			
-			String partName = String.valueOf(i);
-			if(partnames != null && i < partnames.size())	{
-				partName = partnames.get(i);
+		if (this.getSelfElement() != null && this.getParent() != null) {
+			NodeList partList = getSelfElement().getChildNodes();
+			for (int i = 0; i < partList.getLength(); i++) {
+				if (partList.item(i).getNodeType() == 1) {
+					Element c = (Element) partList.item(i);
+					if (c.getNodeName().equals("part")) //$NON-NLS-1$
+					{
+						String pname = c.getAttribute("name"); //$NON-NLS-1$
+						String pshortname = c.getAttribute("shortname"); //$NON-NLS-1$
+						String pquery = c.getAttribute("query"); //$NON-NLS-1$
+						for (Part part : getParts())
+							if (part.getName().equals(pname)) {
+								part.setName(pname);
+								part.setShortName(pshortname);
+								part.setQuery(pquery);
+							}
+					}
+				}
 			}
-			if (partName.trim().length() == 0) {
-				partName = "-"; //$NON-NLS-1$
-			}
-			
-			Part part = createPart(partitionName, partName, queryS);
-			parts.add(part);
+			this.loadMetadata();
+			return true;
 		}
-		long end = System.currentTimeMillis();
-		Log.info(NLS.bind(TXMCoreMessages.PARTITION_CREATED, this.name, (end - start)));
+
+		return false;
 	}
 
-	
-	
-	/**
-	 * Instantiates a new partition.
-	 *
-	 * @param corpus the corpus
-	 * @param structure the structure
-	 * @param property the property
-	 * @throws CqiClientException the cqi client exception
-	 */
-	protected Partition(Corpus corpus, StructuralUnit structure, StructuralUnitProperty property) throws CqiClientException {
-		this(corpus, structure, property, property.getValues(corpus));
+	@Override
+	protected boolean _save() {
+		return false;
 	}
 
+	@Override
+	public boolean canCompute() {
+		return getParent() != null && (pProperty != null || (pQueries != null && pQueries.size() > 0));
+	}
 
-	/**
-	 * Create a partition with a set of raw queries.
-	 *
-	 * @param corpus the corpus
-	 * @param name the name
-	 * @param queries the queries
-	 * @throws CqiClientException the cqi client exception
-	 * @author Sylvain Loiseau
-	 */
-	protected Partition(Corpus corpus, String name, List<String> queries) throws CqiClientException {
-		this(corpus, name, queries, null);
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+
 	}
 
+	@Override
+	public int compareTo(TXMResult o) {
+		// Compare node weights
+		int output = super.compareTo(o);
+		// Compare simple names if weights are equal
+		if(output == 0)	{
+			output = this.getSimpleName().compareToIgnoreCase(o.getSimpleName());
+		}
+		return output;
+	}
 
 	/**
-	 * Get the safe values (spacial char regexp safe).
+	 * Creates the part.
 	 *
-	 * @param property the property
-	 * @param corpus the corpus
-	 * @return the safe values
+	 * @param partitionName the partition name
+	 * @param partName the part name
+	 * @param query the query
+	 * @return the part
 	 * @throws CqiClientException the cqi client exception
 	 */
-	private static List<String> getSafeValues(StructuralUnitProperty property, Corpus corpus) throws CqiClientException	{
-		List<String> values = property.getValues(corpus);
-		//System.out.println("CORPUS: "+corpus);
-		//System.out.println("VALUES: "+values);
-		for(int i = 0 ; i < values.size() ; i++)
-			values.set(i, Query.addBackSlash(values.get(i)));
-		return values;
+	private Part createPart(String partitionName, String partName, Query query)	throws CqiClientException {
+		if (partName.length() == 0) {
+			partName = "-"; //$NON-NLS-1$
+		}
+		return createPart(partitionName, partName, query.getQueryString());
 	}
 
-	
 	/**
 	 * Create a part with a raw query.
 	 *
@@ -276,12 +374,12 @@
 		Log.finest(NLS.bind(TXMCoreMessages.CREATING_PART,partName, query));
 		long start = System.currentTimeMillis();
 		try {
-			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getCorpus().getQualifiedCqpId(), partCqpId, query);
+			CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getParent().getQualifiedCqpId(), partCqpId, query);
 			part = new Part(partCqpId, partitionName, partName, this, new Query(query));
 
 			// FIXME: persistence tests: define the UUID as the concatenation of all part CQP id
-			this.uniqueID += partCqpId;
-			
+//			this.uniqueID += partCqpId;
+
 		} catch (Exception e) {
 			try {
 				throw new CqiClientException(TXMCoreMessages.Partition_9 + partitionName + "_" + partName + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -293,43 +391,67 @@
 		}
 		long end = System.currentTimeMillis();
 		Log.finest(NLS.bind(TXMCoreMessages.PART_CREATED, partitionName + "_" + partName, (end - start))); //$NON-NLS-1
-		
+
 		return part;
 	}
 
-	/**
-	 * Creates the part.
-	 *
-	 * @param partitionName the partition name
-	 * @param partName the part name
-	 * @param query the query
-	 * @return the part
-	 * @throws CqiClientException the cqi client exception
-	 */
-	private Part createPart(String partitionName, String partName, Query query)	throws CqiClientException {
-		if (partName.length() == 0) {
-			partName = "-"; //$NON-NLS-1$
+	@Override
+	public boolean delete() {
+		try {
+			this.getParent().dropPartition(this);
+			super.delete();
+			if (this.getSelfElement() != null) {
+				this.getSelfElement().getParentNode().removeChild(getSelfElement());
+			}
+			return true;
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
 		}
-		return createPart(partitionName, partName, query.getQueryString());
+		return false;
 	}
-
+	
 	/**
-	 * Gets the corpus.
+	 * Gets the dirty states.
 	 * 
-	 * @return the corpus
+	 * @return
 	 */
-	public Corpus getCorpus() {
-		return (Corpus) this.parent;
+	public boolean isDirty() {
+		return this.dirty;
 	}
 
+	@Override
+	public String getDetails() {
+		return getName();
+	}
+
+	@Override
+	public String getName() {
+		return this.name;
+	}
+
 	/**
-	 * Gets the parts.
+	 * Gets the number of parts.
 	 * 
-	 * @return the parts
+	 * @return the the number of parts.
 	 */
-	public List<Part> getParts() {
-		return parts;
+	public int getNPart() {
+		try {
+			if (!hasBeenComputedOnce()) {
+				compute();
+			}
+			
+			return getParts().size();
+		} catch(Exception e) { }
+		return 0;
 	}
+	
+	/**
+	 * @return true for now
+	 */
+	public boolean hasBeenComputedOnce() {
+		return hasBeenComputedOnce;
+	}
 
 	/**
 	 * Gets the name of the parts.
@@ -337,6 +459,7 @@
 	 * @return the part names
 	 */
 	public List<String> getPartNames() {
+		List<Part> parts = getParts();
 		List<String> partNames = new ArrayList<String>(parts.size());
 		for (Subcorpus part : parts) {
 			partNames.add(part.getName());
@@ -345,11 +468,22 @@
 	}
 
 	/**
+	 * Gets the parts.
+	 * 
+	 * @return the parts
+	 */
+	@SuppressWarnings("unchecked")
+	public List<Part> getParts() {
+		return (List<Part>) getChildren(Part.class);
+	}
+
+	/**
 	 * Gets the short name of the parts.
 	 * 
 	 * @return the part names
 	 */
 	public List<String> getPartShortNames() {
+		List<Part> parts = getParts();
 		List<String> partNames = new ArrayList<String>(parts.size());
 		for (Part part : parts) {
 			partNames.add(part.getShortName());
@@ -358,284 +492,293 @@
 	}
 
 	/**
-	 * Run a query on all the parts of this partition.
+	 * Gets the part sizes as int array.
 	 * 
-	 * @param query
-	 *            the query
-	 * @param name
-	 *            the name
+	 * Do N CQi requests -> avoid calling multiple times this method
 	 * 
-	 * @return the list< subcorpus>
-	 * 
+	 * @return
 	 * @throws CqiClientException
-	 *             the cqi client exception
 	 */
-	public List<QueryResult> query(Query query, String name) throws CqiClientException {
-		Log.finest(TXMCoreMessages.QUERYING_PARTITION + this.name);
-		List<QueryResult> results = new ArrayList<QueryResult>(parts.size());
-		for (Subcorpus part : parts) {
-			results.add(part.query(query, part.getName() + "_" + name, false)); //$NON-NLS-1$
+	public int[] getPartSizes() throws CqiClientException {
+		int[] partSizes = new int[getParts().size()];
+		for (int i = 0 ; i < getParts().size() ; i++) {
+			Part p = getParts().get(i);
+			partSizes[i] = p.getSize();
 		}
-		return results;
+		return partSizes;
 	}
 
 	/**
-	 * Gets the number of parts.
-	 * 
-	 * @return the the number of parts.
+	 * Gets the property.
+	 *
+	 * @return the property
 	 */
-	public int getNPart() {
-		try {
-			return parts.size();
-		}
-		catch(Exception e) {
-		}
-		return 0;
+	public Property getProperty() {
+		return pProperty;
 	}
 
+	@Override
+	public String getSimpleName() {
+		return this.pName;
+	}
+
 	/**
 	 * Gets the structure.
 	 *
 	 * @return the structure
 	 */
 	public StructuralUnit getStructure() {
-		return structure;
+		if (pProperty == null) return null;
+		return pProperty.getStructuralUnit();
 	}
 
 	/**
-	 * Gets the property.
-	 *
-	 * @return the property
+	 * Gets the total of all part sizes.
+	 * @return
+	 * @throws CqiClientException
 	 */
-	public Property getProperty() {
-		return property;
+	public int getTotalSize() throws CqiClientException {
+		if (!hasBeenComputedOnce()) {
+			try {
+				compute();
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		if (totalsize == -1) {
+			totalsize = 0;
+			for (Part p : getParts()) {
+				totalsize += p.getSize();
+			}
+		}
+		return totalsize;
 	}
 
 
 	/**
-	 * Sets the name.
-	 *
-	 * @param name2 the new name
+	 * Run a query on all the parts of this partition.
+	 * 
+	 * @param query
+	 *            the query
+	 * @param name
+	 *            the name
+	 * 
+	 * @return the list< subcorpus>
+	 * 
+	 * @throws CqiClientException
+	 *             the cqi client exception
 	 */
-	public void setName(String name2) {
-		this.name = name2;
-		if(this.getSelfElement() != null)
-			this.getSelfElement().setAttribute("name", name); //$NON-NLS-1$
+	public List<QueryResult> query(Query query, String name) throws CqiClientException {
+		Log.finest(TXMCoreMessages.QUERYING_PARTITION + this.name);
+		List<Part> parts = getParts();
+		List<QueryResult> results = new ArrayList<QueryResult>(parts.size());
+		for (Subcorpus part : parts) {
+			results.add(part.query(query, part.getName() + "_" + name, false)); //$NON-NLS-1$
+		}
+		return results;
 	}
 
 	/**
 	 * Register to parent.
-	 *
-	 * @param partitionName the partition name
 	 */
-	private void registerToParent(String partitionName) {
-		if (this.getSelfElement() == null && this.getParent() != null)
-		try {
-			Element parentElem = (Element) this.getCorpus().getSelfElement();
-			if (parentElem == null) return;
-			Document doc = parentElem.getOwnerDocument();
-			Element corporaElem;
-			if (this.getParent() instanceof MainCorpus) {
-				NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
-				corporaElem = (Element) corporaList.item(0);
-			} else {
-				corporaElem = parentElem;
-			}
-			Element partitionElem = doc.createElement("partition"); //$NON-NLS-1$
-			partitionElem.setAttribute("name", partitionName); //$NON-NLS-1$
-			corporaElem.appendChild(partitionElem);
-			this.setSelfElement(partitionElem);
-			for (Part p : parts) {
-				Element partElem = doc.createElement("part"); //$NON-NLS-1$
-				partElem.setAttribute("name", p.getName()); //$NON-NLS-1$
-				partElem.setAttribute("shortname", p.getShortName()); //$NON-NLS-1$
-				partElem.setAttribute("query", p.getQuery().getQueryString()); //$NON-NLS-1$
-				partitionElem.appendChild(partElem);
-			}
-		} catch (Exception e) {
-			System.out.println(TXMCoreMessages.Partition_21+e);
-		}
-		this._load();
+	public void registerToParent() {
+		//registerToParent(this.name);
 	}
 
 	/**
 	 * Register to parent.
+	 *
+	 * @param partitionName the partition name
 	 */
-	public void registerToParent() {
-		registerToParent(this.name);
+	private void registerToParent(String partitionName) {
+//		if (this.getSelfElement() == null && this.getParent() != null)
+//			try {
+//				Element parentElem = (Element) this.getParent().getSelfElement();
+//				if (parentElem == null) return;
+//				Document doc = parentElem.getOwnerDocument();
+//				Element corporaElem;
+//				if (this.getParent() instanceof MainCorpus) {
+//					NodeList corporaList = parentElem.getElementsByTagName("preBuild"); //$NON-NLS-1$
+//					corporaElem = (Element) corporaList.item(0);
+//				} else {
+//					corporaElem = parentElem;
+//				}
+//				Element partitionElem = doc.createElement("partition"); //$NON-NLS-1$
+//				partitionElem.setAttribute("name", partitionName); //$NON-NLS-1$
+//				corporaElem.appendChild(partitionElem);
+//				this.setSelfElement(partitionElem);
+//				for (Part p : getParts()) {
+//					Element partElem = doc.createElement("part"); //$NON-NLS-1$
+//					partElem.setAttribute("name", p.getName()); //$NON-NLS-1$
+//					partElem.setAttribute("shortname", p.getShortName()); //$NON-NLS-1$
+//					partElem.setAttribute("query", p.getQuery().getQueryString()); //$NON-NLS-1$
+//					partitionElem.appendChild(partElem);
+//				}
+//			} catch (Exception e) {
+//				System.out.println(TXMCoreMessages.Partition_21+e);
+//			}
+//		this._load();
 	}
 
-//	/**
-//	 * Load.
-//	 *
-//	 * @param e the e
-//	 * @return true, if successful
-//	 */
-//	protected boolean _load(Element e) {
-//		this.setSelfElement(e);
-//		return this._load();
-//	}
-
-	/* (non-Javadoc)
-	 * @see org.txm.objects.TxmObject#load()
-	 */
-	@Override
-	protected boolean _load() {
-		if (this.getSelfElement() != null && this.getParent() != null) {
-			NodeList partList = getSelfElement().getChildNodes();
-			for (int i = 0; i < partList.getLength(); i++) {
-				if (partList.item(i).getNodeType() == 1) {
-					Element c = (Element) partList.item(i);
-					if (c.getNodeName().equals("part")) //$NON-NLS-1$
-					{
-						String pname = c.getAttribute("name"); //$NON-NLS-1$
-						String pshortname = c.getAttribute("shortname"); //$NON-NLS-1$
-						String pquery = c.getAttribute("query"); //$NON-NLS-1$
-						for (Part part : parts)
-							if (part.getName().equals(pname)) {
-								part.setName(pname);
-								part.setShortName(pshortname);
-								part.setQuery(pquery);
-							}
-					}
-				}
-			}
-			this.loadMetadata();
-			return true;
-		}
-
-		return false;
-	}
-
 	public TxmObject removeChildren(TxmObject children) {
 		if (children instanceof Part) {
 			if (children.getSelfElement() != null && children.getSelfElement().getParentNode() == getSelfElement())
 				getSelfElement().removeChild(children.getSelfElement());
-			parts.remove(children);
 			return children;
 		}
 		return null;
 	}
 
-	@Override
-	protected boolean _save() {
-		return false;
+	public Corpus getParent() {
+		return (Corpus) super.getParent();
 	}
 
-	@Override
-	public boolean delete() {
-		try {
-			this.getCorpus().dropPartition(this);
-			super.delete();
-			this.getSelfElement().getParentNode().removeChild(getSelfElement());
-			return true;
-		} catch (CqiClientException e) {
-			// TODO Auto-generated catch block
-			org.txm.utils.logger.Log.printStackTrace(e);
-		}
-		return false;
-	}
-
 	/**
-	 * Gets the total of all part sizes.
-	 * @return
-	 * @throws CqiClientException
-	 */
-	public int getTotalSize() throws CqiClientException {
-		if (totalsize == -1) {
-			totalsize = 0;
-			for (Part p : parts) {
-				totalsize += p.getSize();
-			}
-		}
-		return totalsize;
-	}
-
-	/**
-	 * Gets the part sizes as int array.
-	 * @return
-	 * @throws CqiClientException
-	 */
-	public int[] getPartSizes() throws CqiClientException {
-		if (partSizes != null) {
-			return partSizes;
-		}
-		partSizes = new int[getParts().size()];
-		for (int i = 0 ; i < getParts().size() ; i++) {
-			Part p = getParts().get(i);
-			partSizes[i] = p.getSize();
-		}
-		return partSizes;
-	}
-	
-	/**
 	 * Remove the specified <code>Part</code> from the partition.
 	 * @param p
 	 * @throws CqiClientException
 	 */
 	public void removePart(Part p) throws CqiClientException {
-		parts.remove(p);
+		p.delete();
 		p.dropSubcorpus(p);
 	}
 
-	@Override
-	public String getName() {
-		return this.name + ": "+ this.getNPart();
+	/**
+	 * Sets the name.
+	 *
+	 * @param name2 the new name
+	 */
+	public void setName(String name2) {
+		this.name = name2;
+		if(this.getSelfElement() != null)
+			this.getSelfElement().setAttribute("name", name); //$NON-NLS-1$
 	}
 
 
-	@Override
-	public String getSimpleName() {
-		return this.name;
+	public String toString() {
+		if (name != null) {
+			return name;
+		}
+		return super.toString();
 	}
 
+
 	@Override
-	public String getDetails() {
-		return getName();
+	public boolean toTxt(File output, String encoding, String colseparator, String txtseparator) throws Exception {
+		IOUtils.write(output, this.dumpPreferences());
+		return output.exists();
 	}
 
-	@Override
-	public void clean() {
-		// TODO Auto-generated method stub
-		
+	public boolean setParameters(String name, StructuralUnitProperty property, List<String> values) {
+		this.pProperty = property;
+		this.pValues = values;
+		this.pName = name;
+		this.pQueries = null;
+		this.pPartNames = null;
+		return true;
 	}
 
-	@Override
-	public boolean canCompute() {
-		return getCorpus() != null;
+	public boolean setParameters(String name, List<String> queries, List<String> names) {
+		this.pProperty = null;
+		this.pValues = null;
+		this.pName = name;
+		this.pQueries = queries;
+		this.pPartNames = names;
+		return true;
 	}
-	
+
 	@Override
-	protected boolean _compute() throws Exception {
-		// TODO Auto-generated method stub
+	public boolean setParameters(TXMParameters parameters) {
+		this.pName = parameters.getString(TXMPreferences.LAZY_NAME);
+		String tmp = parameters.getString(CQPPreferences.PARTNAMES);
+		if (tmp != null) {
+			this.pPartNames = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pPartNames = null;
+		}
+
+		try {
+			this.pProperty = StructuralUnitProperty.stringToStructuralUnitProperty(getParent(), parameters.getString(TXMPreferences.STRUCTURAL_UNIT_PROPERTY));
+		} catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			this.pProperty = null;
+		}
+
+		tmp = parameters.getString(CQPPreferences.QUERIES);
+		if (tmp != null) {
+			this.pQueries = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pQueries = null;
+		}
+
+		tmp = parameters.getString(CQPPreferences.VALUES);
+		if (tmp != null) {
+			this.pValues = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pValues = null;
+		}
 		return true;
 	}
 
 	@Override
-	public boolean toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception {
-		// TODO Auto-generated method stub
-		return false;
-	}
+	public boolean loadParameters() {
+		String tmp = null;
+		try {
+			tmp = this.getStringParameterValue(TBXPreferences.STRUCTURAL_UNIT_PROPERTY);
+			if (!tmp.isEmpty())	{
+				this.pProperty = StructuralUnitProperty.stringToStructuralUnitProperty(getParent(), tmp);
+			}
+		}
+		catch (CqiClientException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		tmp = this.getStringParameterValue(CQPPreferences.PARTNAMES);
+		if (tmp != null) {
+			this.pPartNames = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pPartNames = null;
+		}
 
-	
-	public String toString() {
-		if (name != null) {
-			return name;
+		tmp = this.getStringParameterValue(CQPPreferences.QUERIES);
+		if (tmp != null) {
+			this.pQueries = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pQueries = null;
 		}
-		return super.toString();
+
+		tmp = this.getStringParameterValue(CQPPreferences.VALUES);
+		if (tmp != null) {
+			this.pValues = Arrays.asList(tmp.split("\t"));
+		} else {
+			this.pValues = null;
+		}
+		return true;
 	}
-	
 
 	@Override
-	public int compareTo(TXMResult o) {
-		// Compare node weights
-		int output = super.compareTo(o);
-		// Compare simple names if weights are equal
-		if(output == 0)	{
-			output = this.getSimpleName().compareToIgnoreCase(o.getSimpleName());
+	public boolean saveParameters() {
+
+		if (this.pProperty != null)	{
+			this.saveParameter(TBXPreferences.STRUCTURAL_UNIT_PROPERTY, this.pProperty.getName());
 		}
-		return output;
+		
+		if (this.pPartNames != null)	{
+			this.saveParameter(CQPPreferences.PARTNAMES, StringUtils.join(pPartNames, "\t"));
+		}
+		
+		if (this.pQueries != null)	{
+			this.saveParameter(TBXPreferences.QUERIES, StringUtils.join(pQueries, "\t"));
+		}
+		
+		if (this.pValues != null)	{
+			this.saveParameter(TBXPreferences.VALUES, StringUtils.join(pValues, "\t"));
+		}
+
+		return true;
 	}
 
-	
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java	(revision 1007)
@@ -136,67 +136,15 @@
 	 *             the invalid cqp id exception
 	 */
 	protected Corpus(String cqpId) throws InvalidCqpIdException {
-		super(null, null);
+		super(null, null, cqpId);
 		checkCqpId(cqpId);
 		this.cqpId = cqpId;
 		
 		// FIXME: at this moment, store the CQPID as UUIDD for persistence tests
-		this.uniqueID = this.cqpId;
+		//this.uniqueID = this.cqpId;
 	}
 	
 	/**
-	 * Creates a partition using a list of CQP queries.
-	 *
-	 * @param name the name
-	 * @param queries the queries
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(String name, List<String> queries)
-			throws CqiClientException {
-		Partition partition = createPartition(name, queries, false);
-		return partition;
-	}
-
-	/**
-	 * Creates a partition using a list of CQP queries and save the Partition configuration in Workspace.
-	 * 
-	 * <strong>warning</strong> : this partition is not guaranteed to cover the
-	 * whole corpus neither to be non-intersecting.
-	 *
-	 * @param name the name
-	 * @param queries the queries
-	 * @param registered the registered
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(String name, List<String> queries, boolean registered) throws CqiClientException {
-		Partition partition = new Partition(this, name, queries);
-		if (!registered) {
-			partition.registerToParent();
-		}
-		return partition;
-	}
-
-	/**
-	 * Create a partition from a set of queries and names.
-	 * 
-	 * <strong>warning</strong> : this partition is not guaranteed to cover the
-	 * whole corpus neither to be non-intersecting.
-	 *
-	 * @param name the name
-	 * @param queries the queries
-	 * @param partnames the partnames
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(String name, List<String> queries,
-			List<String> partnames) throws CqiClientException {
-		Partition p = createPartition(name, queries, partnames, false);
-		return p;
-	}
-
-	/**
 	 * Creates a partition using a list of CQP queries and names each part.
 	 *
 	 * @param name the name
@@ -208,158 +156,37 @@
 	 */
 	public Partition createPartition(String name, List<String> queries,
 			List<String> partnames, boolean registered)
-					throws CqiClientException {
-		Partition partition = new Partition(this, name, queries, partnames);
+					throws Exception {
+		Partition partition = new Partition(this);
+		partition.setParameters(name, queries, partnames);
+		partition.compute();
 		if (!registered)
 			partition.registerToParent();
 		return partition;
 	}
 
 	/**
-	 * Create a partition with all values of a structural unit property.
+	 * Creates the partition.
 	 *
-	 * @param name the name
 	 * @param structure the structure
 	 * @param property the property
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(String name, StructuralUnit structure,
-			StructuralUnitProperty property) throws CqiClientException {
-		Partition partition = createPartition(structure, property);
-		partition.setName(name);
-		return partition;
-	}
-
-	/**
-	 * Create a partition with a set of values of a structural unit property.
-	 *
-	 * @param name the name
-	 * @param structure the structure
-	 * @param property the property
 	 * @param values the values
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(String name, StructuralUnit structure,
-			StructuralUnitProperty property, List<String> values)
-					throws CqiClientException {
-		Partition partition = createPartition(name, structure, property,
-				values, false);
-		return partition;
-	}
-
-	/**
-	 * Create a partition with a set of values of a structural unit property.
-	 * save result configuration in Workspace
-	 *
-	 * @param name the name
-	 * @param structure the structure
-	 * @param property the property
-	 * @param values the values
 	 * @param registered the registered
 	 * @return the partition
 	 * @throws CqiClientException the cqi client exception
 	 */
 	public Partition createPartition(String name, StructuralUnit structure,
 			StructuralUnitProperty property, List<String> values,
-			boolean registered) throws CqiClientException {
-		Partition partition = createPartition(structure, property, values,
-				registered);
-		if (name != null)
-			partition.setName(name);
-		return partition;
-	}
-
-	/**
-	 * Creates a new partition from a structural unit and a property of this
-	 * structural unit. One part is created for each possible value of the
-	 * property.
-	 * 
-	 * @param structure
-	 *            the structure
-	 * @param property
-	 *            the property
-	 * 
-	 * @return the partition
-	 * 
-	 * @throws CqiClientException
-	 *             the cqi client exception
-	 * 
-	 * @see org.txm.searchengine.cqp.corpus.partition.core.corpusengine.cqp.corpus.Partition#Partition
-	 */
-	public Partition createPartition(StructuralUnit structure,
-			StructuralUnitProperty property) throws CqiClientException {
-		Partition partition = createPartition(structure, property, false);
-		return partition;
-	}
-	/**
-	 * Creates the partition.
-	 *
-	 * @param structure the structure
-	 * @param property the property
-	 * @param registered the registered
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(StructuralUnit structure,
-			StructuralUnitProperty property, boolean registered)
-					throws CqiClientException {
-		Partition partition = new Partition(this, structure, property);
+			boolean registered) throws Exception {
+		Partition partition = new Partition(this);
+		partition.setParameters(name, property, values);
+		partition.compute();
 		if (!registered)
 			partition.registerToParent();
 		return partition;
 	}
-	
 
 	/**
-	 * Creates a new partition from a structural unit, a property of this
-	 * structural unit and a list of possible values for the property. One part
-	 * per value is created. <strong>warning</strong> : this partition is not
-	 * guaranteed to cover the whole corpus
-	 * 
-	 * @param structure
-	 *            the structure
-	 * @param property
-	 *            the property
-	 * @param values
-	 *            the values
-	 * 
-	 * @return the partition
-	 * 
-	 * @throws CqiClientException
-	 *             the cqi client exception
-	 * 
-	 * @see org.txm.searchengine.cqp.corpus.partition.core.corpusengine.cqp.corpus.Partition#Partition
-	 */
-	public Partition createPartition(StructuralUnit structure,
-			StructuralUnitProperty property, List<String> values)
-					throws CqiClientException {
-		Partition partition = createPartition(structure, property, values,
-				false);
-		return partition;
-	}
-
-	/**
-	 * Creates the partition.
-	 *
-	 * @param structure the structure
-	 * @param property the property
-	 * @param values the values
-	 * @param registered the registered
-	 * @return the partition
-	 * @throws CqiClientException the cqi client exception
-	 */
-	public Partition createPartition(StructuralUnit structure,
-			StructuralUnitProperty property, List<String> values,
-			boolean registered) throws CqiClientException {
-		Partition partition = new Partition(this, structure, property, values);
-		if (!registered)
-			partition.registerToParent();
-		return partition;
-	}
-
-	/**
 	 * Creates a subcorpus using workspace definition.
 	 *
 	 * @param elem the XML element
@@ -1021,7 +848,7 @@
 					Partition partition = this.createPartition(name, queries, names, true);
 					partition.setSelfElement(partitionElem);
 					partition.load();
-				} catch (CqiClientException e) {
+				} catch (Exception e) {
 					Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
 							+ " : " + e); //$NON-NLS-1$
 					//c.getParentNode().removeChild(c);
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java	(revision 1007)
@@ -80,7 +80,7 @@
 	}
 
 	/**
-	 * Gets the full name: struct_propname
+	 * Gets the full name: "struct_propname"
 	 *
 	 * @return the full name
 	 */
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 1006)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 1007)
@@ -18,6 +18,11 @@
 	public static String PREFERENCES_NODE = FrameworkUtil.getBundle(CQPPreferences.class).getSymbolicName();
 
 	public static final String PREFERENCES_PREFIX = "cqp_"; //$NON-NLS-1$
+
+	/**
+	 * List of part names
+	 */
+	public static final String PARTNAMES = "part_names";
 	
 
 	@Override
