Révision 1103
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1103) | ||
---|---|---|
45 | 45 |
import org.txm.core.results.TXMParameters; |
46 | 46 |
import org.txm.core.results.TXMResult; |
47 | 47 |
import org.txm.index.core.messages.IndexCoreMessages; |
48 |
import org.txm.searchengine.cqp.AbstractCqiClient; |
|
48 | 49 |
import org.txm.searchengine.cqp.ICqiClient; |
49 | 50 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
50 | 51 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
... | ... | |
54 | 55 |
import org.txm.searchengine.cqp.corpus.Property; |
55 | 56 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
56 | 57 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
58 |
import org.txm.searchengine.cqp.serverException.CqiServerError; |
|
57 | 59 |
import org.txm.statsengine.core.StatException; |
58 | 60 |
import org.txm.statsengine.core.data.Vector; |
59 | 61 |
import org.txm.statsengine.r.core.data.VectorImpl; |
... | ... | |
245 | 247 |
Log.finest(TXMCoreMessages.SUBCORPUS_LEXICON + corpus.getName()); |
246 | 248 |
//long start = System.currentTimeMillis(); |
247 | 249 |
int[][] fdist = null; |
248 |
Subcorpus tmp = null; |
|
250 |
AbstractCqiClient cqi = CorpusManager.getCorpusManager().getCqiClient(); |
|
251 |
String tmp = "S" + corpus.getNextSubcorpusCounter(); |
|
252 |
String qtmp = corpus.getMainCorpus().getQualifiedCqpId()+":"+tmp; |
|
249 | 253 |
try { |
250 | 254 |
this.subTask("Computing lexicon frequencies..."); |
251 |
tmp = corpus.createSubcorpus(new CQLQuery("[]"), "S" + corpus.getNextSubcorpusCounter(), true); //$NON-NLS-1$ |
|
252 |
if (tmp != null) { |
|
253 |
fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(tmp.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName()); |
|
254 |
|
|
255 |
corpus.dropSubcorpus(tmp); |
|
256 |
tmp.delete(); |
|
257 |
} |
|
255 |
cqi.cqpQuery(corpus.getQualifiedCqpId(), tmp, "[]"); |
|
256 |
fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(qtmp, 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName()); |
|
258 | 257 |
//System.out.println("nb lines: "+fdist.length); |
259 | 258 |
} catch (Exception e) { |
260 | 259 |
throw new CqiClientException(e); |
261 | 260 |
} finally { |
262 |
if (tmp != null) { |
|
263 |
try { |
|
264 |
corpus.dropSubcorpus(tmp); |
|
265 |
tmp.delete(); |
|
266 |
} |
|
267 |
catch (Exception e2) { |
|
268 |
} |
|
261 |
try { |
|
262 |
cqi.dropSubCorpus(qtmp); |
|
263 |
} catch (IOException e) { |
|
264 |
// TODO Auto-generated catch block |
|
265 |
e.printStackTrace(); |
|
266 |
} catch (CqiServerError e) { |
|
267 |
// TODO Auto-generated catch block |
|
268 |
e.printStackTrace(); |
|
269 | 269 |
} |
270 | 270 |
} |
271 | 271 |
int lexiconSize = fdist.length; |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 1103) | ||
---|---|---|
546 | 546 |
* @see org.txm.searchengine.cqp.corpus.CqpObject#getMotherMainCorpus() |
547 | 547 |
*/ |
548 | 548 |
public CQPCorpus getCorpusParent() { |
549 |
return (CQPCorpus) getFirstParent(CQPCorpus.class); |
|
549 |
//return (CQPCorpus) getFirstParent(CQPCorpus.class); |
|
550 |
TXMResult p = getFirstParent(Subcorpus.class); |
|
551 |
if (p != null) return (Subcorpus)p; |
|
552 |
return (MainCorpus) getFirstParent(MainCorpus.class); |
|
550 | 553 |
} |
551 | 554 |
|
552 | 555 |
abstract public List<Match> getMatches(); |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 1103) | ||
---|---|---|
110 | 110 |
protected boolean _compute() throws Exception { |
111 | 111 |
if (pQuery != null) { |
112 | 112 |
this.qresult = null; // reset |
113 |
this.qresult = new QueryResult(this.pID, this.pName, this, pQuery); |
|
113 |
|
|
114 |
CorpusManager.getCorpusManager().getCqiClient().cqpQuery( |
|
115 |
this.getCorpusParent().getQualifiedCqpId(), pID, |
|
116 |
pQuery.getQueryString()); |
|
117 |
|
|
118 |
this.qresult = new QueryResult(pID, pName, this.getCorpusParent(), pQuery); // getCorpusParent().query(pQuery, this.pID, true); |
|
114 | 119 |
} |
115 | 120 |
return qresult != null; |
116 | 121 |
} |
... | ... | |
137 | 142 |
|
138 | 143 |
try { |
139 | 144 |
AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient(); |
140 |
int nMatch = cqiClient.subCorpusSize(this.getQualifiedCqpId()); |
|
145 |
String qid= this.getQualifiedCqpId(); |
|
146 |
int nMatch = cqiClient.subCorpusSize(qid); |
|
141 | 147 |
//System.out.println("n matchs: "+nMatch); |
142 | 148 |
if (nMatch == 0) { |
143 | 149 |
this.size = 0; |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1103) | ||
---|---|---|
437 | 437 |
|
438 | 438 |
@Override |
439 | 439 |
public boolean hasIndexes(CorpusBuild corpus) { |
440 |
if (corpus instanceof CQPCorpus) return true; |
|
441 |
|
|
440 | 442 |
try { |
441 |
CQPCorpus cqpcorpus = (CQPCorpus) corpus; |
|
442 |
return CorpusManager.getCorpusManager().getCorpus(cqpcorpus.getMainCorpus().getName()) != null; |
|
443 |
String id = corpus.getID(); |
|
444 |
|
|
445 |
return CorpusManager.getCorpusManager().getCorpus(id) != null; |
|
443 | 446 |
} catch (Exception e) { |
444 | 447 |
e.printStackTrace(); |
445 | 448 |
return false; |
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/OpenEdition.java (revision 1103) | ||
---|---|---|
42 | 42 |
import org.txm.edition.rcp.editors.SynopticEditionEditor; |
43 | 43 |
import org.txm.edition.rcp.editors.SynopticEditorInput; |
44 | 44 |
import org.txm.edition.rcp.messages.EditionUIMessages; |
45 |
import org.txm.objects.Project; |
|
45 | 46 |
import org.txm.objects.Text; |
46 | 47 |
import org.txm.rcp.editors.TXMEditor; |
47 | 48 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
... | ... | |
117 | 118 |
} |
118 | 119 |
return null; |
119 | 120 |
} |
121 |
|
|
122 |
public static String[] getDefaultEditions(Project p) { |
|
123 |
return p.getDefaultEdition().split(","); //$NON-NLS-1$ //$NON-NLS-2$ |
|
124 |
} |
|
125 |
|
|
120 | 126 |
public static String[] getDefaultEditions(CQPCorpus c) { |
121 |
return c.getProject().getDefaultEdition().split(","); //$NON-NLS-1$ //$NON-NLS-2$
|
|
127 |
return getDefaultEditions(c.getProject());
|
|
122 | 128 |
} |
123 | 129 |
|
124 | 130 |
/** |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1103) | ||
---|---|---|
582 | 582 |
* @throws IllegalArgumentException |
583 | 583 |
*/ |
584 | 584 |
public final boolean isDirtyFromHistory() throws Exception { |
585 |
|
|
586 |
if (hasBeenComputedOnce) return false; // can't be dirty from history if the result has never been computed |
|
587 |
|
|
585 | 588 |
Class clazz = this.getClass(); |
586 | 589 |
|
587 | 590 |
Field[] fields = clazz.getDeclaredFields(); |
... | ... | |
1305 | 1308 |
*/ |
1306 | 1309 |
synchronized public TXMResult getFirstParent(Class type) { |
1307 | 1310 |
TXMResult node = null; |
1308 |
TXMResult parent = this; |
|
1311 |
TXMResult parent = this.parent;
|
|
1309 | 1312 |
do { |
1310 | 1313 |
if(parent.getClass().equals(type)) { |
1311 | 1314 |
node = parent; |
... | ... | |
1669 | 1672 |
// TODO where do we put this parent compute ? :o |
1670 | 1673 |
// if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time |
1671 | 1674 |
// SJ: other way, test the object itself |
1672 |
if (parent != null && !parent.hasBeenComputedOnce()) {
|
|
1675 |
if (parent != null) { |
|
1673 | 1676 |
if (!this.parent.compute(monitor, false, updateLastParameters)) { |
1674 | 1677 |
Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result."); |
1675 | 1678 |
|
... | ... | |
1984 | 1987 |
*/ |
1985 | 1988 |
public void setUserPersistable(boolean userPersistable) { |
1986 | 1989 |
this.userPersistable = userPersistable; |
1987 |
if (this.parent != null && !this.parent.isPersistable()) { |
|
1990 |
if (userPersistable && this.parent != null && !this.parent.isPersistable()) {
|
|
1988 | 1991 |
this.parent.setUserPersistable(true); |
1989 | 1992 |
} |
1993 |
if (!userPersistable) { |
|
1994 |
for (TXMResult child : getChildren()) { |
|
1995 |
child.setUserPersistable(userPersistable); |
|
1996 |
} |
|
1997 |
} |
|
1990 | 1998 |
Log.finest("TXMResult.setUserPersistable(): " + userPersistable); |
1991 | 1999 |
} |
1992 | 2000 |
|
tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 1103) | ||
---|---|---|
168 | 168 |
return (Project) getFirstParent(Project.class); |
169 | 169 |
} |
170 | 170 |
|
171 |
public String getID() { |
|
172 |
return pID; |
|
173 |
} |
|
174 |
|
|
171 | 175 |
/** |
172 | 176 |
* Gets the base directory. |
173 | 177 |
* |
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1103) | ||
---|---|---|
299 | 299 |
|
300 | 300 |
@Override |
301 | 301 |
protected boolean _compute() throws Exception { |
302 |
//TODO should ensure its files are up to date |
|
302 | 303 |
return true; |
303 | 304 |
} |
304 | 305 |
|
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1103) | ||
---|---|---|
666 | 666 |
rcpProject.move(destination, true, null); |
667 | 667 |
} |
668 | 668 |
|
669 |
|
|
670 | 669 |
ImportEngines engines = Toolbox.getImportEngines(); |
671 | 670 |
System.out.println("RUNNING IMPORT MODULE WITH NAME="+getImportModuleName()); |
672 | 671 |
//File scriptfile = new File(Toolbox.getTxmHomePath(), "scripts/groovy/user/org/txm/scripts/importer/"+importName+"/"+importName+"Loader.groovy"); //$NON-NLS-1$ |
Formats disponibles : Unified diff