Revision 1969

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java (revision 1969)
33 33
import org.apache.commons.lang.StringUtils;
34 34
import org.txm.core.messages.TXMCoreMessages;
35 35
import org.txm.core.preferences.TXMPreferences;
36
import org.txm.searchengine.core.SearchEngineProperty;
36 37
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
37 38
import org.txm.utils.logger.Log;
38 39

  
......
44 45
 * 
45 46
 * @author Jean-Philippe Magué, mdecorde
46 47
 */
47
public abstract class Property implements Comparable<Property> {
48
public abstract class Property implements Comparable<Property>, SearchEngineProperty {
48 49

  
49 50
	/** The name. */
50 51
	protected String name;
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 1969)
38 38
import org.txm.core.preferences.TXMPreferences;
39 39
import org.txm.core.results.Parameter;
40 40
import org.txm.core.results.TXMParameters;
41
import org.txm.objects.CorpusBuild;
41 42
import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
42 43
import org.txm.searchengine.cqp.AbstractCqiClient;
43 44
import org.txm.searchengine.cqp.CQPSearchEngine;
......
594 595
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
595 596
		return false;
596 597
	}
598

  
599
	@Override
600
	public void setIsModified(boolean b) {
601
		// nothing
602
	}
603

  
604
	@Override
605
	public CorpusBuild getRootCorpusBuild() {
606
		return getMainCorpus();
607
	}
597 608
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java (revision 1969)
42 42
 * 
43 43
 * @author jmague, mdecorde
44 44
 */
45
public class Match extends org.txm.searchengine.core.Match {
45
public class Match extends org.txm.objects.Match {
46 46

  
47 47
	/** The start. */
48
	private int start;
48
	protected int start;
49 49

  
50 50
	/** The end. */
51
	private int end;
51
	protected int end;
52 52
	
53 53
	/** The target position */
54
	private int target = -1;
54
	protected int target = -1;
55 55

  
56 56
	/** The query result. */
57 57
	//private QueryResult queryResult;
......
162 162
	 *             the cqi client exception
163 163
	 */
164 164
	public static List<String> getValuesForProperty(Property property,
165
			List<Match> matches) throws CqiClientException {
165
			List<? extends Match> matches) throws CqiClientException {
166 166
		int[] starts = new int[matches.size()];
167 167
		for (int i = 0; i < matches.size(); i++)
168 168
			starts[i] = matches.get(i).start;
169 169
		return getValuesForProperty(property, starts);
170 170
	}
171
	
172
	/**
173
	 * Gets the values for property.
174
	 * 
175
	 * @param property
176
	 *            the property
177
	 * @param matches
178
	 *            the matches to get the values for
179
	 * 
180
	 * @return the values for property
181
	 * 
182
	 * @throws CqiClientException
183
	 *             the cqi client exception
184
	 */
185
	public static List<String> getValuesForProperty(Property property,
186
			org.txm.objects.Match match) throws CqiClientException {
187
		int[] starts = new int[1];
188
		starts[0] = match.getStart();
189
		return getValuesForProperty(property, starts);
190
	}
171 191

  
172 192
	/**
173 193
	 * Gets the values for property.
......
198 218
		} catch (Exception e) {
199 219
			throw new CqiClientException(e);
200 220
		}
201

  
202 221
	}
222
	
223
	/**
224
	 * Gets the values for property.
225
	 * 
226
	 * @param property
227
	 *            the property
228
	 * @param positions
229
	 *            the positions to get the values for
230
	 * 
231
	 * @return the values for property
232
	 * 
233
	 * @throws CqiClientException
234
	 *             the cqi client exception
235
	 */
236
	public static String getValueForProperty(Property property,
237
			int position) throws CqiClientException {
238
		AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
239
		try {
240
			if (property instanceof StructuralUnitProperty) {
241
				int[] struc = cqiClient.cpos2Struc(property.getQualifiedName(),
242
						new int[] {position});
243
				return cqiClient.struc2Str(property
244
						.getQualifiedName(), struc)[0];
245
			} else {
246
				return cqiClient.cpos2Str(property
247
						.getQualifiedName(), new int[] {position})[0];
248
			}
249
		} catch (Exception e) {
250
			throw new CqiClientException(e);
251
		}
252
	}
203 253

  
204 254
	/**
205 255
	 * Gets the ids.
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java (revision 1969)
406 406
		this.queryString = fixQuery(this.queryString);
407 407
		return this;
408 408
	}
409

  
410
	@Override
411
	public boolean equals(Query q) {
412
		return this.getClass().equals(q.getClass()) && this.getQueryString().equals(q.getQueryString());
413
	}
409 414
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java (revision 1969)
36 36
import org.txm.searchengine.cqp.AbstractCqiClient;
37 37
import org.txm.searchengine.cqp.CQPSearchEngine;
38 38
import org.txm.searchengine.cqp.ICqiClient;
39
import org.txm.searchengine.cqp.MemCqiClient;
39 40
import org.txm.searchengine.cqp.NetCqiClient;
40 41
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
41 42
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
......
56 57

  
57 58
	/** The mother main corpus. */
58 59
	protected MainCorpus motherMainCorpus;
59
	
60

  
60 61
	/** The name. */
61 62
	protected String name;
62
	
63

  
63 64
	/** The n match. */
64 65
	protected int nMatch = -1;
65
	
66

  
66 67
	/** The queried corpus. */
67 68
	protected CQPCorpus queriedCorpus;
68 69

  
......
137 138

  
138 139
	@Override
139 140
	public void finalize() {
140
//		try { drop(); }
141
//		catch(Exception e) { }
141
		//		try { drop(); }
142
		//		catch(Exception e) { }
142 143
	}
143 144

  
144 145
	/* (non-Javadoc)
......
159 160
	public int[] getEnds(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
160 161
	{
161 162
		return CorpusManager.getCorpusManager().getCqiClient()
162
					.dumpSubCorpus(getQualifiedCqpId(),
163
							NetCqiClient.CQI_CONST_FIELD_MATCHEND, from, to);
163
				.dumpSubCorpus(getQualifiedCqpId(),
164
						NetCqiClient.CQI_CONST_FIELD_MATCHEND, from, to);
164 165
	}
165 166

  
166 167
	/* (non-Javadoc)
......
206 207
			return getMatches(0, n - 1);
207 208
		else return new ArrayList<Match>();
208 209
	}
209
	
210
	
211 210

  
211

  
212

  
212 213
	/**
213 214
	 * Retrieves some of the matches of a query
214 215
	 * 
......
259 260
	public String getName() {
260 261
		return name;
261 262
	}
262
	
263

  
263 264
	/**
264 265
	 * Gets the number of matches.
265 266
	 * 
......
270 271
	 */
271 272
	public int getNMatch() throws CqiClientException {
272 273
		//if (nMatch == -1) //
273
			try {
274
				nMatch = CorpusManager.getCorpusManager().getCqiClient()
275
						.subCorpusSize(getQualifiedCqpId());
276
			} catch (Exception e) {
277
				return 0;
278
			}
274
		try {
275
			nMatch = CorpusManager.getCorpusManager().getCqiClient()
276
					.subCorpusSize(getQualifiedCqpId());
277
		} catch (Exception e) {
278
			return 0;
279
		}
279 280
		return nMatch;
280 281
	}
281 282

  
......
332 333
	public CQLQuery getQuery() {
333 334
		return query;
334 335
	}
335
	
336

  
336 337
	/**
337 338
	 * Retrieves some of the matches of a query
338 339
	 * 
......
376 377
	public int[] getStarts(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError
377 378
	{
378 379
		return CorpusManager.getCorpusManager().getCqiClient()
379
					.dumpSubCorpus(getQualifiedCqpId(),
380
							NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
380
				.dumpSubCorpus(getQualifiedCqpId(),
381
						NetCqiClient.CQI_CONST_FIELD_MATCH, from, to);
381 382
	}
382
	
383

  
383 384
	public String toString() {
384 385
		return this.getQualifiedCqpId();
385 386
	}
......
388 389
	public boolean isTargetUsed() throws UnexpectedAnswerException, IOException, CqiServerError {
389 390
		return CQPSearchEngine.getCqiClient().subCorpusHasField(this.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
390 391
	}
392

  
393
	@Override
394
	public boolean delete(int iMatch) {
395
		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
396
		if (CQI instanceof MemCqiClient) {
397
			MemCqiClient MCQI = (MemCqiClient)CQI;
398

  
399
			String query = "delete "+this.getQualifiedCqpId()+" "+iMatch+";";
400
			try {
401
				MCQI.query(query);
402
				size = -1;
403
				nMatch = -1;
404
				return true;
405
			} catch (UnexpectedAnswerException | IOException | CqiServerError e) {
406
				// TODO Auto-generated catch block
407
				e.printStackTrace();
408
			}
409
		}
410
		return false;
411
	}
412

  
413
	@Override
414
	public boolean delete(org.txm.objects.Match match) {
415

  
416
		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
417
		if (CQI instanceof MemCqiClient) {
418
			try {
419
				MemCqiClient MCQI = (MemCqiClient)CQI;
420

  
421
				Match m2;
422
				List<? extends Match> allMatches = getMatches();
423
				int to = allMatches.size();
424
				for (int i = 0 ; i < to; i++) {
425
					m2 = allMatches.get(i);
426
					if (m2.getStart() == match.getStart() && m2.getEnd() == match.getEnd()) {
427
						String query = "delete "+this.getQualifiedCqpId()+" "+i+";";
428

  
429
						MCQI.query(query);
430

  
431
						size = -1;
432
						nMatch = -1;
433
						return true;
434
					}
435
				}
436
			} catch (Exception e) {
437
				// TODO Auto-generated catch block
438
				e.printStackTrace();
439
			}
440
		}
441

  
442
		return false;
443
	}
444

  
445
	@Override
446
	public boolean delete(ArrayList<org.txm.objects.Match> matchesToRemove) {
447
		AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
448
		List<? extends Match> allMatches;
449
		try {
450
			allMatches = getMatches();
451

  
452
			int to = allMatches.size();
453
			int c = 0;
454
			if (CQI instanceof MemCqiClient) {
455
				MemCqiClient MCQI = (MemCqiClient)CQI;
456
				for (org.txm.objects.Match m : matchesToRemove) {
457
					Match m2;
458

  
459
					for (int i = 0 ; i < to; i++) {
460
						m2 = allMatches.get(i);
461
						if (m2.getStart() == m.getStart() && m2.getEnd() == m.getEnd()) {
462
							String query = "delete "+this.getQualifiedCqpId()+" "+(i-c)+";"; // i-c because lines have been removed and matches are ordered
463
							MCQI.query(query);
464
							c++;
465
							break; // one match per line
466
						}
467
					}
468
				}
469
				return c > 0;
470
			}
471
		} catch (Exception e1) {
472
			// TODO Auto-generated catch block
473
			e1.printStackTrace();
474
		}
475
		return false;
476
	}
391 477
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 1969)
44 44
import org.txm.core.messages.TXMCoreMessages;
45 45
import org.txm.core.results.TXMParameters;
46 46
import org.txm.importer.cwb.PatchCwbRegistry;
47
import org.txm.objects.CorpusBuild;
47 48
import org.txm.objects.Project;
48 49
import org.txm.searchengine.cqp.AbstractCqiClient;
49 50
import org.txm.searchengine.cqp.CQPSearchEngine;
......
704 705
		// TODO Auto-generated method stub
705 706
		return true;
706 707
	}
708

  
709
	@Override
710
	public CorpusBuild getRootCorpusBuild() {
711
		return this;
712
	}
707 713
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1969)
3 3
import java.io.File;
4 4
import java.io.IOException;
5 5
import java.util.HashMap;
6
import java.util.List;
6 7

  
7 8
import org.eclipse.core.runtime.IProgressMonitor;
8 9
import org.txm.Toolbox;
......
12 13
import org.txm.importer.cwb.PatchCwbRegistry;
13 14
import org.txm.libs.cqp.CQPLibPreferences;
14 15
import org.txm.objects.CorpusBuild;
16
import org.txm.objects.Match;
15 17
import org.txm.objects.Project;
16 18
import org.txm.searchengine.core.EmptySelection;
17 19
import org.txm.searchengine.core.Query;
18 20
import org.txm.searchengine.core.SearchEngine;
21
import org.txm.searchengine.core.SearchEngineProperty;
19 22
import org.txm.searchengine.core.Selection;
20 23
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
21 24
import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
22 25
import org.txm.searchengine.cqp.corpus.CQPCorpus;
23 26
import org.txm.searchengine.cqp.corpus.CorpusManager;
24 27
import org.txm.searchengine.cqp.corpus.MainCorpus;
28
import org.txm.searchengine.cqp.corpus.Property;
25 29
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
26 30
import org.txm.utils.OSDetector;
27 31
import org.txm.utils.Sh;
......
449 453
	public static CQPSearchEngine getEngine() {
450 454
		return (CQPSearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine(CQPSearchEngine.NAME);
451 455
	}
456

  
457
	@Override
458
	public String getValueForProperty(Match match, SearchEngineProperty property) {
459
		if (!(property instanceof Property)) return null;
460
		Property p = (Property)property;
461
		try {
462
			return org.txm.searchengine.cqp.corpus.query.Match.getValueForProperty(p, match.getStart());
463
		} catch (CqiClientException e) {
464
			// TODO Auto-generated catch block
465
			e.printStackTrace();
466
		}
467
		return null;
468
	}
469

  
470
	@Override
471
	public List<String> getValuesForProperty(Match match, SearchEngineProperty property) {
472
		if (!(property instanceof Property)) return null;
473
		
474
		Property p = (Property)property;
475
		try {
476
			return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(p, match);
477
		} catch (CqiClientException e) {
478
			// TODO Auto-generated catch block
479
			e.printStackTrace();
480
		}
481
		return null;
482
	}
452 483
}
tmp/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 1969)
881 881
	protected void setID(String id) {
882 882
		this.pID = id;
883 883
	}
884

  
885
	public abstract void setIsModified(boolean b);
886

  
887
	public abstract CorpusBuild getRootCorpusBuild();
888

  
889
	public abstract List<? extends Match> getMatches();
884 890
}
tmp/org.txm.core/src/java/org/txm/objects/Match.java (revision 1969)
1
package org.txm.objects;
2

  
3
import java.util.ArrayList;
4
import java.util.List;
5

  
6
public abstract class Match implements Comparable<Match> {
7
	public abstract int getStart();
8
	public abstract int getEnd();
9
	public abstract int getTarget();
10
	
11
	public boolean contains(Match m) {
12
		return (this.getStart() <= m.getStart() && m.getEnd() <= this.getEnd());
13
	}
14
	
15
	/* (non-Javadoc)
16
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
17
	 */
18
	@Override
19
	public int compareTo(Match m) {
20

  
21
		if (m == null)
22
			return -1;
23
		if (this.getStart() < m.getStart())
24
			return -1;
25
		else if (this.getStart() > m.getStart())
26
			return 1;
27
		else if (this.getEnd() < m.getEnd())
28
			return -1;
29
		else
30
			return 1;
31

  
32
	}
33

  
34
	/* (non-Javadoc)
35
	 * @see java.lang.Object#toString()
36
	 */
37
	@Override
38
	public String toString() {
39
		return "<" + this.getStart() + ", " + this.getEnd() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
40
	}
41
	
42
	/**
43
	 * Size.
44
	 *
45
	 * @return the int
46
	 */
47
	public int size() {
48
		return getEnd() - getStart() + 1;
49
	}
50
	
51
	public List<Integer> getRange() {
52
		List<Integer> ret = new ArrayList<Integer>(size());
53
		for (int i = getStart() ; i <= getEnd(); i++) ret.add(i);
54
		return ret;
55
	}
56

  
57
	public abstract void setEnd(int p);
58

  
59
	public abstract void setStart(int p);
60
	
61
	public abstract void setTarget(int p);
62
}
0 63

  
tmp/org.txm.core/src/java/org/txm/objects/Match2P.java (revision 1969)
1
package org.txm.objects;
2

  
3
/**
4
 * A simple Match implementation with 2 positions: start and end
5
 * 
6
 * @author mdecorde
7
 *
8
 */
9
public class Match2P extends  Match {
10
	protected int start;
11
	protected int end;
12
	
13
	public Match2P(int start, int end) {
14
		this.start = start;
15
		this.end = end;
16
	}
17
	
18
	@Override
19
	public int getStart() {
20
		return start;
21
	}
22

  
23
	@Override
24
	public int getEnd() {
25
		return end;
26
	}
27

  
28
	@Override
29
	public int getTarget() {
30
		return -1;
31
	}
32

  
33
	@Override
34
	public void setEnd(int p) {
35
		end = p;
36
	}
37

  
38
	@Override
39
	public void setStart(int p) {
40
		start = p;
41
	}
42

  
43
	@Override
44
	public void setTarget(int p) {	}
45
}
0 46

  
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/storage/temporary/TemporaryAnnotationManager.java (revision 1969)
9 9
import javax.persistence.EntityManager;
10 10
import javax.persistence.EntityManagerFactory;
11 11
import javax.persistence.TypedQuery;
12
import javax.persistence.spi.PersistenceUnitTransactionType;
13 12

  
14 13
import org.eclipse.persistence.config.PersistenceUnitProperties;
15
import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
16 14
import org.eclipse.persistence.jpa.PersistenceProvider;
17
//import org.eclipse.persistence.jpa.PersistenceProvider;
18
import org.txm.Toolbox;
19 15
import org.txm.annotation.kr.core.Annotation;
20 16
import org.txm.annotation.kr.core.AnnotationPK;
21 17
import org.txm.annotation.kr.core.DatabasePersistenceManager;
22 18
import org.txm.annotation.kr.core.repository.AnnotationEffect;
23 19
import org.txm.annotation.kr.core.repository.AnnotationType;
24 20
import org.txm.annotation.kr.core.repository.TypedValue;
25
import org.txm.annotation.kr.core.temporary.CreateAnnotation;
21
import org.txm.objects.Match;
22
import org.txm.objects.Match2P;
26 23
import org.txm.searchengine.cqp.corpus.MainCorpus;
27
import org.txm.searchengine.cqp.corpus.query.Match;
28 24
import org.txm.utils.logger.Log;
29 25

  
30 26
public class TemporaryAnnotationManager {
......
127 123
				//check if it does not already exist, with either one of the positions (overlaps)
128 124
				//isOverlapAnnots = isOverlapAnnotationCritical(refType, refVal, startPos, endPos);
129 125
				ArrayList<Match> matches = new ArrayList<Match>();
130
				matches.add(new Match(startPos, endPos));
126
				matches.add(new Match2P(startPos, endPos));
131 127
				overlapingAnnotations = getAnnotations(null, matches, null, false, true); // getAll annotation ovelapping with startPos-endPos
132 128
				for (int i = 0 ; i < overlapingAnnotations.size() ; i++) { // parse overlapping annotations to remove wrapping annotation with different type and annotation with same type and same position 
133 129
					annot = overlapingAnnotations.get(i);
......
304 300
	 * @return
305 301
	 * @throws Exception
306 302
	 */
307
	public List<Annotation> getAnnotations(AnnotationType type, List<Match> matches, String value, boolean ordered, boolean overlap) throws Exception {
303
	public List<Annotation> getAnnotations(AnnotationType type, List<? extends Match> matches, String value, boolean ordered, boolean overlap) throws Exception {
308 304
		String query = "SELECT annot FROM Annotation AS annot";
309 305
		boolean where = false; // TODO: fucking shit, need to replace this
310 306

  
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/AnnotationManager.java (revision 1969)
13 13
import org.txm.annotation.kr.core.repository.AnnotationType;
14 14
import org.txm.annotation.kr.core.repository.TypedValue;
15 15
import org.txm.annotation.kr.core.storage.temporary.TemporaryAnnotationManager;
16
import org.txm.core.engines.Engine;
17
import org.txm.core.results.TXMResult;
18
import org.txm.objects.Project;
16
import org.txm.objects.Match;
17
import org.txm.objects.Match2P;
19 18
import org.txm.searchengine.cqp.corpus.MainCorpus;
20
import org.txm.searchengine.cqp.corpus.query.Match;
21 19
import org.txm.utils.logger.Log;
22 20

  
23 21
/**
......
125 123
		return true;
126 124
	}
127 125
	
128
	public boolean deleteAnnotations(AnnotationType type, List<Match> matches, IProgressMonitor job) throws Exception {
126
	public boolean deleteAnnotations(AnnotationType type, List<? extends Match> matches, IProgressMonitor job) throws Exception {
129 127
		try {
130 128
			tempManager.getEntityManager().getTransaction().begin();
131 129
			for (Match match : matches) {
......
233 231
	 * @return
234 232
	 */
235 233
	public HashMap<Match,List<Annotation>> createAnnotations(AnnotationType annotSelectedType,
236
			TypedValue annotSelectedTypedValue, List<Match> matches, IProgressMonitor job) {
234
			TypedValue annotSelectedTypedValue, List<? extends Match> matches, IProgressMonitor job) {
237 235

  
238 236
		HashMap<Match,List<Annotation>> allAnnotationsThatCollides = new HashMap<Match, List<Annotation>>();
239 237
		tempManager.getEntityManager().getTransaction().begin(); // warning
......
307 305
		List<Annotation> temporaryAnnotations = null;
308 306
		List<Annotation> cqpAnnotations = null;
309 307
		try {
310
			temporaryAnnotations = tempManager.getAnnotations(type, Arrays.asList(new Match(start, end)), null, false, overlap);
308
			temporaryAnnotations = tempManager.getAnnotations(type, Arrays.asList(new Match2P(start, end)), null, false, overlap);
311 309
			cqpAnnotations = cqpManager.getAnnotations(type, start, end, overlap);
312 310
			
313 311
			int i = 0;
tmp/org.txm.annotation.kr.core/src/org/txm/annotation/kr/core/CQPAnnotationManager.java (revision 1969)
6 6
import java.util.List;
7 7

  
8 8
import org.osgi.service.prefs.BackingStoreException;
9
import org.txm.Toolbox;
10 9
import org.txm.annotation.kr.core.repository.AnnotationEffect;
11 10
import org.txm.annotation.kr.core.repository.AnnotationType;
12 11
import org.txm.annotation.kr.core.repository.KnowledgeRepository;
12
import org.txm.objects.Match;
13
import org.txm.objects.Match2P;
13 14
import org.txm.searchengine.cqp.AbstractCqiClient;
14 15
import org.txm.searchengine.cqp.CQPSearchEngine;
15 16
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
17 18
import org.txm.searchengine.cqp.corpus.Property;
18 19
import org.txm.searchengine.cqp.corpus.StructuralUnit;
19 20
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
20
import org.txm.searchengine.cqp.corpus.query.Match;
21 21
import org.txm.searchengine.cqp.serverException.CqiServerError;
22
import org.txm.utils.logger.Log;
23 22

  
24 23
public class CQPAnnotationManager {
25 24
	MainCorpus corpus;
......
51 50
	}
52 51

  
53 52
	public List<Annotation> getAnnotations(AnnotationType type, int start, int end) throws CqiClientException, IOException, CqiServerError {
54
		return getAnnotations(type, new Match(start, end), null, false);
53
		return getAnnotations(type, new Match2P(start, end), null, false);
55 54
	}
56 55

  
57 56
	public List<Annotation> getAnnotations(AnnotationType type, int start, int end, boolean overlap) throws CqiClientException, IOException, CqiServerError {
58
		return getAnnotations(type, new Match(start, end), null, overlap);
57
		return getAnnotations(type, new Match2P(start, end), null, overlap);
59 58
	}
60 59

  
61 60
	/**
tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java (revision 1969)
42 42
import org.txm.concordance.core.functions.Line;
43 43
import org.txm.concordance.rcp.editors.ConcordanceEditor;
44 44
import org.txm.core.preferences.TXMPreferences;
45
import org.txm.searchengine.core.SearchEngine;
45 46
import org.txm.searchengine.cqp.CQPSearchEngine;
46 47
import org.txm.searchengine.cqp.corpus.CQPCorpus;
47 48
import org.txm.searchengine.cqp.corpus.Property;
48 49
import org.txm.searchengine.cqp.corpus.StructuralUnit;
50
import org.txm.searchengine.cqp.corpus.query.Match;
49 51
import org.txm.utils.logger.Log;
50 52

  
51 53
import vlcplayerrcp.MessagesMP;
......
84 86
			return null;
85 87
		}
86 88
		ConcordanceEditor ce = (ConcordanceEditor) page;
87

  
89
		SearchEngine se = ce.getConcordance().getQuery().getSearchEngine();
88 90
		selection = (IStructuredSelection)o;
89 91

  
90 92
		Object s = selection.getFirstElement();
......
96 98
			String startPropertyName = BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.STRUCTURE_START_PROPERTY); //$NON-NLS-1$
97 99
			String endPropertyName = BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.STRUCTURE_END_PROPERTY); //$NON-NLS-1$
98 100

  
99

  
100 101
			Line line = (Line)s;
101 102
			CQPCorpus corpus = line.getConcordance().getCorpus();
102 103

  
......
110 111

  
111 112
				StructuralUnit textS = corpus.getStructuralUnit("text"); //$NON-NLS-1$
112 113
				Property textP = textS.getProperty("id"); //$NON-NLS-1$
113
				String textid = line.getMatch().getValueForProperty(textP);// get text via text struc property id
114
				String textid = line.getTextId();//line.getMatch().getValueForProperty(textP);// get text via text struc property id
115
				
114 116
				Log.fine(MessagesMP.BackToMedia_7+textid);
115 117

  
116 118
				if (useWordProperty) {
......
140 142
						System.out.println(MessagesMP.bind(MessagesMP.BackToMedia_14, startPropertyName));
141 143
						return null;
142 144
					}
143
					sStartTime = line.getMatch().getValueForProperty(startProperty);
145
					
146
					sStartTime = Match.getValueForProperty(startProperty, line.getMatch().getStart());
144 147
					Log.fine(MessagesMP.BackToMedia_16+sStartTime);
145 148

  
146 149
					Property endProperty = structure.getProperty(endPropertyName);
......
148 151
						System.out.println(MessagesMP.bind(MessagesMP.BackToMedia_17, endPropertyName));
149 152
						return null;
150 153
					}
151
					sEndTime = line.getMatch().getValueForProperty(endProperty);
154
					sEndTime =  Match.getValueForProperty(endProperty, line.getMatch().getStart());
152 155
					Log.fine(MessagesMP.BackToMedia_19+sEndTime);
153 156
				}
154 157

  
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 1969)
747 747
					/ (conc.getLeftContextSize() + conc.getRightContextSize());
748 748
			this.FA = conc.getNLines();
749 749
			corpus = conc.getCorpus();
750
			pQuery = conc.getQuery();
750
			pQuery = new CQLQuery(conc.getQuery().getQueryString()); // TODO manage all kind of query
751 751
			// System.out.println("CONC PROPS :"+conc.getViewProperties());
752 752
			pProperties = conc.getKeywordViewProperties();
753 753
			pStructuralUnitLimit = null;
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 1969)
2 2

  
3 3
import java.io.File;
4 4
import java.util.ArrayList;
5
import java.util.List;
5 6

  
6 7
import org.eclipse.core.runtime.IProgressMonitor;
7 8
import org.txm.core.results.TXMResult;
8 9
import org.txm.function.tigersearch.TIGERSearch;
9 10
import org.txm.objects.CorpusBuild;
11
import org.txm.objects.Match;
10 12
import org.txm.objects.Project;
11 13
import org.txm.searchengine.core.EmptySelection;
12 14
import org.txm.searchengine.core.Query;
13 15
import org.txm.searchengine.core.SearchEngine;
16
import org.txm.searchengine.core.SearchEngineProperty;
14 17
import org.txm.searchengine.core.Selection;
15 18
import org.txm.searchengine.cqp.corpus.MainCorpus;
16 19
import org.txm.utils.DeleteDir;
......
182 185
			}
183 186
		}
184 187
	}
188

  
189
	@Override
190
	public String getValueForProperty(Match match, SearchEngineProperty property) {
191
		// TODO Auto-generated method stub
192
		return null;
193
	}
194

  
195
	@Override
196
	public List<String> getValuesForProperty(Match match, SearchEngineProperty property) {
197
		// TODO Auto-generated method stub
198
		return null;
199
	}
185 200
}
tmp/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERQuery.java (revision 1969)
33 33
	public Query fixQuery() {
34 34
		return this;
35 35
	}
36

  
37
	@Override
38
	public boolean equals(Query q) {
39
		return this.getClass().equals(q.getClass()) && this.getQueryString().equals(q.getQueryString());
40
	}
36 41
}
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 1969)
50 50
import org.txm.index.core.functions.LineComparator.SortMode;
51 51
import org.txm.index.core.messages.IndexCoreMessages;
52 52
import org.txm.index.core.preferences.IndexPreferences;
53
import org.txm.searchengine.core.Match;
53
import org.txm.objects.Match;
54 54
import org.txm.searchengine.core.Query;
55 55
import org.txm.searchengine.core.Selection;
56 56
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java (revision 1969)
49 49
import org.txm.index.core.functions.LineComparator.SortMode;
50 50
import org.txm.index.core.messages.IndexCoreMessages;
51 51
import org.txm.index.core.preferences.IndexPreferences;
52
import org.txm.searchengine.core.Match;
52
import org.txm.objects.Match;
53 53
import org.txm.searchengine.core.Query;
54 54
import org.txm.searchengine.core.Selection;
55 55
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/KRAnnotation.java (revision 1969)
63 63
import org.txm.concordance.rcp.messages.ConcordanceUIMessages;
64 64
import org.txm.core.messages.TXMCoreMessages;
65 65
import org.txm.core.results.TXMResult;
66
import org.txm.objects.Match;
66 67
import org.txm.rcp.IImageKeys;
67 68
import org.txm.rcp.commands.OpenBrowser;
68 69
import org.txm.rcp.editors.TXMEditor;
......
73 74
import org.txm.rcp.views.corpora.CorporaView;
74 75
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
75 76
import org.txm.searchengine.cqp.corpus.CQPCorpus;
76
import org.txm.searchengine.cqp.corpus.query.Match;
77 77
import org.txm.utils.AsciiUtils;
78 78
import org.txm.utils.logger.Log;
79 79

  
......
518 518
					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
519 519
				} else { // all
520 520
					try {
521
						List<Match> matches = concordance.getMatches();
521
						List<? extends Match> matches = concordance.getMatches();
522 522
						affectMatchesToSelection(matches);
523
					} catch (CqiClientException e1) {
523
					} catch (Exception e1) {
524 524
						Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceColonP0, e1.getLocalizedMessage()));
525 525
						Log.printStackTrace(e1);
526 526
						return;
......
619 619
		return (AnnotationType) isel.getFirstElement();
620 620
	}
621 621

  
622
	protected void affectMatchesToSelection(final List<Match> matches) {
622
	protected void affectMatchesToSelection(final List<? extends Match> matches) {
623 623
		final AnnotationType type = getSelectedAnnotationType();
624 624
		final String svalue = annotationValuesText.getText();
625 625
		final boolean doAffect = addRemoveCombo.getSelectionIndex() == 0; // add is default
......
690 690
		}
691 691
	}
692 692

  
693
	protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {
693
	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
694 694
		if (concordance == null) {
695 695
			return;
696 696
		}
......
728 728
		}
729 729
	}
730 730

  
731
	protected void affectAnnotationValues(final List<Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
731
	protected void affectAnnotationValues(final List<? extends Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
732 732
		value_to_add = null; // reset
733 733
		if (concordance == null) {
734 734
			System.out.println("No concordance done. Aborting."); //$NON-NLS-1$
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/WordAnnotationToolbar.java (revision 1969)
21 21
import org.eclipse.jface.viewers.StructuredSelection;
22 22
import org.eclipse.jface.viewers.TableViewer;
23 23
import org.eclipse.jface.viewers.TableViewerColumn;
24
import org.eclipse.jface.viewers.ViewerCell;
25 24
import org.eclipse.osgi.util.NLS;
26 25
import org.eclipse.swt.SWT;
27 26
import org.eclipse.swt.events.KeyEvent;
......
31 30
import org.eclipse.swt.events.TypedEvent;
32 31
import org.eclipse.swt.graphics.Font;
33 32
import org.eclipse.swt.graphics.FontData;
34
import org.eclipse.swt.graphics.Image;
35 33
import org.eclipse.swt.layout.GridData;
36 34
import org.eclipse.swt.widgets.Button;
37 35
import org.eclipse.swt.widgets.Composite;
......
53 51
import org.txm.annotation.kr.rcp.commands.InitializeKnowledgeRepository;
54 52
import org.txm.annotation.kr.rcp.commands.SaveAnnotations;
55 53
import org.txm.annotation.kr.rcp.messages.KRAnnotationUIMessages;
56
import org.txm.annotation.kr.rcp.views.knowledgerepositories.KRView;
57 54
import org.txm.annotation.rcp.editor.AnnotationArea;
58 55
import org.txm.annotation.rcp.editor.AnnotationExtension;
59 56
import org.txm.concordance.core.functions.Concordance;
60 57
import org.txm.concordance.core.functions.Line;
61 58
import org.txm.concordance.rcp.editors.ConcordanceEditor;
62 59
import org.txm.concordance.rcp.editors.ConcordanceEditor.ConcordanceColumnSizeControlListener;
63
import org.txm.concordance.rcp.messages.ConcordanceUIMessages;
64 60
import org.txm.core.messages.TXMCoreMessages;
65 61
import org.txm.core.results.TXMResult;
62
import org.txm.objects.Match;
66 63
import org.txm.rcp.IImageKeys;
67 64
import org.txm.rcp.editors.TXMEditor;
68 65
import org.txm.rcp.swt.GLComposite;
......
72 69
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
73 70
import org.txm.searchengine.cqp.corpus.CQPCorpus;
74 71
import org.txm.searchengine.cqp.corpus.WordProperty;
75
import org.txm.searchengine.cqp.corpus.query.Match;
76 72
import org.txm.utils.AsciiUtils;
77 73
import org.txm.utils.logger.Log;
78 74

  
......
168 164
		affectMatchesToSelection(matches);
169 165
	}
170 166

  
171
	protected void affectAnnotationValues(final List<Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
167
	protected void affectAnnotationValues(final List<? extends Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
172 168
		value_to_add = null; // reset
173 169
		if (matches == null || matches.size() == 0) {
174 170
			System.out.println("No line selected. Aborting."); //$NON-NLS-1$
......
344 340
		});
345 341
	}
346 342

  
347
	protected void affectMatchesToSelection(final List<Match> matches) {
343
	protected void affectMatchesToSelection(final List<? extends Match> matches) {
348 344
		final AnnotationType type = getSelectedAnnotationType();
349 345
		final String svalue = annotationValuesText.getText();
350 346

  
......
607 603
			public void widgetSelected(SelectionEvent e) {
608 604

  
609 605
				try {
610
					List<Match> matches = concordance.getMatches();
606
					List<? extends Match> matches = concordance.getMatches();
611 607
					affectMatchesToSelection(matches);
612
				} catch (CqiClientException e1) {
608
				} catch (Exception e1) {
613 609
					Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceColonP0, e1.getLocalizedMessage()));
614 610
					Log.printStackTrace(e1);
615 611
					return;
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/ConcordanceAnnotations.java (revision 1969)
13 13
import org.txm.annotation.kr.core.repository.TypedValue;
14 14
import org.txm.concordance.core.functions.Concordance;
15 15
import org.txm.concordance.core.functions.Line;
16
import org.txm.searchengine.cqp.corpus.query.Match;
16
import org.txm.objects.Match;
17 17
import org.txm.utils.logger.Log;
18 18

  
19 19
/**
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 1969)
55 55
import org.txm.concordance.rcp.messages.ConcordanceUIMessages;
56 56
import org.txm.core.messages.TXMCoreMessages;
57 57
import org.txm.core.results.TXMResult;
58
import org.txm.objects.Match;
58 59
import org.txm.rcp.IImageKeys;
59 60
import org.txm.rcp.editors.TXMEditor;
60 61
import org.txm.rcp.swt.GLComposite;
......
63 64
import org.txm.rcp.utils.JobHandler;
64 65
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
65 66
import org.txm.searchengine.cqp.corpus.CQPCorpus;
66
import org.txm.searchengine.cqp.corpus.query.Match;
67 67
import org.txm.utils.logger.Log;
68 68

  
69 69
public class SimpleKRAnnotation extends AnnotationArea {
......
329 329
					affectAnnotationToSelection(editor.getLineTableViewer().getSelection());
330 330
				} else { // all
331 331
					try {
332
						List<Match> matches = concordance.getMatches();
332
						List<? extends Match> matches = concordance.getMatches();
333 333
						affectMatchesToSelection(matches);
334
					} catch (CqiClientException e1) {
334
					} catch (Exception e1) {
335 335
						Log.severe(NLS.bind(KRAnnotationUIMessages.errorWhileAnnotatingConcordanceColonP0, e1.getLocalizedMessage()));
336 336
						Log.printStackTrace(e1);
337 337
						return;
......
389 389
		}
390 390
	}
391 391

  
392
	protected void affectMatchesToSelection(final List<Match> matches) {
392
	protected void affectMatchesToSelection(final List<? extends Match> matches) {
393 393
		final AnnotationType type = getSelectedAnnotationType();
394 394
		final String svalue = annotationValuesText.getText();
395 395
		final boolean doAffect = addRemoveCombo.getSelectionIndex() == 0; // add is default
......
458 458
		});
459 459
	}
460 460

  
461
	protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {
461
	protected void deleteAnnotationValues(List<? extends Match> matches, AnnotationType type, JobHandler job) {
462 462

  
463 463
		if (matches.size() == 0) {
464 464
			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
......
495 495
		});
496 496
	}
497 497

  
498
	protected void affectAnnotationValues(final List<Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
498
	protected void affectAnnotationValues(final List<? extends Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
499 499
		value_to_add = null; // reset
500 500
		if (matches == null || matches.size() == 0) {
501 501
			System.out.println("No line selected. Aborting."); //$NON-NLS-1$
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/corpus/Metadata2TeiHeaderMacro.groovy (revision 1969)
1
// STANDARD DECLARATIONS
2
package org.txm.macro.corpus
3

  
4
import java.nio.charset.Charset
5

  
6
import org.kohsuke.args4j.*
7
import groovy.transform.Field
8

  
9
import org.txm.importer.StaxIdentityParser
10
import org.txm.rcp.swt.widget.parameters.*
11
import org.txm.searchengine.cqp.corpus.*
12
import org.txm.utils.CsvReader
13
import org.txm.utils.io.IOUtils
14

  
15
if (!(corpusViewSelection instanceof CQPCorpus)) {
16
	println "** Corpora selection is not a Corpus. Aborting."
17
	return;
18
}
19

  
20
@Field @Option(name="xpathFile", usage="properties file to redirect metadata column to the teiHeader locations", widget="FileOpen", required=true, def="file.xml")
21
def xpathFile
22

  
23
@Field @Option(name="metadataFile", usage="the TSV file containing the metadata values per text", widget="FileOpen", required=true, def="file.xml")
24
def metadataFile
25

  
26
@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF	ON	ALL	REALLY ALL", required=true, def="OFF")
27
debug
28

  
29
if (!ParametersDialog.open(this)) return;
30
if (debug == "OFF") debug = 0; else if (debug == "ON") debug = 1; else if (debug == "ALL") debug = 2 else if (debug == "REALLY ALL") debug = 3
31

  
32

  
33
def corpus = corpusViewSelection
34
def project = corpus.getProject()
35

  
36
def txmDir = new File(project.getProjectDirectory(), "txm/"+corpus.getID())
37

  
38
if (!txmDir.exists()) {
39
	println "** the selected corpus has no XML-TXM files. Aborting."
40
}
41

  
42
def xpathProperties = new Properties()
43
xpathProperties.load(IOUtils.getReader(xpathFile))
44
println xpathProperties
45

  
46
def csvReader = new CsvReader(metadataFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8"))
47
println csvReader
48

  
49
csvReader.readHeaders();
50
def header = csvReader.getHeaders()
51
if (!header.contains("id")) {
52
	println "** 'id' column not found in $metadataFile"
53
	return;
54
}
55
while (csvReader.readRecord())	{
56
	String text_id = csvReader.get("id")
57
	if (text_id == null || text_id.length() == 0) {
58
		println "** @id not found for record="+csvReader.getRawRecord()
59
		continue;
60
	}
61
	File txmFile = new File(txmDir, text_id+".xml")
62
	if (txmFile.exists()) {
63
		
64
		def data = [:]
65
		for (def h : header) data[h] = csvReader.get(h)
66
			
67
		injecting(txmFile, data, xpathProperties)
68
	} else {
69
		println "** Text not found: $txmFile"
70
	}
71
}
72

  
73
def injecting(File txmFile, def data, def paths) {
74
	println "Editing: $txmFile..."
75
	StaxIdentityParser sparser = new StaxIdentityParser(txmFile) {
76
		String currentXPath = ""
77
		boolean start = false;
78
		def foundPaths = [:]
79
		public void processStartElement() {
80
			super.processStartElement();
81
			
82
			if (localname == "teiHeader") start = true;
83
			if (start) {
84
				currentXPath += "/"+localname 
85
				def attributes = [:]
86
				for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
87
					attributes[parser.getAttributeLocalName(i)] = parser.getAttributeValue(i);
88
				}
89
				if (attributes.size() > 0)
90
					println currentXPath+attributes
91
				else 
92
					println currentXPath
93
			}
94
		}
95
		
96
		public void processEndElement() {
97
			super.processEndElement();
98
			if (localname == "teiHeader") start = false;
99
			if (start) {
100
				currentXPath = currentXPath.substring(0, currentXPath.lastIndexOf("/"))
101
			}
102
		}
103
	}
104
	File outfile = File.createTempFile("txm", txmFile.getName())
105
	
106
	boolean ret = sparser.process(outfile);
107
	if (ret) { // replace inputFile
108
		
109
	}
110
	
111
	return ret;		
112
}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/BackToText.java (revision 1969)
38 38
import org.eclipse.core.commands.ExecutionEvent;
39 39
import org.eclipse.core.commands.ExecutionException;
40 40
import org.eclipse.e4.ui.workbench.modeling.EModelService;
41
import org.eclipse.jface.viewers.ISelection;
42
import org.eclipse.jface.viewers.IStructuredSelection;
43 41
import org.eclipse.osgi.util.NLS;
44 42
import org.eclipse.ui.IEditorPart;
45 43
import org.eclipse.ui.IWorkbenchPage;
......
51 49
import org.txm.edition.rcp.editors.RGBA;
52 50
import org.txm.edition.rcp.editors.SynopticEditionEditor;
53 51
import org.txm.edition.rcp.messages.EditionUIMessages;
52
import org.txm.objects.Match;
54 53
import org.txm.objects.Text;
55 54
import org.txm.rcp.StatusLine;
56 55
import org.txm.rcp.utils.SWTEditorsUtils;
56
import org.txm.searchengine.core.SearchEngine;
57 57
import org.txm.searchengine.cqp.AbstractCqiClient;
58 58
import org.txm.searchengine.cqp.CQPSearchEngine;
59 59
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
61 61
import org.txm.searchengine.cqp.corpus.MainCorpus;
62 62
import org.txm.searchengine.cqp.corpus.Property;
63 63
import org.txm.searchengine.cqp.corpus.StructuralUnit;
64
import org.txm.searchengine.cqp.corpus.query.Match;
65 64
import org.txm.utils.logger.Log;
66 65

  
67 66
/**
......
192 191
	public boolean backToText(ConcordanceEditor editor, Match match) {
193 192
		Concordance conc = editor.getConcordance();
194 193
		CQPCorpus corpus = editor.getCorpus();
195

  
194
		SearchEngine se = conc.getQuery().getSearchEngine();
195
		
196 196
		try {
197 197
			if (match == null) return false;
198 198

  
......
232 232
			try {
233 233
				textS = corpus.getStructuralUnit("text"); //$NON-NLS-1$
234 234
				Property textP = textS.getProperty("id"); //$NON-NLS-1$
235
				textid = match.getValueForProperty(textP);// get text via text struct property id
235
				textid = org.txm.searchengine.cqp.corpus.query.Match.getValueForProperty(textP, match.getStart()); //$NON-NLS-1$
236 236
			} catch (Exception e2) {
237 237
				System.out.println("The corpus has no text_id property" + e2); //$NON-NLS-1$
238 238
				org.txm.utils.logger.Log.printStackTrace(e2);
......
289 289
			//System.out.println("getKeywordsId="+otherWordIDs);
290 290
			List<String> lineids = null;
291 291
			try {
292
				lineids = match.getValuesForProperty(corpus.getProperty("id")); //$NON-NLS-1$
292
				lineids = org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty("id"), match); //$NON-NLS-1$
293 293
			} catch (Exception e1) {
294 294
				org.txm.utils.logger.Log.printStackTrace(e1);
295 295
				return false;
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java (revision 1969)
35 35
import java.util.Map;
36 36

  
37 37
import org.apache.commons.lang.StringUtils;
38
import org.txm.objects.Match;
38 39
import org.txm.searchengine.cqp.Reference;
39 40
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
40 41
import org.txm.searchengine.cqp.corpus.CQPCorpus;
41 42
import org.txm.searchengine.cqp.corpus.Property;
42
import org.txm.searchengine.cqp.corpus.query.Match;
43 43
import org.txm.utils.i18n.LangFormater;
44 44

  
45 45
// TODO: Auto-generated Javadoc
......
573 573
	 * @throws CqiClientException the cqi client exception
574 574
	 */
575 575
	public String matchGetCol(CQPCorpus corpus) throws CqiClientException {
576
		return match.getValueForProperty(corpus.getProperty("col")); //$NON-NLS-1$
576
		return org.txm.searchengine.cqp.corpus.query.Match.getValueForProperty(corpus.getProperty("col"), match.getStart()); //$NON-NLS-1$
577 577
	}
578 578

  
579 579
	/**
......
584 584
	 * @throws CqiClientException the cqi client exception
585 585
	 */
586 586
	public List<String> matchGetId(CQPCorpus corpus) throws CqiClientException {
587
		return match.getValuesForProperty(corpus.getProperty("id")); //$NON-NLS-1$
587
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty("id"), match); //$NON-NLS-1$
588 588
	}
589 589

  
590 590
	/**
......
595 595
	 * @return the list
596 596
	 * @throws CqiClientException the cqi client exception
597 597
	 */
598
	@SuppressWarnings("static-access") //$NON-NLS-1$
599 598
	public List<String> matchGetId(CQPCorpus corpus, int[] positions)
600 599
			throws CqiClientException {
601
		return match.getValuesForProperty(corpus.getProperty("id"), positions); //$NON-NLS-1$
600
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty("id"), positions); //$NON-NLS-1$
602 601
	}
603 602

  
604 603
	/**
......
610 609
	 * @return the list
611 610
	 * @throws CqiClientException the cqi client exception
612 611
	 */
613
	@SuppressWarnings("static-access") //$NON-NLS-1$
614
	public List<String> matchGetPropertie(CQPCorpus corpus, String propertie,
612
	public List<String> matchGetPropertie(CQPCorpus corpus, String property,
615 613
			int[] positions) throws CqiClientException {
616
		return match.getValuesForProperty(corpus.getProperty(propertie),
617
				positions);
614
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty(property), positions); //$NON-NLS-1$
618 615
	}
619 616

  
620 617
	/**
......
626 623
	 * @return the list
627 624
	 * @throws CqiClientException the cqi client exception
628 625
	 */
629
	@SuppressWarnings("static-access") //$NON-NLS-1$
630
	public List<String> matchGetProperties(CQPCorpus corpus, Property propertie,
626
	public List<String> matchGetProperties(CQPCorpus corpus, Property property,
631 627
			int[] positions) throws CqiClientException {
632
		return match.getValuesForProperty(propertie, positions);
628
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(property, positions); //$NON-NLS-1$
633 629
	}
634 630

  
635 631
	/**
......
637 633
	 *
638 634
	 * @return the text id
639 635
	 */
640
	public Object getTextId() {
636
	public String getTextId() {
641 637
		return this.textId;
642 638
	}
643 639

  
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 1969)
50 50
import org.txm.core.results.Parameter;
51 51
import org.txm.core.results.TXMParameters;
52 52
import org.txm.core.results.TXMResult;
53
import org.txm.objects.Match;
54
import org.txm.searchengine.core.Query;
55
import org.txm.searchengine.core.Selection;
53 56
import org.txm.searchengine.cqp.AbstractCqiClient;
54 57
import org.txm.searchengine.cqp.CQPSearchEngine;
55
import org.txm.searchengine.cqp.MemCqiClient;
56 58
import org.txm.searchengine.cqp.Reference;
57 59
import org.txm.searchengine.cqp.ReferencePattern;
58 60
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
63 65
import org.txm.searchengine.cqp.corpus.StructuralUnit;
64 66
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
65 67
import org.txm.searchengine.cqp.corpus.WordProperty;
66
import org.txm.searchengine.cqp.corpus.query.Match;
67 68
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
68 69
import org.txm.searchengine.cqp.serverException.CqiServerError;
69 70
import org.txm.statsengine.r.core.RWorkspace;
......
93 94

  
94 95

  
95 96
	/** The query result. */
96
	private QueryResult queryResult;
97
	private Selection queryResult;
98
	
97 99
	/** The symbol. */
98 100
	private String symbol;
99 101

  
......
113 115
	
114 116
	/** The query. */
115 117
	@Parameter(key=ConcordancePreferences.QUERY)
116
	protected CQLQuery pQuery;
118
	protected Query pQuery;
117 119
	
118 120
	
119 121
	/** The keyword analysis properties */
......
285 287
		
286 288
		if (!this.getCorpus().equals(other.getCorpus())) return false;
287 289
		
288
		CQLQuery q1 = other.getQuery();
289
		CQLQuery q2 = this.getQuery();
290
		Query q1 = other.getQuery();
291
		Query q2 = this.getQuery();
290 292
		if (q1 != null && q2 != null) return q1.equals(q2);
291 293
		
292 294
		return true;
......
306 308
			this.queryResult = pQueryResult;
307 309
		}
308 310
		else {
309
			this.queryResult = this.getCorpus().query(pQuery, pQuery.getQueryString().replace(" ", "_") + "_concordance", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
311
			this.queryResult = pQuery.getSearchEngine().query(this.getCorpus(), pQuery, pQuery.getQueryString().replace(" ", "_") + "_concordance", true);
312
			//this.queryResult = this.getCorpus().query(pQuery, pQuery.getQueryString().replace(" ", "_") + "_concordance", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
310 313
		}
311 314

  
312 315
		this.pTopIndex = 0;
......
335 338
	 * @throws CqiServerError 
336 339
	 * @throws IOException 
337 340
	 */
338
	public String asRMatrix() throws RWorkspaceException, IOException, CqiServerError {
341
	public String asRMatrix() throws Exception {
339 342
		symbol = prefixR+ noconc++;
340 343
		String[] refs = new String[this.getNLines()];
341 344
		String[] lefts = new String[this.getNLines()];
......
530 533
	 * @throws IOException
531 534
	 * @throws CqiServerError
532 535
	 */
533
	public List<Line> getLines() throws CqiClientException, IOException, CqiServerError {
536
	public List<Line> getLines() throws Exception {
534 537
		return getLines(0, this.getNLines());
535 538
	}
536 539

  
......
549 552
	 * @throws CqiServerError 
550 553
	 * @throws IOException 
551 554
	 */
552
	public List<Line> getLines(int from, int to) throws CqiClientException, IOException, CqiServerError {
555
	public List<Line> getLines(int from, int to) throws Exception {
553 556

  
554 557
		if (nLines == 0) {
555 558
			return new ArrayList<Line>();
......
567 570
		if (from > to) from = to;
568 571
		if (to >= nLines) to = nLines - 1;
569 572

  
570
		List<Match> matches = queryResult.getMatches(from, to);
573
		List<? extends Match> matches = queryResult.getMatches(from, to);
571 574

  
572 575
		//		System.out.println("cqllimit="+cql_limit);
573 576
		//		System.out.println("CQLLimitStarts="+CQLLimitStarts);
......
614 617
				int currentKeywordPos;// = matches.get(0).getStart();
615 618
				//currentText = previousPivotText;
616 619

  
617
				List<Match> subsetMatch = new ArrayList<Match>(); 
620
				ArrayList<Match> subsetMatch = new ArrayList<Match>(); 
618 621

  
619 622
				for (int k = 0; k < j - i; k++) {
620 623
					Match match = matches.get(i - from + k);
......
836 839
	 * @return
837 840
	 * @throws CqiClientException
838 841
	 */
839
	public List<Match> getMatches() throws CqiClientException {
842
	public List<? extends Match> getMatches() throws Exception {
840 843
		return queryResult.getMatches();
841 844
	}
842 845

  
......
854 857
	 * 
855 858
	 * @return the query
856 859
	 */
857
	public CQLQuery getQuery() {
860
	public Query getQuery() {
858 861
		return pQuery;
859 862
	}
860 863

  
861
	public QueryResult getQueryResult() {
864
	public Selection getQueryResult() {
862 865
		return queryResult;
863 866
	}
864 867

  
......
1056 1059
	 * @throws IOException
1057 1060
	 * @throws CqiServerError
1058 1061
	 */
1059
	public List<Line> reloadLines(int topLine, int bottomLine) throws CqiClientException, IOException, CqiServerError {
1062
	public List<Line> reloadLines(int topLine, int bottomLine) throws Exception {
1060 1063
		for (int i = topLine; i < bottomLine; i++) {
1061 1064
			lines.set(i, null);
1062 1065
		}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff