Révision 184
tmp/org.txm.partition.core/src/org/txm/partition/core/corpusengine/cqp/__Partition2.java (revision 184) | ||
---|---|---|
293 | 293 |
*/ |
294 | 294 |
private Part createPart(String partitionName, String partName, String query) |
295 | 295 |
throws CqiClientException { |
296 |
Part part = null;
|
|
296 |
Part part; |
|
297 | 297 |
String partCqpId = CqpObject.partNamePrefix |
298 | 298 |
+ Corpus.getNextSubcorpusCounter(); |
299 | 299 |
Log.finest(NLS.bind(Messages.CREATING_PART,partName, query)); |
300 | 300 |
long start = System.currentTimeMillis(); |
301 |
// try {
|
|
302 |
// CorpusManager.getCorpusManager().getCqiClient().cqpQuery(
|
|
303 |
// this.corpus.getQualifiedCqpId(), partCqpId, query);
|
|
304 |
// part = new Part(partCqpId, partitionName, partName, this,
|
|
305 |
// new Query(query));
|
|
306 |
// } catch (Exception e) {
|
|
307 |
// try {
|
|
308 |
// throw new CqiClientException(Messages.Partition_9 + partitionName
|
|
309 |
// + "_" + partName+ e +" last error: "+Toolbox.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$
|
|
310 |
// } catch (Exception e1) {
|
|
311 |
// System.out.println(Messages.Partition_18+e1);
|
|
312 |
// org.txm.utils.logger.Log.printStackTrace(e1);
|
|
313 |
// return null;
|
|
314 |
// }
|
|
315 |
// }
|
|
301 |
try { |
|
302 |
CorpusManager.getCorpusManager().getCqiClient().cqpQuery( |
|
303 |
this.corpus.getQualifiedCqpId(), partCqpId, query); |
|
304 |
part = new Part(partCqpId, partitionName, partName, this, |
|
305 |
new Query(query)); |
|
306 |
} catch (Exception e) { |
|
307 |
try { |
|
308 |
throw new CqiClientException(Messages.Partition_9 + partitionName |
|
309 |
+ "_" + partName+ e +" last error: "+Toolbox.getCqiClient().getLastCQPError()); //$NON-NLS-1$ //$NON-NLS-2$ |
|
310 |
} catch (Exception e1) { |
|
311 |
System.out.println(Messages.Partition_18+e1); |
|
312 |
org.txm.utils.logger.Log.printStackTrace(e1); |
|
313 |
return null; |
|
314 |
} |
|
315 |
} |
|
316 | 316 |
long end = System.currentTimeMillis(); |
317 | 317 |
Log.finest(NLS.bind(Messages.PART_CREATED, partitionName |
318 | 318 |
+ "_" + partName, (end - start))); //$NON-NLS-1$//$NON-NLS-2$ |
... | ... | |
457 | 457 |
return property; |
458 | 458 |
} |
459 | 459 |
|
460 |
// /** |
|
461 |
// * Create a lexical table for this partition given an analysis property. |
|
462 |
// * Lexical table are cached and recycled. In order to drop from memory a |
|
463 |
// * lexical table, use {@link #dropLexicalTable(Property)}. |
|
464 |
// * |
|
465 |
// * @param analysisProperty the analysis property |
|
466 |
// * @param Fmin the fmin |
|
467 |
// * @return the lexical table |
|
468 |
// * @throws StatException the stat exception |
|
469 |
// * @throws CqiClientException the cqi client exception |
|
470 |
// * @author sloiseau |
|
471 |
// */ |
|
472 |
// public LexicalTable getLexicalTable(Property analysisProperty, int Fmin) |
|
473 |
// throws StatException, CqiClientException { |
|
474 |
// // System.out.println("CL : test si déja existant ds cache"); |
|
475 |
// /*if (lexicalTables.containsKey(analysisProperty.getName())) { |
|
476 |
// if (lexicalTables.get(analysisProperty.getName()).getConstructorFmin() == Fmin) |
|
477 |
// return lexicalTables.get(analysisProperty.getName()); |
|
478 |
// }*/ |
|
479 |
// // System.out.println("CL : fait un new lexique"); |
|
480 |
// LexicalTable t = LexicalTableImpl.getLexicalTable(this, |
|
481 |
// analysisProperty, Fmin); |
|
482 |
// |
|
483 |
// // System.out.println("CL : put results ds le cache"); |
|
484 |
// lexicalTables.put(analysisProperty.getName(), t); |
|
485 |
// return t; |
|
486 |
// } |
|
460 |
/** |
|
461 |
* Create a lexical table for this partition given an analysis property. |
|
462 |
* Lexical table are cached and recycled. In order to drop from memory a |
|
463 |
* lexical table, use {@link #dropLexicalTable(Property)}. |
|
464 |
* |
|
465 |
* @param analysisProperty the analysis property |
|
466 |
* @param Fmin the fmin |
|
467 |
* @return the lexical table |
|
468 |
* @throws StatException the stat exception |
|
469 |
* @throws CqiClientException the cqi client exception |
|
470 |
* @author sloiseau |
|
471 |
*/ |
|
472 |
public LexicalTable getLexicalTable(Property analysisProperty, int Fmin) |
|
473 |
throws StatException, CqiClientException { |
|
474 |
// System.out.println("CL : test si déja existant ds cache"); |
|
475 |
/*if (lexicalTables.containsKey(analysisProperty.getName())) { |
|
476 |
if (lexicalTables.get(analysisProperty.getName()).getConstructorFmin() == Fmin) |
|
477 |
return lexicalTables.get(analysisProperty.getName()); |
|
478 |
}*/ |
|
479 |
// System.out.println("CL : fait un new lexique"); |
|
480 |
LexicalTable t = LexicalTableImpl.getLexicalTable(this, |
|
481 |
analysisProperty, Fmin); |
|
487 | 482 |
|
483 |
// System.out.println("CL : put results ds le cache"); |
|
484 |
lexicalTables.put(analysisProperty.getName(), t); |
|
485 |
return t; |
|
486 |
} |
|
487 |
|
|
488 | 488 |
/** |
489 | 489 |
* Drop a lexical table from the cache. Return the dropped lexical table, or |
490 | 490 |
* <code>null</code> if no lexical table was existing for this analysis |
... | ... | |
679 | 679 |
*/ |
680 | 680 |
@Override |
681 | 681 |
public boolean delete() { |
682 |
// try {
|
|
683 |
// this.getCorpus().dropPartition(this);
|
|
684 |
// this.selfElement.getParentNode().removeChild(selfElement);
|
|
685 |
// return true;
|
|
686 |
// } catch (CqiClientException e) {
|
|
687 |
// // TODO Auto-generated catch block
|
|
688 |
// org.txm.utils.logger.Log.printStackTrace(e);
|
|
689 |
// }
|
|
682 |
try { |
|
683 |
this.getCorpus().dropPartition(this); |
|
684 |
this.selfElement.getParentNode().removeChild(selfElement); |
|
685 |
return true; |
|
686 |
} catch (CqiClientException e) { |
|
687 |
// TODO Auto-generated catch block |
|
688 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
689 |
} |
|
690 | 690 |
return false; |
691 | 691 |
} |
692 | 692 |
|
Formats disponibles : Unified diff