Révision 1038

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1038)
15 15
import org.txm.core.preferences.TXMPreferences;
16 16
import org.txm.importer.cwb.PatchCwbRegistry;
17 17
import org.txm.libs.cqp.CQPLibPreferences;
18
import org.txm.objects.Base;
18
import org.txm.objects.Project;
19 19
import org.txm.searchengine.core.SearchEngine;
20 20
import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
21 21
import org.txm.searchengine.cqp.corpus.CorpusManager;
......
64 64

  
65 65
		String reg_path = ""; // new way that concats registry of loaded corpus
66 66
		String path_separator = System.getProperty("path.separator");
67
		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
68
			File binDir = b.getBaseDirectory();
67
		for (Project b : Toolbox.workspace.getProjects()) {
68
			File binDir = b.getProjectDirectory();
69 69
			File registryDir = new File(binDir, "registry");
70 70
			reg_path += path_separator + registryDir.getAbsolutePath();
71 71
			File[] files = registryDir.listFiles();
......
200 200

  
201 201
		// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
202 202
		System.out.print(TXMCoreMessages.Toolbox_workspace_init);
203
		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
203
		for (Project b : Toolbox.workspace.getProjects()) {
204 204
			
205 205
			Log.info("Loading CQP corpora of " + b.getName() + " corpus...");
206 206
			
......
214 214
		return state;
215 215
	}
216 216

  
217
	public boolean loadCQPCorpora(Base base, IProgressMonitor monitor) {
217
	public boolean loadCQPCorpora(Project base, IProgressMonitor monitor) {
218 218
		//System.out.println("Load corpus from params: "+params.corpora);
219
		for (String corpusname : base.getBaseParameters().corpora.keySet()) {
220
			Element c = base.getBaseParameters().corpora.get(corpusname);
219
		for (String corpusname : base.getProjectParameters().corpora.keySet()) {
220
			Element c = base.getProjectParameters().corpora.get(corpusname);
221 221
			try {
222 222
				MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
223 223
				if (monitor != null) {
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/selection/Selection.java (revision 1038)
115 115
	 */
116 116
	private boolean init() {
117 117
		try {
118
			if (corpus.getBase() == null) {
118
			if (corpus.getProject() == null) {
119 119
				System.out.println(TXMCoreMessages.Selection_6+corpus+TXMCoreMessages.Selection_7);
120 120
				return false;
121 121
			}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java (revision 1038)
40 40
import org.txm.core.messages.TXMCoreMessages;
41 41
import org.txm.core.preferences.TXMPreferences;
42 42
import org.txm.core.results.TXMResult;
43
import org.txm.objects.Base;
43
import org.txm.objects.Project;
44 44
import org.txm.objects.TxmObject;
45 45
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
46 46
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
......
459 459
	 * @return the base
460 460
	 */
461 461
	@Override
462
	public abstract Base getBase();
462
	public abstract Project getProject();
463 463

  
464 464
	/**
465 465
	 * Get the charset set in the CQP registry file.
......
909 909
	 */
910 910
	@Override
911 911
	public TxmObject removeChildren(TxmObject children) {
912
		Element preBuildElement = this.getBase().getBaseParameters().getPreBuildElement();
912
		Element preBuildElement = this.getProject().getProjectParameters().getPreBuildElement();
913 913
		if (children instanceof Subcorpus) {
914 914
			try {
915 915
				if (children.getSelfElement() != null && 
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/creationdelete partition et subcorpus.java (revision 1038)
1
//import org.eclipse.osgi.util.NLS;
2
//import org.txm.core.messages.TXMCoreMessages;
3
//import org.txm.searchengine.cqp.CQPSearchEngine;
4
//import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
5
//import org.txm.searchengine.cqp.corpus.query.Query;
6
//import org.txm.utils.logger.Log;
7
//import org.w3c.dom.Element;
8
//import org.w3c.dom.NodeList;
9

  
10
//import java.util.ArrayList;
11
//import java.util.List;
12
//
13
//import org.txm.core.messages.TXMCoreMessages;
14
//import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
15
//import org.txm.searchengine.cqp.corpus.query.Query;
16
//import org.txm.utils.logger.Log;
17
//import org.w3c.dom.Element;
18
//import org.w3c.dom.NodeList;
19

  
20
//
21
//import java.util.List;
22
//
23
//import org.eclipse.osgi.util.NLS;
24
//import org.txm.core.messages.TXMCoreMessages;
25
//import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
26
//import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
27
//import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
28
//import org.txm.searchengine.cqp.corpus.query.Query;
29
//import org.txm.searchengine.cqp.corpus.query.QueryPart;
30
//import org.txm.utils.logger.Log;
31
//import org.w3c.dom.Element;
32
//
33
//
34
//
35
//	
36
//	/**
37
//	 * Creates a partition using a list of CQP queries and names each part.
38
//	 *
39
//	 * @param name the name
40
//	 * @param queries the queries
41
//	 * @param partnames the partnames
42
//	 * @param registered the registered
43
//	 * @return the partition
44
//	 * @throws CqiClientException the cqi client exception
45
//	 */
46
//	public Partition createPartition(String name, List<String> queries, List<String> partnames, boolean registered) throws Exception {
47
//		Partition partition = new Partition(this);
48
//		partition.setParameters(name, queries, partnames);
49
//		partition.compute();
50
//		if (!registered) {
51
//			partition.registerToParent();
52
//		}
53
//		return partition;
54
//	}
55
//
56
//	/**
57
//	 * Creates the partition.
58
//	 *
59
//	 * @param structure the structure
60
//	 * @param property the property
61
//	 * @param values the values
62
//	 * @param registered the registered
63
//	 * @return the partition
64
//	 * @throws CqiClientException the cqi client exception
65
//	 */
66
//	public Partition createPartition(String name, StructuralUnit structure, StructuralUnitProperty property, List<String> values, boolean registered) throws Exception {
67
//		Partition partition = new Partition(this);
68
//		partition.setParameters(name, property, values);
69
//		partition.compute();
70
//		if (!registered) {
71
//			partition.registerToParent();
72
//		}
73
//		return partition;
74
//	}
75
//
76
//	/**
77
//	 * Creates a subcorpus using workspace definition.
78
//	 *
79
//	 * @param elem the XML element
80
//	 * @return the subcorpus
81
//	 * @throws CqiClientException the cqi client exception
82
//	 */
83
//	public Subcorpus createSubcorpus(Element elem) throws CqiClientException {
84
//		Query query = new Query(elem.getAttribute("query")); //$NON-NLS-1$
85
//		String subcorpusName = elem.getAttribute("name"); //$NON-NLS-1$
86
//
87
//		Subcorpus subcorpus;
88
//		String subcorpusCqpId = subcorpusNamePrefix	+ getNextSubcorpusCounter();
89
//
90
//		// long start = System.currentTimeMillis();
91
//		try {
92
//			CQPSearchEngine.getCqiClient().cqpQuery(this.getQualifiedCqpId(), subcorpusCqpId,
93
//					query.getQueryString());
94
//			subcorpus = new Subcorpus(subcorpusCqpId, subcorpusName, this, query);
95
//			subcorpus.setSelfElement(elem);
96
//		} catch (Exception e) {
97
//			throw new CqiClientException(e);
98
//		}
99
//
100
//		return subcorpus;
101
//	}
102
//
103
//	/**
104
//	 * Create a named subcorpus from a query on this corpus.
105
//	 * 
106
//	 * @param query
107
//	 *            the query
108
//	 * @param subcorpusName
109
//	 *            the resulting subcorpus name
110
//	 * 
111
//	 * @return the resulting subcorpus
112
//	 * 
113
//	 * @throws CqiClientException
114
//	 *             the cqi client exception
115
//	 */
116
//	public Subcorpus createSubcorpus(Query query, String subcorpusName)
117
//			throws CqiClientException {
118
//		Subcorpus sc = createSubcorpus(query, subcorpusName, false);
119
//		return sc;
120
//	}
121
//
122
//	/**
123
//	 * Creates a subcorpus and save configuration in the workspace.
124
//	 *
125
//	 * @param query the query
126
//	 * @param subcorpusName the subcorpus name
127
//	 * @param registered the registered
128
//	 * @return the subcorpus
129
//	 * @throws CqiClientException the cqi client exception
130
//	 */
131
//	public Subcorpus createSubcorpus(Query query, String subcorpusName,
132
//			boolean registered) throws CqiClientException {
133
//		Subcorpus subcorpus;
134
//		String subcorpusCqpId = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
135
//		Log.finest(TXMCoreMessages.CREATING_SUBCORPUS + this.getQualifiedCqpId()
136
//				+ " " + subcorpusName + " " + query.getQueryString()); //$NON-NLS-1$ //$NON-NLS-2$
137
//
138
//		long start = System.currentTimeMillis();
139
//		try {
140
//			CQPSearchEngine.getCqiClient().cqpQuery(
141
//					this.getQualifiedCqpId(), subcorpusCqpId,
142
//					query.getQueryString());
143
//			//System.out.println("SUBCORPUS: "+subcorpusCqpId+" q="+query.getQueryString());
144
//			subcorpus = new Subcorpus(subcorpusCqpId, subcorpusName, this, query);
145
//		} catch (Exception e) {
146
//			throw new CqiClientException(e);
147
//		}
148
//		long end = System.currentTimeMillis();
149
//		Log.finest(TXMCoreMessages.SUBCORPUS_CREATED + subcorpusName
150
//				+ TXMCoreMessages.Corpus_8 + (end - start));
151
//
152
//		if (!registered) subcorpus.registerToParent();
153
//		return subcorpus;
154
//	}
155
//
156
//	public Subcorpus createSubcorpus(String name, QueryResult queryResult) throws InvalidCqpIdException {
157
//		Subcorpus sub = new Subcorpus(queryResult.getCqpId(), name, this, null);
158
//		return sub;
159
//	}
160
//
161
//	public Subcorpus createSubcorpus(String name, String cqpid) throws InvalidCqpIdException {
162
//		Subcorpus sub = new Subcorpus(cqpid, name, this, null);
163
//		return sub;
164
//	}
165
//	
166
//	/**
167
//	 * Creates the subcorpus.
168
//	 *
169
//	 * @param elem the elem
170
//	 * @return the subcorpus
171
//	 * @throws CqiClientException the cqi client exception
172
//	 */
173
//	public Subcorpus createSubcorpus(String name, SelectionResult selectionResult) throws CqiClientException {
174
//		Subcorpus sub = createSubcorpus(this.getStructuralUnit("text"), this.getStructuralUnit("text").getProperty("id"), selectionResult, name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
175
//		sub.setSelectionResult(selectionResult);
176
//		return sub;
177
//	}
178
//	
179
//	/**
180
//	 * Creates the subcorpus.
181
//	 *
182
//	 * @param structuralUnit the structural unit
183
//	 * @param structuralUnitProperty the structural unit property
184
//	 * @param values the values
185
//	 * @param subcorpusName the subcorpus name
186
//	 * @return the subcorpus
187
//	 * @throws CqiClientException the cqi client exception
188
//	 */
189
//	public Subcorpus createSubcorpus(StructuralUnit structuralUnit,
190
//			StructuralUnitProperty structuralUnitProperty, List<String> values,
191
//			String subcorpusName) throws CqiClientException {
192
//		if (values.size() == 0) {
193
//			Log.warning(TXMCoreMessages.Corpus_5);
194
//			return null;
195
//		}
196
//		String value = ""; //$NON-NLS-1$
197
//		for (String v : values)
198
//			value += Query.addBackSlash(v) + "|"; //$NON-NLS-1$
199
//		value = value.substring(0, value.length() - 1);
200
//		
201
//		Query query = new QueryPart(structuralUnit, structuralUnitProperty, value);
202
//		return createSubcorpus(query, subcorpusName);
203
//		//return createSubcorpus(structuralUnit, structuralUnitProperty, value, subcorpusName);
204
//	}
205
//
206
//	/**
207
//	 * Create a subcorpus from a structural unit, a property on this structural
208
//	 * unit and a value for this property.
209
//	 *
210
//	 * @param structuralUnit the structural unit
211
//	 * @param structuralUnitProperty the structural unit property
212
//	 * @param value the value
213
//	 * @param subcorpusName the subcorpus name
214
//	 * @return the subcorpus
215
//	 * @throws CqiClientException the cqi client exception
216
//	 * @author Sylvain Loiseau
217
//	 */
218
//	public Subcorpus createSubcorpus(StructuralUnit structuralUnit,
219
//			StructuralUnitProperty structuralUnitProperty, String value,
220
//			String subcorpusName) throws CqiClientException {
221
//		Query query = new QueryPart(structuralUnit, structuralUnitProperty,
222
//				Query.addBackSlash(value));
223
//		// System.out.println("forged query : "+query.getQueryString());
224
//		return createSubcorpus(query, subcorpusName);
225
//	}
226
//
227
//	/**
228
//	 * Create a subcorpus from a structural unit, a property on this structural
229
//	 * unit and a value for this property.
230
//	 *
231
//	 * @param structuralUnit the structural unit
232
//	 * @param structuralUnitProperty the structural unit property
233
//	 * @param value the value
234
//	 * @param subcorpusName the subcorpus name
235
//	 * @return the subcorpus
236
//	 * @throws CqiClientException the cqi client exception
237
//	 * @author Sylvain Loiseau
238
//	 */
239
//	public Subcorpus createSubcorpusWithQueryString(StructuralUnit structuralUnit,
240
//			StructuralUnitProperty structuralUnitProperty, String value,
241
//			String subcorpusName) throws CqiClientException {
242
//		Query query = new QueryPart(structuralUnit, structuralUnitProperty,
243
//				value);
244
//		// System.out.println("forged query : "+query.getQueryString());
245
//		return createSubcorpus(query, subcorpusName);
246
//	}
247
//
248
//	/**
249
//	 * Drop all the partitions.
250
//	 * 
251
//	 * @throws CqiClientException
252
//	 *             the cqi client exception
253
//	 */
254
//	public void dropAllPartitions() throws CqiClientException {
255
//		List<Partition> _partitions = (List<Partition>) getChildren(Partition.class);
256
//		for (Partition partition : _partitions) {
257
//			this.dropPartition(partition);
258
//		}
259
//		_partitions = null;
260
//	}
261
//
262
//	/**
263
//	 * Drop all the subcorpora.
264
//	 * 
265
//	 * @throws CqiClientException
266
//	 *             the cqi client exception
267
//	 */
268
//	public void dropAllSubcorpora() throws CqiClientException {
269
//		//System.out.println("!! drop all subcorpora: "+subcorpora.size());
270
//		List<Subcorpus> subcorpora = getSubcorpora();
271
//		while(subcorpora.size() > 0) {
272
//			this.dropSubcorpus(subcorpora.get(0));
273
//		}
274
//	}
275
//
276
//	/**
277
//	 * Drops a partition.
278
//	 * 
279
//	 * @param partition
280
//	 *            the partition
281
//	 * 
282
//	 * @throws CqiClientException
283
//	 *             the cqi client exception
284
//	 */
285
//	public void dropPartition(Partition partition) throws CqiClientException {
286
//		Log.finest(TXMCoreMessages.info_deletingPartition + partition.getName());
287
//		for (Part part : partition.getParts())
288
//			try {
289
//				CQPSearchEngine.getCqiClient().dropSubCorpus(part.getQualifiedCqpId());
290
//			} catch (Exception e) {
291
//				throw new CqiClientException(e);
292
//			}
293
//	}
294
//
295
//	/**
296
//	 * Drop query result.
297
//	 * 
298
//	 * @param queryResult
299
//	 *            the query result
300
//	 * 
301
//	 * @throws CqiClientException
302
//	 *             the cqi client exception
303
//	 */
304
//	public void dropQueryResult(QueryResult queryResult)
305
//			throws CqiClientException {
306
//		Log.finest(TXMCoreMessages.DROP_QUERYRESULT + queryResult.getName());
307
//		try {
308
//			CQPSearchEngine.getCqiClient().dropSubCorpus(queryResult.getQualifiedCqpId());
309
//		} catch (Exception e) {
310
//			throw new CqiClientException(e);
311
//		}
312
//	}
313
//
314
//	/**
315
//	 * Drops a subcorpus in CQP also its subcorpus and partitions.
316
//	 * 
317
//	 * @param subcorpus
318
//	 *            the subcorpus
319
//	 * 
320
//	 * @throws CqiClientException
321
//	 *             the cqi client exception
322
//	 */
323
//	public boolean dropSubcorpus(Corpus subcorpus) throws CqiClientException {
324
//		Log.finest(NLS.bind(TXMCoreMessages.DROP_SUBCORPUS, subcorpus.getName()));
325
//		subcorpus.dropAllSubcorpora();
326
//		subcorpus.dropAllPartitions();
327
//		try {
328
//			CQPSearchEngine.getCqiClient().dropSubCorpus(subcorpus.getQualifiedCqpId());
329
//		} catch (Exception e) {
330
//			throw new CqiClientException(e);
331
//		}
332
//		return true;
333
//	}
334
//
335
//
336
//
337
//
338

  
339
//	/* (non-Javadoc)
340
//	 * @see org.txm.objects.TxmObject#load()
341
//	 */
342
//	protected boolean _loadCorpus() {
343
//		//System.out.println("*** Load corpus: "+name);
344
//		if (getSelfElement() == null) {
345
//			System.out.println(TXMCoreMessages.Corpus_14+this+TXMCoreMessages.Corpus_15);
346
//			return false;
347
//		}
348
//
349
//		// 1- texts queries then
350
//		// 2- get metadatas, pattributes, sattributes, editions, biblios,  uis,
351
//		super._load();  
352
//		// System.out.println("Load corpus : "+this.name);
353
//		this.loadMetadata(); // read <prop>s
354
//
355
//		// 3- build saved subcorpus and partition
356
//		//System.out.println("restore subcorpora: "+selfElement);
357
//		NodeList preBuildElems = getSelfElement().getElementsByTagName("preBuild"); //$NON-NLS-1$
358
//		if (preBuildElems.getLength() > 0) {
359
//			Element preBuildElem = (Element) preBuildElems.item(0);
360
//			NodeList subcorpusElems = preBuildElem.getElementsByTagName("subcorpus"); //$NON-NLS-1$
361
//			for (int i = 0 ; i < subcorpusElems.getLength() ; i++) {
362
//				Element subcorpusElem = (Element) subcorpusElems.item(i);
363
//				if (!subcorpusElem.getParentNode().equals(preBuildElem)) continue; //level 1 elements
364
//				//System.out.println("subcorpus "+subcorpusElem.getAttribute("name"));
365
//				try {
366
//					Subcorpus subcorp = this.createSubcorpus(subcorpusElem);
367
//					subcorp.load(subcorpusElem);
368
//				} catch (CqiClientException e) {
369
//					Log.warning(this.name + TXMCoreMessages.Corpus_12 + name
370
//							+ " : " + e); //$NON-NLS-1$
371
//				}
372
//			}
373
//
374
//			NodeList partitionElems = preBuildElem.getElementsByTagName("partition"); //$NON-NLS-1$
375
//			for (int i = 0 ; i < partitionElems.getLength() ; i++) {
376
//				Element partitionElem = (Element) partitionElems.item(i);
377
//				if (!partitionElem.getParentNode().equals(preBuildElem)) continue; //level 1 elements
378
//				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
379
//				List<String> names = new ArrayList<String>();
380
//				List<String> queries = new ArrayList<String>();
381
//
382
//				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
383
//				for (int j = 0; j < partElems.getLength(); j++) {
384
//					Element part = (Element) partElems.item(j);
385
//					names.add(part.getAttribute("name")); //$NON-NLS-1$
386
//					queries.add(part.getAttribute("query")); //$NON-NLS-1$
387
//				}
388
//				try {
389
//					//System.out.println("Create Partition with corpus "+this+" : "+name+", queries "+queries+", names "+names);
390
//					Partition partition = this.createPartition(name, queries, names, true);
391
//					partition.load(partitionElem);
392
//				} catch (Exception e) {
393
//					Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
394
//							+ " : " + e); //$NON-NLS-1$
395
//					//c.getParentNode().removeChild(c);
396
//				}
397
//			}
398
//		}
399
//
400
//		return true;
401
//	}
402

  
403

  
404
///*
405
// * (non-Javadoc)
406
// * 
407
// * @see org.txm.searchengine.cqp.corpus.Corpus#getLocale()
408
// */
409
//@Override
410
//protected boolean _loadSubcorpus() {
411
//	if (getSelfElement() != null) {
412
//		this.query = new Query(getSelfElement().getAttribute("query")); //$NON-NLS-1$
413
//
414
//		NodeList subcorpusElems = getSelfElement().getElementsByTagName("subcorpus"); //$NON-NLS-1$
415
//		for (int i = 0 ; i < subcorpusElems.getLength() ; i++) {
416
//			Element subcorpusElem = (Element) subcorpusElems.item(i);
417
//			try {
418
//				Subcorpus subcorp = this.createSubcorpus(subcorpusElem);
419
//				subcorp.load(subcorpusElem);
420
//			} catch (CqiClientException e) {
421
//				Log.warning(this.name + TXMCoreMessages.Corpus_12 + name
422
//						+ " : " + e); //$NON-NLS-1$
423
//			}
424
//		}
425
//
426
//		NodeList partitionElems = getSelfElement().getElementsByTagName("partition"); //$NON-NLS-1$
427
//		for (int i = 0 ; i < partitionElems.getLength() ; i++) {
428
//			Element partitionElem = (Element) partitionElems.item(i);
429
//			String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
430
//			List<String> names = new ArrayList<String>();
431
//			List<String> queries = new ArrayList<String>();
432
//
433
//			NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
434
//			for (int j = 0; j < partElems.getLength(); j++) {
435
//				Element part = (Element) partElems.item(j);
436
//				names.add(part.getAttribute("name")); //$NON-NLS-1$
437
//				queries.add(part.getAttribute("query")); //$NON-NLS-1$
438
//			}
439
//			try {
440
//				//System.out.println("Create Partition with corpus "+this+" : "+name+", queries "+queries+", names "+names);
441
//				Partition partition = this.createPartition(name, queries, names, true);
442
//				partition.load(partitionElem);
443
//			} catch (Exception e) {
444
//				Log.warning(this.name + TXMCoreMessages.Corpus_19 + name
445
//						+ " : " + e); //$NON-NLS-1$
446
//				//c.getParentNode().removeChild(c);
447
//			}
448
//		}
449
//	}
450
//	initSelectionResult();
451
//	//System.out.println("Subcorpus.load: Selection of "+this+" = "+selectionResult);
452
//	//return super.load();
453
//	return true;
454
//}
455

  
456
//	/* (non-Javadoc)
457
//	 * @see org.txm.objects.TxmObject#load()
458
//	 */
459
//	@Override
460
//	protected boolean _loadPartition() {
461
//		if (this.getUUID().length() > 0) return true; // partition already persisted
462
//
463
//		if (this.hasBeenComputedOnce) return true; // partition already computed
464
//		
465
//		if (this.getSelfElement() != null && this.getParent() != null) {
466
//			NodeList partList = getSelfElement().getChildNodes();
467
//			for (int i = 0; i < partList.getLength(); i++) {
468
//				if (partList.item(i).getNodeType() == 1) {
469
//					Element c = (Element) partList.item(i);
470
//					if (c.getNodeName().equals("part")) //$NON-NLS-1$
471
//					{
472
//						String pname = c.getAttribute("name"); //$NON-NLS-1$
473
//						String pshortname = c.getAttribute("shortname"); //$NON-NLS-1$
474
//						String pquery = c.getAttribute("query"); //$NON-NLS-1$
475
//						for (Part part : getParts())
476
//							if (part.getName().equals(pname)) {
477
//								part.setName(pname);
478
//								part.setShortName(pshortname);
479
//								part.setQuery(pquery);
480
//							}
481
//					}
482
//				}
483
//			}
484
//			this.loadMetadata();
485
//			return true;
486
//		}
487
//
488
//		return false;
489
//	}
490

  
491

  
492
///**
493
// * Creates the part.
494
// *
495
// * @param partitionName the partition name
496
// * @param partName the part name
497
// * @param query the query
498
// * @return the part
499
// * @throws CqiClientException the cqi client exception
500
// */
501
//private Part createPart(String partitionName, String partName, Query query)	throws CqiClientException {
502
//	if (partName.length() == 0) {
503
//		partName = "-"; //$NON-NLS-1$
504
//	}
505
//	return createPart(partitionName, partName, query.getQueryString());
506
//}
507
//
508
///**
509
// * Create a part with a raw query.
510
// *
511
// * @param partitionName the partition name
512
// * @param partName the part name
513
// * @param query the query
514
// * @return the part
515
// * @throws CqiClientException the cqi client exception
516
// * 
517
// * @author Sylvain Loiseau, mdecorde
518
// */
519
//public Part createPart(String partitionName, String partName, String query) throws CqiClientException {
520
//	Part part;
521
//	String partCqpId = CqpObject.partNamePrefix + Corpus.getNextSubcorpusCounter();
522
//	Log.finest(NLS.bind(TXMCoreMessages.CREATING_PART,partName, query));
523
//	long start = System.currentTimeMillis();
524
//	try {
525
//		CQPSearchEngine.getCqiClient().cqpQuery(this.getParent().getQualifiedCqpId(), partCqpId, query);
526
//		part = new Part(partCqpId, partitionName, partName, this, new Query(query));
527
//
528
//		// FIXME: persistence tests: define the UUID as the concatenation of all part CQP id
529
////		this.uniqueID += partCqpId;
530
//
531
//	} catch (Exception e) {
532
//		try {
533
//			throw new CqiClientException(TXMCoreMessages.Partition_9 + partitionName + "_" + partName + e + " last error: " + CQPSearchEngine.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
534
//		} catch (Exception e1) {
535
//			System.out.println(TXMCoreMessages.Partition_18+e1);
536
//			org.txm.utils.logger.Log.printStackTrace(e1);
537
//			return null;
538
//		}
539
//	}
540
//	long end = System.currentTimeMillis();
541
//	Log.finest(NLS.bind(TXMCoreMessages.info_partCreatedInXMs, partitionName + "_" + partName, (end - start))); //$NON-NLS-1
542
//
543
//	return part;
544
//}
0 545

  
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 1038)
40 40

  
41 41
import org.eclipse.core.runtime.IProgressMonitor;
42 42
import org.txm.core.messages.TXMCoreMessages;
43
import org.txm.objects.Base;
43
import org.txm.objects.Project;
44 44
import org.txm.objects.TxmObject;
45 45
import org.txm.searchengine.cqp.AbstractCqiClient;
46 46
import org.txm.searchengine.cqp.CQPSearchEngine;
......
111 111
	@Override
112 112
	public boolean export(File exportzip, IProgressMonitor monitor)
113 113
	{
114
		if (this.getBase() != null)
115
			return this.getBase().export(exportzip, monitor);
114
		if (this.getProject() != null)
115
			return this.getProject().export(exportzip, monitor);
116 116
		return false;
117 117
	}
118 118
	
......
340 340
		boolean ret = super._load();
341 341
		
342 342
		// FIXME: test to create a project scope
343
//		CorpusScope scope = new CorpusScope(this.getName(), this.getBaseDirectory());
343
//		CorpusScope scope = new CorpusScope(this.getName(), this.getProjectDirectory());
344 344
//		CorpusScope.addScope(scope);
345 345
		
346 346
		return ret;
......
353 353
	@Override
354 354
	public boolean delete() {
355 355
		removeFromCWB();
356
		Base b = this.getBase();
356
		Project b = this.getProject();
357 357
		if (b != null) b.delete();
358 358
		
359 359
		// FIXME: test to remove the project scope
......
376 376
	 *
377 377
	 * @param base the new parent
378 378
	 */
379
	public void setParent(Base base) {
379
	public void setParent(Project base) {
380 380
		this.parent = base;
381 381
	}
382 382

  
......
398 398
		CorpusManager.deleteCorpus(this);
399 399

  
400 400
		// delete binaries
401
		File binaries = this.getBaseDirectory();
401
		File binaries = this.getProjectDirectory();
402 402
		System.out.println(TXMCoreMessages.MainCorpus_2+binaries);
403 403
		return DeleteDir.deleteDirectory(binaries);
404 404
	}
405 405

  
406 406
	/* (non-Javadoc)
407
	 * @see org.txm.searchengine.cqp.corpus.Corpus#getBase()
407
	 * @see org.txm.searchengine.cqp.corpus.Corpus#getProject()
408 408
	 */
409 409
	@Override
410
	public Base getBase() {
411
		return (Base) getParent();
410
	public Project getProject() {
411
		return (Project) getParent();
412 412
	}
413 413

  
414 414

  
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 1038)
34 34
import org.eclipse.osgi.util.NLS;
35 35
import org.txm.core.messages.TXMCoreMessages;
36 36
import org.txm.core.results.TXMParameters;
37
import org.txm.objects.Base;
37
import org.txm.objects.Project;
38 38
import org.txm.objects.TxmObject;
39 39
import org.txm.searchengine.cqp.AbstractCqiClient;
40 40
import org.txm.searchengine.cqp.NetCqiClient;
......
381 381
	}
382 382

  
383 383
	/* (non-Javadoc)
384
	 * @see org.txm.searchengine.cqp.corpus.Corpus#getBase()
384
	 * @see org.txm.searchengine.cqp.corpus.Corpus#getProject()
385 385
	 */
386 386
	@Override
387
	public Base getBase() {
387
	public Project getProject() {
388 388
		TxmObject o = getParent();
389
		if (o instanceof Base)
390
			return (Base)o;
389
		if (o instanceof Project)
390
			return (Project)o;
391 391
		else if (o instanceof Corpus)
392
			return ((Corpus)o).getBase();
392
			return ((Corpus)o).getProject();
393 393
		else 	
394 394
			return null;
395 395
	}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/SubcorpusSelectionResult.java (revision 1038)
1
package org.txm.searchengine.cqp.corpus;
2

  
3
import java.util.ArrayList;
4

  
5
//import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
6
import org.w3c.dom.Document;
7
import org.w3c.dom.Element;
8
import org.w3c.dom.NodeList;
9

  
10
public class SubcorpusSelectionResult {
11
//	public void setSelectionResult(SelectionResult selectionResult) {
12
//		this.selectionResult = selectionResult;
13
//		if (this.getSelfElement() != null) {
14
//			//remove old node if any
15
//			NodeList selectionList = getSelfElement().getElementsByTagName("selection"); //$NON-NLS-1$
16
//			for (int i = 0 ; i < selectionList.getLength() ; i++)
17
//				getSelfElement().removeChild(selectionList.item(i));
18
//
19
//			Document doc = this.getParent().getSelfElement().getOwnerDocument();
20
//			Element selectionElem = doc.createElement("selection"); // the selection element //$NON-NLS-1$
21
//			for (String txt : selectionResult) // the text ids
22
//			{
23
//				Element textElem = doc.createElement("selText"); //$NON-NLS-1$
24
//				textElem.setAttribute("id", txt); //$NON-NLS-1$
25
//				selectionElem.appendChild(textElem);
26
//			}
27
//			for (String crit : selectionResult.critera.keySet()) // the critera
28
//			{
29
//				ArrayList<String> values = selectionResult.critera.get(crit);
30
//				for (String value : values) {
31
//					Element criteraElem = doc.createElement("selCrit"); //$NON-NLS-1$
32
//					criteraElem.setAttribute("id", crit); //$NON-NLS-1$
33
//					criteraElem.setAttribute("value", value); //$NON-NLS-1$
34
//					selectionElem.appendChild(criteraElem);
35
//				}
36
//			}
37
//			getSelfElement().appendChild(selectionElem);// append selection elem to self
38
//		}
39
//	}
40
//
41
//	public SelectionResult initSelectionResult() {
42
//
43
//		if (getSelfElement() != null) {
44
//			selectionResult = new SelectionResult();
45
//			NodeList selectionList = getSelfElement().getElementsByTagName("selection"); //$NON-NLS-1$
46
//			for (int i = 0 ; i < selectionList.getLength() ;) {
47
//				Element selection = (Element) selectionList.item(i); // the selection element
48
//
49
//				NodeList textList = selection.getElementsByTagName("selText"); // get text ids //$NON-NLS-1$
50
//				for (int j = 0 ; j < textList.getLength() ; j++) {
51
//					Element text = (Element) textList.item(j);
52
//					selectionResult.add(text.getAttribute("id")); //$NON-NLS-1$
53
//				}
54
//
55
//				NodeList critList = selection.getElementsByTagName("selCrit"); // get the criteria //$NON-NLS-1$
56
//				for (int j = 0 ; j < critList.getLength() ; j++) {
57
//					Element crit = (Element) critList.item(j);
58
//					String name = crit.getAttribute("id"); // the name of the critera //$NON-NLS-1$
59
//					if (!selectionResult.critera.containsKey(name)) // create new list if new critera
60
//						selectionResult.critera.put(name, new ArrayList<String>());
61
//					selectionResult.critera.get(name).add(crit.getAttribute("value")); // add the value //$NON-NLS-1$
62
//				}
63
//				break; // process only one selection node
64
//			}
65
//		}
66
//		return selectionResult;
67
//	}
68
//
69
//	public SelectionResult getSelectionResult() {
70
//		return selectionResult;
71
//	}
72
}
0 73

  
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Part.java (revision 1038)
28 28
package org.txm.searchengine.cqp.corpus;
29 29

  
30 30
import org.txm.core.results.TXMResult;
31
import org.txm.objects.Base;
31
import org.txm.objects.Project;
32 32
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
33 33
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
34 34
import org.txm.searchengine.cqp.corpus.query.Query;
......
168 168
	}
169 169

  
170 170
	/* (non-Javadoc)
171
	 * @see org.txm.searchengine.cqp.corpus.Subcorpus#getBase()
171
	 * @see org.txm.searchengine.cqp.corpus.Subcorpus#getProject()
172 172
	 */
173 173
	@Override
174
	public Base getBase() {
175
		return this.partition.getParent().getBase();
174
	public Project getProject() {
175
		return this.partition.getParent().getProject();
176 176
	}
177 177

  
178 178
	/* (non-Javadoc)
tmp/org.txm.analec.rcp/src/org/txm/macro/analec/export/ExportAsMacro.groovy (revision 1038)
51 51
	return false
52 52
}
53 53

  
54
File binDirectory = mainCorpus.getBaseDirectory()
54
File binDirectory = mainCorpus.getProjectDirectory()
55 55
String binName = binDirectory.getName()
56 56

  
57 57

  
tmp/org.txm.analec.rcp/src/org/txm/analec/AnalecCorpora.java (revision 1038)
27 27
	 * @return the Corpus loaded and stored
28 28
	 */
29 29
	public static Corpus getCorpus(MainCorpus mcorpus) {
30
		File fichierCorpus = new File(mcorpus.getBaseDirectory(), "analec/"+mcorpus+".ec"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
31
		File fichierVue = new File(mcorpus.getBaseDirectory(), "analec/"+mcorpus+".ecv");
30
		File fichierCorpus = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus+".ec"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
31
		File fichierVue = new File(mcorpus.getProjectDirectory(), "analec/"+mcorpus+".ecv");
32 32
		Corpus corpus = null;
33 33
		if (AnalecCorpora.corpora.containsKey(mcorpus)) {
34 34
			corpus = AnalecCorpora.corpora.get(mcorpus);
......
110 110
	public static boolean saveCorpus(MainCorpus mcorpus) {
111 111
		Corpus corpus = getCorpus(mcorpus);
112 112
		Vue vue = getVue(mcorpus);
113
		File dir = new File(mcorpus.getBaseDirectory(), "analec/"); //$NON-NLS-1$ //$NON-NLS-2$
113
		File dir = new File(mcorpus.getProjectDirectory(), "analec/"); //$NON-NLS-1$ //$NON-NLS-2$
114 114
		dir.mkdir();
115 115
		File fichierCorpus = new File(dir,mcorpus+".ec"); //$NON-NLS-1$
116 116
		File fichierVueCorpus = new File(dir,mcorpus+".ecv"); //$NON-NLS-1$
tmp/org.txm.analec.rcp/src/org/txm/analec/commands/SaveCorpus.java (revision 1038)
43 43
	}
44 44

  
45 45
	public static boolean save(final MainCorpus mainCorpus, ExecutionEvent event) {
46
		File binaryCorpusDirectory = mainCorpus.getBaseDirectory();
46
		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
47 47
		File fichierCorpus = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getName()+".ec"); //$NON-NLS-1$ //$NON-NLS-2$
48 48
		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
49 49
		System.out.println(Messages.SaveCorpus_3+corpus+Messages.SaveCorpus_1+fichierCorpus);
tmp/org.txm.analec.rcp/src/org/txm/analec/commands/ImportTEICorpus.java (revision 1038)
125 125
				protected IStatus run(IProgressMonitor monitor) {
126 126
					try {
127 127
					MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus(name.toUpperCase());
128
					File analecDirectory = new File(corpus.getBaseDirectory(), "analec"); //$NON-NLS-1$
128
					File analecDirectory = new File(corpus.getProjectDirectory(), "analec"); //$NON-NLS-1$
129 129
					analecDirectory.mkdirs();
130 130
					Corpus analecCorpus = AnalecCorpora.getCorpus(corpus);
131 131
					analecCorpus.clearAll(); // remove all : annotations, structure
tmp/org.txm.analec.rcp/src/org/txm/analec/commands/SaveVue.java (revision 1038)
34 34
		MainCorpus mainCorpus = ((org.txm.searchengine.cqp.corpus.Corpus)first).getMainCorpus();
35 35
		corpus = AnalecCorpora.getCorpus(mainCorpus);
36 36

  
37
		File binaryCorpusDirectory = mainCorpus.getBaseDirectory();
37
		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
38 38
		File fichierVue = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getName()+".ecv"); //$NON-NLS-1$ //$NON-NLS-2$
39 39
		System.out.println(Messages.SaveVue_3+corpus+Messages.SaveVue_4+fichierVue);
40 40

  
tmp/org.txm.analec.rcp/src/org/txm/analec/commands/SaveStructure.java (revision 1038)
37 37
	public static boolean save(MainCorpus mainCorpus) {
38 38
		Corpus corpus = AnalecCorpora.getCorpus(mainCorpus);
39 39

  
40
		File binaryCorpusDirectory = mainCorpus.getBaseDirectory();
40
		File binaryCorpusDirectory = mainCorpus.getProjectDirectory();
41 41
		File fichierStructure = new File(binaryCorpusDirectory, "/analec/"+mainCorpus.getName()+".ecs"); //$NON-NLS-1$ //$NON-NLS-2$
42 42
		System.out.println(Messages.SaveStructure_3+corpus+Messages.SaveStructure_4+fichierStructure);
43 43

  
tmp/org.txm.analec.rcp/src/org/txm/analec/export/AnalecAnnotationTEIExporter.java (revision 1038)
174 174
		System.out.println("Processing text: "+textid);
175 175

  
176 176
		// 1) copy the XML-TXM file
177
		File xmltxmFileFromBin = new File(mainCorpus.getBaseDirectory(), "txm/"+mainCorpus.getName().toUpperCase()+"/"+textid+".xml");
177
		File xmltxmFileFromBin = new File(mainCorpus.getProjectDirectory(), "txm/"+mainCorpus.getName().toUpperCase()+"/"+textid+".xml");
178 178
		if (!xmltxmFileFromBin.exists()) {
179 179
			System.out.println("Error: could not find the XML-TXM reference file: "+xmltxmFileFromBin);
180 180
			return false;
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/Properties.java (revision 1038)
44 44
import org.txm.core.results.Parameter;
45 45
import org.txm.core.results.TXMParameters;
46 46
import org.txm.core.results.TXMResult;
47
import org.txm.objects.Base;
47
import org.txm.objects.Project;
48 48
import org.txm.properties.core.messages.PropertiesCoreMessages;
49 49
import org.txm.properties.core.preferences.PropertiesPreferences;
50 50
import org.txm.searchengine.cqp.AbstractCqiClient;
......
461 461
	 *
462 462
	 * @return the base
463 463
	 */
464
	public Base getBase() {
465
		return corpus.getBase();
464
	public Project getBase() {
465
		return corpus.getProject();
466 466
	}
467 467

  
468 468
	/**
tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java (revision 1038)
165 165
//					return null;
166 166
//				}
167 167

  
168
				File binDir = corpus.getBase().getBaseParameters().paramFile.getParentFile();
168
				File binDir = corpus.getProject().getProjectParameters().paramFile.getParentFile();
169 169
				File mediaDir = new File(binDir, "media"); //$NON-NLS-1$
170 170
				File audioFile = new File(mediaDir, textid+".mp3"); //$NON-NLS-1$
171 171
				if (!audioFile.exists()) audioFile = new File(mediaDir, textid+".ogg"); //$NON-NLS-1$
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Apply.java (revision 1038)
65 65
	
66 66
	public static void apply(Corpus corpus, final File model, final String[] properties, final String[] options) {
67 67
		final MainCorpus mainCorpus = corpus.getMainCorpus();
68
		final File corpusBinaryDirectory = mainCorpus.getBaseDirectory();
68
		final File corpusBinaryDirectory = mainCorpus.getProjectDirectory();
69 69
		final File txmDirectory = new File(corpusBinaryDirectory, "txm/"+mainCorpus.getName());
70 70
		
71 71
		if (!txmDirectory.exists()) {
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/LemmaProjection.java (revision 1038)
93 93
	public static void apply(final Corpus corpus, final File dictionary, final File extrarules, final String posproperty, 
94 94
			final String targetproperty, final LinkedHashSet<String> formAsLemmaPosList, final LinkedHashSet<String> sourceprioritylist) {
95 95
		final MainCorpus mainCorpus = corpus.getMainCorpus();
96
		final File corpusBinaryDirectory = mainCorpus.getBaseDirectory();
96
		final File corpusBinaryDirectory = mainCorpus.getProjectDirectory();
97 97
		final File txmDirectory = new File(corpusBinaryDirectory, "txm/"+mainCorpus.getName());
98 98

  
99 99
		if (!txmDirectory.exists()) {
......
256 256
					// update corpus indexes and edition
257 257
					//					String txmhome = Toolbox.getTxmHomePath();
258 258
					//
259
					//					BaseParameters params = corpus.getBase().getBaseParameters();
259
					//					BaseParameters params = corpus.getProject().getProjectParameters();
260 260
					//					params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false"); //too soon
261 261
					//					params.getKeyValueParameters().put(ImportKeys.DEBUG, Log.getLevel().intValue() < Level.WARNING.intValue()); // need debug for experimental stuff
262 262
					//					params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "true");
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/RemoveProperties.java (revision 1038)
74 74

  
75 75
	public static void apply(final Corpus corpus, final HashSet<String> propertiesSet) {
76 76
		final MainCorpus mainCorpus = corpus.getMainCorpus();
77
		final File corpusBinaryDirectory = mainCorpus.getBaseDirectory();
77
		final File corpusBinaryDirectory = mainCorpus.getProjectDirectory();
78 78
		final File txmDirectory = new File(corpusBinaryDirectory, "txm/"+mainCorpus.getName());
79 79

  
80 80
		if (!txmDirectory.exists()) {
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java (revision 1038)
105 105
				try {
106 106
					File lexique2 = lexique;
107 107
					MainCorpus mainCorpus = corpus.getMainCorpus();
108
					File corpusBinaryDirectory = mainCorpus.getBaseDirectory();
108
					File corpusBinaryDirectory = mainCorpus.getProjectDirectory();
109 109
					
110 110
					System.out.println("TRAIN : "+corpus+" with "+lexique2+" to create "+model+ " with properties "+Arrays.toString(properties));
111 111

  
......
126 126
					Property lemma = corpus.getProperty(properties[1]);
127 127
					
128 128
					// Prepare temporary directory
129
					File treetaggerSrcDirectory = new File(mainCorpus.getBaseDirectory(), "treetagger");
129
					File treetaggerSrcDirectory = new File(mainCorpus.getProjectDirectory(), "treetagger");
130 130
					DeleteDir.deleteDirectory(treetaggerSrcDirectory);
131 131
					treetaggerSrcDirectory.mkdirs();
132 132
					
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/rcp/tester/TIGERSearchTester.java (revision 1038)
42 42
				}
43 43
				MainCorpus corpus = (MainCorpus) receiver;
44 44

  
45
				return new File(corpus.getBaseDirectory(), "tiger").exists();
45
				return new File(corpus.getProjectDirectory(), "tiger").exists();
46 46
			}
47 47
		}
48 48
		return false;
tmp/org.txm.tigersearch.rcp/src/org/txm/tigersearch/editors/TIGERSearchEditor.java (revision 1038)
165 165

  
166 166
	protected void initializeFields() {
167 167
		String id = corpus.getName();
168
		File configfile = new File(corpus.getBaseDirectory(),"tiger/tigersearch.logprop");
169
		File registrydir = new File(corpus.getBaseDirectory(), "tiger");
168
		File configfile = new File(corpus.getProjectDirectory(),"tiger/tigersearch.logprop");
169
		File registrydir = new File(corpus.getProjectDirectory(), "tiger");
170 170

  
171 171
		if (!registrydir.exists()) {
172 172
			System.out.println("TIGERSearch corpus '"+id+"' has no TIGERSearch registry directory: "+registrydir);
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java (revision 1038)
65 65
		if (isTIgerInitialized) return isTIgerInitialized;
66 66

  
67 67
		String id = getCorpus().getMainCorpus().getName();
68
		File configfile = new File(getCorpus().getBaseDirectory(),"tiger/tigersearch.logprop");
69
		File registrydir = new File(getCorpus().getBaseDirectory(), "tiger");
68
		File configfile = new File(getCorpus().getProjectDirectory(),"tiger/tigersearch.logprop");
69
		File registrydir = new File(getCorpus().getProjectDirectory(), "tiger");
70 70

  
71 71
		TSCorpusManager manager = new TSCorpusManager(registrydir, configfile);
72 72
		if (manager.isInitialized()) {
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 1038)
39 39
		this.corpus = corpus.getMainCorpus();
40 40

  
41 41
		String id = corpus.getName();
42
		File configfile = new File(corpus.getBaseDirectory(),"tiger/tigersearch.logprop");
43
		File registrydir = new File(corpus.getBaseDirectory(), "tiger");
44
		File tscorpusdir = new File(corpus.getBaseDirectory(), "tiger/"+id);
42
		File configfile = new File(corpus.getProjectDirectory(),"tiger/tigersearch.logprop");
43
		File registrydir = new File(corpus.getProjectDirectory(), "tiger");
44
		File tscorpusdir = new File(corpus.getProjectDirectory(), "tiger/"+id);
45 45
		
46 46
		if (!tscorpusdir.exists()) {
47 47
			System.out.println("Error: can't find corpus directory: "+tscorpusdir);
tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java (revision 1038)
60 60
import org.eclipse.ui.part.ViewPart;
61 61
import org.txm.Toolbox;
62 62
import org.txm.core.results.TXMResult;
63
import org.txm.objects.Base;
63
import org.txm.objects.Project;
64 64
import org.txm.rcp.IImageKeys;
65 65
import org.txm.rcp.commands.R.CopySelection;
66 66
import org.txm.rcp.handlers.files.EditFile;
......
449 449
		 */
450 450
		@Override
451 451
		public Object[] getElements(Object element) {
452
			Collection<Base> input = (Collection<Base>) element;
452
			Collection<Project> input = (Collection<Project>) element;
453 453
			Object[] objects = new Object[input.size()];
454
			Iterator<Base> it = input.iterator();
454
			Iterator<Project> it = input.iterator();
455 455
			int i = 0;
456 456
			while (it.hasNext()) {
457 457
				objects[i] = it.next();
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/commands/RecodeCorpus.java (revision 1038)
107 107
		// update corpus indexes and edition
108 108
		String txmhome = Toolbox.getTxmHomePath();
109 109

  
110
		BaseParameters params = corpus.getBase().getBaseParameters();
110
		BaseParameters params = corpus.getProject().getProjectParameters();
111 111
		params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false"); //too soon
112 112
		params.getKeyValueParameters().put(ImportKeys.DEBUG, Log.getLevel().intValue() < Level.WARNING.intValue()); // need debug for experimental stuff
113 113
		params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "true");
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/ApplyXQueryMacro.groovy (revision 1038)
45 45
}
46 46

  
47 47
MainCorpus mainCorpus = ((Corpus)corpusViewSelection).getMainCorpus();
48
File binDir = mainCorpus.getBaseDirectory();
48
File binDir = mainCorpus.getProjectDirectory();
49 49
File txmDir = new File(binDir, "txm/"+mainCorpus.getName());
50 50

  
51 51
if (!txmDir.exists()) {
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/cqp/SaveSubCorpusMacro.groovy (revision 1038)
32 32

  
33 33
MainCorpus maincorpus = corpusViewSelection.getMainCorpus()
34 34
File outputFile = new File(outputDir, corpusViewSelection.getQualifiedCqpId())
35
File regFile = new File(maincorpus.getBaseDirectory(), "registry")
35
File regFile = new File(maincorpus.getProjectDirectory(), "registry")
36 36
if (!regFile.exists()) {
37 37
	println "Could not find corpus registry file $regFile"
38 38
	return
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/edition/XTZEditionBuilderMacro.groovy (revision 1038)
39 39
if (!ParametersDialog.open(this)) return;
40 40
// END OF PARAMETERS
41 41

  
42
File binDirectory = corpus.getBase().getBaseDirectory()
42
File binDirectory = corpus.getProject().getProjectDirectory()
43 43
File txmDirectory = new File(binDirectory, "txm/"+corpus.getName().toUpperCase())
44 44

  
45 45
File HTMLDirectory = new File(binDirectory, "HTML")
46 46
File newEditionDirectory = new File(HTMLDirectory, corpus.getName().toUpperCase()+"/"+editionName)
47 47

  
48
BaseParameters parameters = corpus.getBase().params
48
BaseParameters parameters = corpus.getProject().params
49 49

  
50 50
if (!HTMLDirectory.exists()) {
51 51
	println "ERROR: can't find this corpus 'HTML' directory: $HTMLDirectory. Aborting"
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/FacsEditionBuilderMacro.groovy (revision 1038)
58 58
}
59 59

  
60 60
if (args.size() == 0) { // the "corpus" variable exists
61
	binDirectory = corpus.getBase().getBaseDirectory()
61
	binDirectory = corpus.getProject().getProjectDirectory()
62 62
	txmDirectory = new File(binDirectory, "txm/"+corpus.getName().toUpperCase())
63 63
	tokenizedDirectory = new File(binDirectory, "tokenized")
64 64
	HTMLDirectory = new File(binDirectory, "HTML")
65 65
	newEditionDirectory = new File(HTMLDirectory, corpus.getName().toUpperCase()+"/"+editionName)
66
	params = corpus.getBase().params
66
	params = corpus.getProject().params
67 67
} else { // the "corpus" variable does not exist, get informations from the "args" map
68 68
	binDirectory = args["binDirectory"]
69 69
	txmDirectory = args["txmDirectory"]
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/edition/EditionUpdaterMacro.groovy (revision 1038)
65 65
if (args.size() == 0) { // corpus informations
66 66
	defaultEditionName = corpus.getDefaultEdition()
67 67
	corpusName = corpus.getName()
68
	binDirectory = corpus.getBase().getBaseDirectory()
68
	binDirectory = corpus.getProject().getProjectDirectory()
69 69
	txmDirectory = new File(binDirectory, "txm/"+corpusName.toUpperCase())
70
	params = corpus.getBase().params
70
	params = corpus.getProject().params
71 71
} else { // the "corpus" variable does not exists
72 72
	defaultEditionName = "default"
73 73
	binDirectory = args["binDirectory"]
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/prototypes/CQPBenchmark.groovy (revision 1038)
40 40
import org.txm.utils.DeleteDir;
41 41
import org.txm.*;
42 42
import org.txm.lexicaltable.core.functions.LexicalTable
43
import org.txm.objects.Base;
43
import org.txm.objects.Project;
44 44
import org.txm.ca.core.functions.CA
45 45
import org.txm.ahc.core.functions.AHC
46 46
import org.txm.concordance.core.functions.Concordance
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/graal/qgraalLoader.groovy (revision 1038)
50 50
//	if(!org.txm.Toolbox.isInitialized())
51 51
//	{
52 52
//		rootDir = userDir+"/xml/qgraal/";
53
//		org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
53
//		org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
54 54
//		org.txm.Toolbox.setParam(org.txm.Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
55 55
//	}
56 56
//}
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/hyperprinceLoader.groovy (revision 1038)
57 57
		lang="fr";
58 58
		encoding= "UTF-8";
59 59
		model="rgaqcj";
60
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
60
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
61 61
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
62 62
		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
63 63
	}
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/hyperprince/pager.groovy (revision 1038)
412 412
		println "DEV MODE";//exception means we debug
413 413
		if(!org.txm.Toolbox.isInitialized()){
414 414
			rootDir = "D:\\Travail_Sev\\Projets\\Corpus\\TXM\\hyperprince"; //userDir+"/xml/hyperprince/";//"D:\\Travail_Sev\\Projets\\Corpus\\TXM\\hyperprince";
415
			org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
415
			org.txm.Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
416 416
			org.txm.Toolbox.setParam(org.txm.Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
417 417
		}
418 418
		
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/lasla/laslaLoader.groovy (revision 1038)
63 63
		lang="fr";
64 64
		encoding= "ISO-8859-1";
65 65
		model="rgaqcj";//not used
66
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
66
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
67 67
		Toolbox.setParam(Toolbox.INSTALL_DIR,"/usr/lib/TXM");
68 68
		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
69 69
		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/perrault/perraultLoader.groovy (revision 1038)
61 61
		lang="fr";
62 62
		encoding= "UTF-8"; // not used
63 63
		model="fr";
64
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
64
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
65 65
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
66 66
		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"txminstall/treetagger"));
67 67
		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"txminstall/treetagger/models"));
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/corptef/corptefLoader.groovy (revision 1038)
61 61
		lang="fr";
62 62
		encoding= "UTF-8";
63 63
		model="rgaqcj";
64
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
64
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
65 65
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
66 66
		Toolbox.setParam(Toolbox.TREETAGGER_INSTALL_PATH,new File(userDir,"txminstall/treetagger"));
67 67
		Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File(userDir,"txminstall/treetagger/models"));
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/RGAQCJ/rgaqcjLoader.groovy (revision 1038)
59 59
		lang="fr";
60 60
		encoding= "UTF-8";
61 61
		model="rgaqcj";// not used
62
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
62
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
63 63
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"txminstall"));
64 64
		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"),"TXM"));
65 65
	}
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/tmx/Tmx2XmlFiles.groovy (revision 1038)
39 39
import javax.xml.transform.stream.StreamResult;
40 40
import javax.xml.stream.*;
41 41

  
42
import org.txm.objects.Base;
42
import org.txm.objects.Project;
43 43
import org.w3c.dom.Document;
44 44
import org.w3c.dom.Element;
45 45
import org.w3c.dom.NodeList;
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/bvh/bvhLoader.groovy (revision 1038)
67 67
		encoding= "UTF-8";// not used by bvh
68 68
		model="rgaqcj"; //not used by bvh
69 69
		basename="bvh"
70
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/workspaces/default.xml"));
70
		Toolbox.workspace = new Workspace(new File(userDir,"TXM/corpora/default.xml"));
71 71
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File(userDir,"TXM"));
72 72
		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
73 73
		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/filters/Tokeniser/TokenizerXml.groovy (revision 1038)
54 54
import javax.xml.transform.dom.DOMSource;
55 55
import javax.xml.transform.stream.StreamResult;
56 56

  
57
import org.txm.objects.Base;
57
import org.txm.objects.Project;
58 58
import org.w3c.dom.Document;
59 59
import org.w3c.dom.Element;
60 60
import org.w3c.dom.NodeList;
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/filters/Tokeniser/OldSimpleTokenizerXml.groovy (revision 1038)
55 55
import javax.xml.transform.stream.StreamResult;
56 56

  
57 57
import org.txm.scripts.importer.graal.PersonalNamespaceContext;
58
import org.txm.objects.Base;
58
import org.txm.objects.Project;
59 59
import org.w3c.dom.Document;
60 60
import org.w3c.dom.Element;
61 61
import org.w3c.dom.NodeList;
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/OpenEdition.java (revision 1038)
119 119
		return null;
120 120
	}
121 121
	public static String[] getDefaultEditions(Corpus c) {
122
		BaseParameters params = c.getBase().getBaseParameters();
122
		BaseParameters params = c.getProject().getProjectParameters();
123 123
		Element editionsElement = params.getEditionsElement(params.getCorpusElement());
124 124
		return editionsElement.getAttribute("default").split(","); //$NON-NLS-1$ //$NON-NLS-2$
125 125
	}
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 1038)
587 587
			return false;
588 588
		}
589 589

  
590
		File workspaceFile = new File(txmhomedir, "workspaces/default.xml");
590
		File workspaceFile = new File(txmhomedir, "corpora/default.xml");
591 591
		Version currentVersion = BundleUtils.getBundleVersion("org.txm.core");
592 592
		Log.info("Current toolbox version: " + currentVersion + ".");
593 593
		String installedVersionString = getPreference(TBXPreferences.VERSION);
......
638 638
			Log.info(TXMCoreMessages.Toolbox_12 + workspaceFile); 
639 639
			state = true;
640 640

  
641
			if (workspace == null || workspace.getProject("default") == null) { //$NON-NLS-1$
641
			if (workspace == null) { //$NON-NLS-1$
642 642
				Log.severe(TXMCoreMessages.Toolbox_14 + workspaceFile); 
643 643
				state = false;
644 644
				//System.out.println(TXMCoreMessages.FAILED);
tmp/org.txm.core/src/java/org/txm/core/preferences/TBXPreferences.java (revision 1038)
86 86
		
87 87
//		//FIXME: USE osgi.instance.area later & done in ApplicationWorkbenchAdvisor
88 88
//		preferences.put(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")+"/TXM");
89
		preferences.put(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
89
	//	preferences.put(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
90 90
		
91 91
		preferences.putBoolean(TBXPreferences.EXPERT_USER, false); //$NON-NLS-1$
92 92
		
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1038)
22 22
import org.txm.Toolbox;
23 23
import org.txm.core.preferences.TBXPreferences;
24 24
import org.txm.core.preferences.TXMPreferences;
25
import org.txm.objects.Base;
25
import org.txm.objects.Project;
26 26
import org.txm.utils.logger.Log;
27 27

  
28 28
// FIXME: At this moment, an empty list is created for children, to not return
......
1283 1283
	 * @param type
1284 1284
	 * @return null if the TXMResult is not attached to a BinaryCorpus
1285 1285
	 */
1286
	synchronized public Base getBinaryCorpus() {
1287
		Object o = getFirstParent(Base.class);
1286
	synchronized public Project getBinaryCorpus() {
1287
		Object o = getFirstParent(Project.class);
1288 1288
		if (o != null) {
1289
			return (Base)o;
1289
			return (Project)o;
1290 1290
		} else {
1291 1291
			return null;
1292 1292
		}
tmp/org.txm.core/src/java/org/txm/objects/Base.java (revision 1038)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff