Revision 2604

tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPLibPreferences.java (revision 2604)
57 57
		super.initializeDefaultPreferences();
58 58
		
59 59
		// FIXME: SJ: some code in this method should be done only at TXM first run
60
		// Extra note: and be better to use P2.inf and install/uninstall Touchpoints
60 61
		
62
		
61 63
		Preferences preferences = this.getDefaultPreferencesNode();
62 64
		
63 65
		
......
138 140
			}
139 141
		}
140 142
		
141
		
142 143
		preferences.put(CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
143 144
		preferences.put(CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
144 145
		preferences.put(CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
......
150 151
		preferences.putBoolean(CQI_SERVER_IS_REMOTE, false);
151 152
		preferences.putBoolean(CQI_NETWORK_MODE, false); // $NON-NLS-1$
152 153
		
153
		
154 154
		if (saved != null && saved.length() > 0) {
155 155
			Version savedVersion = new Version(saved);
156 156
			if (currentVersion.compareTo(savedVersion) <= 0) {
......
163 163
		Log.fine("SearchEngine preferences set with: " + OSDir.getAbsolutePath() + ", " + initFile.getAbsolutePath() + " and " + execFile.getAbsolutePath());
164 164
		put(CQPLibPreferences.VERSION, currentVersion.toString());
165 165
		
166
		// put(CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
167
		// put(CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
168
		// put(CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
169
		// put(CQI_SERVER_ADDITIONAL_OPTIONS, "-b 1000000 -d OFF"); //$NON-NLS-1$
170
		// put(CQI_SERVER_PORT, "4877"); //$NON-NLS-1$
171
		// put(CQI_SERVER_HOST, "localhost"); //$NON-NLS-1$
172
		// put(CQI_SERVER_LOGIN, "anonymous"); //$NON-NLS-1$
173
		// put(CQI_SERVER_PASSWORD, ""); //$NON-NLS-1$
174
		// put(CQI_SERVER_IS_REMOTE, "" + false); //$NON-NLS-1$
175
		// put(CQI_NETWORK_MODE, false); // $NON-NLS-1$
176 166
		flush();
177 167
	}
178 168
	
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/MemCqiServer.java (revision 2604)
52 52
 * @author mdecorde
53 53
 */
54 54
public class MemCqiServer extends AbstractCqiServer {
55

  
55
	
56 56
	/**
57 57
	 * Instantiates a new CQi server.
58 58
	 * 
......
70 70
			String pathToInitFile) throws ServerNotFoundException {
71 71
		this(pathToExecutable, pathToRegistry, pathToInitFile, ""); //$NON-NLS-1$
72 72
	}
73

  
73
	
74 74
	/**
75 75
	 ** Instantiates a new CQi server.
76 76
	 * 
......
88 88
	 */
89 89
	public MemCqiServer(String pathToExecutable, String pathToRegistry,
90 90
			String pathToInitFile, String additionalOptions)
91
					throws ServerNotFoundException {
92

  
91
			throws ServerNotFoundException {
92
		
93 93
	}
94

  
94
	
95 95
	/** The path to executable. */
96 96
	String pathToExecutable;
97

  
97
	
98 98
	/** The path to registry. */
99 99
	String pathToRegistry;
100

  
100
	
101 101
	/** The path to init file. */
102 102
	String pathToInitFile;
103

  
103
	
104 104
	/** The additional options. */
105 105
	String additionalOptions;
106

  
106
	
107 107
	/** The monitor output. */
108 108
	boolean monitorOutput;
109

  
109
	
110 110
	/** The cmd line. */
111 111
	static String[] cmdLine;
112
	
112 113
	public boolean debug = false;
113

  
114
	public void setDebug(boolean val)
115
	{
114
	
115
	@Override
116
	public void setDebug(boolean val) {
116 117
		debug = val;
117 118
	}
118

  
119
	
119 120
	public native int getErrorCode();
120

  
121

  
121
	
122
	
122 123
	/**
123 124
	 * Instantiates a new cqi server.
124 125
	 *
......
127 128
	 * @param pathToInitFile the path to init file
128 129
	 * @param additionalOptions the additional options
129 130
	 * @param monitorOutput the monitor output
130
	 * @throws Exception 
131
	 * @throws Exception
131 132
	 */
132 133
	public MemCqiServer(String pathToRegistry,
133 134
			String pathToInitFile, String additionalOptions,
134 135
			boolean monitorOutput) throws Exception {
135

  
136
		
136 137
		this.pathToRegistry = pathToRegistry;
137 138
		this.pathToInitFile = pathToInitFile;
138 139
		this.additionalOptions = additionalOptions;
139 140
		this.monitorOutput = monitorOutput;
140 141
	}
141

  
142
	
142 143
	/**
143 144
	 * Gets the last cmd line.
144 145
	 *
145 146
	 * @return the last cmd line
146 147
	 */
147

  
148
	
149
	@Override
148 150
	public String getLastCmdLine() {
149 151
		return StringUtils.join(cmdLine, " "); //$NON-NLS-1$
150 152
	}
151

  
153
	
152 154
	/**
153 155
	 * Start.
154 156
	 *
155 157
	 * @return true, if successful
156
	 * @throws SecurityException 
157
	 * @throws NoSuchFieldException 
158
	 * @throws SecurityException
159
	 * @throws NoSuchFieldException
158 160
	 */
161
	@Override
159 162
	public Boolean start() throws Exception {
160

  
163
		
161 164
		if (!isLoaded) {
162

  
165
			
163 166
			Field LIBRARIES = ClassLoader.class.getDeclaredField("loadedLibraryNames"); //$NON-NLS-1$
164 167
			LIBRARIES.setAccessible(true);
165

  
168
			
166 169
			// FIXME: Debug
167
			//System.err.println(">>>>>>>>>>>>>>>>>>>> MemCqiServer.start() " + this.getClass().getClassLoader());
170
			// System.err.println(">>>>>>>>>>>>>>>>>>>> MemCqiServer.start() " + this.getClass().getClassLoader());
168 171
			
169 172
			try {
170

  
173
				
171 174
				String cqplibpath = CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB);
172 175
				if (cqplibpath == null || cqplibpath.length() == 0) {
173 176
					System.err.println("Error: cqp lib path is not set in preferences");
......
175 178
				}
176 179
				String path = System.getProperty("java.library.path"); //$NON-NLS-1$
177 180
				String libpath = System.getProperty("path.separator") + cqplibpath; //$NON-NLS-1$
178

  
181
				
179 182
				if (!path.contains(libpath)) {
180 183
					path += libpath;
181 184
				}
182 185
				System.setProperty("java.library.path", path); //$NON-NLS-1$
183
				//System.out.println("Current java.library.path "+System.getProperty("java.library.path"));
184

  
186
				// System.out.println("Current java.library.path "+System.getProperty("java.library.path"));
187
				
185 188
				// this is a hack to force the JVM to reload java.library.path
186 189
				Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); //$NON-NLS-1$
187
				fieldSysPath.setAccessible( true );
188
				fieldSysPath.set( null, null );
190
				fieldSysPath.setAccessible(true);
191
				fieldSysPath.set(null, null);
189 192
				
190 193
				System.loadLibrary("cqpjni"); //$NON-NLS-1$
194
				// FIXME: SJ: tests to use absolute path rather than lib name in Linux.
195
				// It works and may avoid some problems about the JRE versions (e.g. Oracle or OpenJDK) and PATH configurations, but need to have the lib filename for each OS
196
				System.load(cqplibpath + "libcqpjni.so"); //$NON-NLS-1$
197
				
191 198
				Log.fine("cqpjni loaded from dirs: " + path + ".");
192 199
				isLoaded = true;
193

  
194
			} catch (Throwable e) {
195
				Log.severe("MemCqiServer: Failed to load CQP lib with exception: "+e);
196
				Log.warning("Tried to load Cqi libs in: "+System.getProperty("java.library.path") + "."); 
197
				Log.warning("Current directory: "+new File(".").getAbsolutePath());
200
				
201
			}
202
			catch (Throwable e) {
203
				Log.severe("MemCqiServer: Failed to load CQP lib with exception: " + e);
204
				Log.warning("Tried to load Cqi libs in: " + System.getProperty("java.library.path") + ".");
205
				Log.warning("Current directory: " + new File(".").getAbsolutePath());
198 206
				throw new Exception(e);
199 207
			}
200 208
		}
201

  
202
		//String[] cmd = { "", "-I", pathToInitFile, "-r", pathToRegistry }; //$NON-NLS-1$ //$NON-NLS-2$
203
		ArrayList<String> cmd = new ArrayList<String>();
209
		
210
		// String[] cmd = { "", "-I", pathToInitFile, "-r", pathToRegistry }; //$NON-NLS-1$ //$NON-NLS-2$
211
		ArrayList<String> cmd = new ArrayList<>();
204 212
		cmd.add(""); //$NON-NLS-1$ executable path will be foudn in preferences
205 213
		if (pathToInitFile != null && pathToInitFile.length() > 0) {
206 214
			cmd.add("-I");//$NON-NLS-1$
......
211 219
		cmd.addAll(Arrays.asList(additionalOptions.trim().split(" ")));
212 220
		cmdLine = cmd.toArray(new String[cmd.size()]);
213 221
		Log.fine("Starting NullSearchEngineServer: " + cmd + " ... ");
214

  
215
		//try {
222
		
223
		// try {
216 224
		isLoaded = start(cmdLine);
217
		//System.out.println("IS LOADED: "+isLoaded);
225
		// System.out.println("IS LOADED: "+isLoaded);
218 226
		if (isLoaded) {
219
			//System.out.println(TXMCoreMessages.CqiClient_34);
220
		} else {
227
			// System.out.println(TXMCoreMessages.CqiClient_34);
228
		}
229
		else {
221 230
			Log.severe("Failed to start SearchEngine in memory mode.");
222 231
		}
223 232
		return isLoaded;
224 233
	}
225

  
234
	
226 235
	/**
227 236
	 * Convert stream to string.
228 237
	 *
229 238
	 * @param is the is
230 239
	 * @return the string
231 240
	 */
232

  
241
	
242
	@Override
233 243
	public String convertStreamToString(InputStream is) {
234 244
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
235 245
		StringBuilder sb = new StringBuilder();
......
238 248
			while ((line = reader.readLine()) != null) {
239 249
				sb.append(line);
240 250
			}
241
		} catch (IOException e) {
251
		}
252
		catch (IOException e) {
242 253
			org.txm.utils.logger.Log.printStackTrace(e);
243
		} finally {
254
		}
255
		finally {
244 256
			try {
245 257
				is.close();
246
			} catch (IOException e) {
258
			}
259
			catch (IOException e) {
247 260
				org.txm.utils.logger.Log.printStackTrace(e);
248 261
			}
249 262
		}
250

  
263
		
251 264
		return sb.toString();
252 265
	}
253

  
266
	
254 267
	/**
255 268
	 * Checks if the server is running.
256 269
	 * 
257 270
	 * @return true, if is running
258 271
	 */
259

  
272
	
273
	@Override
260 274
	public Boolean isRunning() {
261 275
		return isLoaded;
262 276
	}
263

  
277
	
264 278
	/*
265 279
	 * (non-Javadoc)
266
	 * 
267 280
	 * @see java.lang.Object#finalize()
268 281
	 */
282
	@Override
269 283
	protected void finalize() throws Throwable {
270

  
284
		
271 285
	}
272

  
286
	
273 287
	/**
274 288
	 * Gets the error stream.
275 289
	 *
276 290
	 * @return the error stream
277 291
	 */
278

  
292
	
293
	@Override
279 294
	public InputStream getErrorStream() {
280 295
		return null;
281 296
	}
282

  
297
	
283 298
	/**
284 299
	 * Gets the input stream.
285 300
	 *
286 301
	 * @return the input stream
287 302
	 */
288

  
303
	
304
	@Override
289 305
	public InputStream getInputStream() {
290 306
		return new InputStream() {
307
			
308
			@Override
291 309
			public int read() throws IOException {
292 310
				return 0;
293 311
			}
294 312
		};
295 313
	}
296

  
314
	
297 315
	/**
298 316
	 * Gets the output stream.
299 317
	 *
300 318
	 * @return the output stream
301 319
	 */
302

  
320
	
321
	@Override
303 322
	public OutputStream getOutputStream() {
304 323
		return new OutputStream() {
305
			public void write(int arg0) throws IOException {
306
			}
324
			
325
			@Override
326
			public void write(int arg0) throws IOException {}
307 327
		};
308 328
	}
309

  
329
	
310 330
	static Boolean isLoaded = false;
311

  
331
	
312 332
	public native Boolean start(String[] args);
313 333
	
314
	public native Boolean load_a_system_corpus(String regfilepath, String entryname) throws IOException, UnexpectedAnswerException, CqiServerError ;
334
	public native Boolean load_a_system_corpus(String regfilepath, String entryname) throws IOException, UnexpectedAnswerException, CqiServerError;
315 335
	
336
	@Override
316 337
	public native Boolean stop();
317

  
338
	
318 339
	public native int[] alg2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
319

  
320
	public native Integer attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
321

  
322
	public boolean connect(String arg0, String arg1) { return true;} ;
323

  
324
	public native String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
325

  
326
	public native String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
327

  
328
	public native String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
329

  
330
	public native String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
331

  
332
	public native String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
333

  
334
	public native String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
335

  
336
	public native Boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
337

  
338
	public native String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError ;
339

  
340
	public native int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
341

  
342
	public native int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
343

  
344
	public native int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
345

  
346
	public native int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
347

  
348
	public native String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
349

  
350
	public native int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
351

  
352
	//TODO to implement in CQi and MemCQiServer
353
	//public native int[] cpos2Struc2cpos(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
354 340
	
355
	//TODO to implement in CQi and MemCQiServer
356
	//public native String[] cpos2struc2str(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
341
	public native Integer attributeSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
357 342
	
343
	public boolean connect(String arg0, String arg1) {
344
		return true;
345
	};
346
	
347
	public native String[] corpusAlignementAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
348
	
349
	public native String corpusCharset(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
350
	
351
	public native String corpusFullName(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
352
	
353
	public native String[] corpusInfo(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
354
	
355
	public native String[] corpusPositionalAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
356
	
357
	public native String[] corpusProperties(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
358
	
359
	public native Boolean corpusStructuralAttributeHasValues(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
360
	
361
	public native String[] corpusStructuralAttributes(String arg0) throws UnexpectedAnswerException, IOException, CqiServerError;
362
	
363
	public native int[] cpos2Alg(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
364
	
365
	public native int[] cpos2Id(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
366
	
367
	public native int[] cpos2LBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
368
	
369
	public native int[] cpos2RBound(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
370
	
371
	public native String[] cpos2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
372
	
373
	public native int[] cpos2Struc(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
374
	
375
	// TODO to implement in CQi and MemCQiServer
376
	// public native int[] cpos2Struc2cpos(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
377
	
378
	// TODO to implement in CQi and MemCQiServer
379
	// public native String[] cpos2struc2str(String arg0, ...) throws UnexpectedAnswerException, IOException, CqiServerError ;
380
	
358 381
	public native Boolean cqpQuery(String arg0, String arg1, String arg2)
359
			throws IOException, UnexpectedAnswerException, CqiServerError ;
360

  
382
			throws IOException, UnexpectedAnswerException, CqiServerError;
383
	
361 384
	public native Boolean query(String arg0)
362
			throws IOException, UnexpectedAnswerException, CqiServerError ;
363

  
364
	public Boolean disconnect() { return true; };
365

  
366
	public native Boolean dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
367

  
368
	public native Boolean dropCorpus(String arg0) throws Exception ;
369

  
370
	public native Boolean dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
371

  
385
			throws IOException, UnexpectedAnswerException, CqiServerError;
386
	
387
	public Boolean disconnect() {
388
		return true;
389
	};
390
	
391
	public native Boolean dropAttribute(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
392
	
393
	public native Boolean dropCorpus(String arg0) throws Exception;
394
	
395
	public native Boolean dropSubCorpus(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
396
	
372 397
	public native int[] dumpSubCorpus(String arg0, byte arg1, int arg2, int arg3)
373
			throws IOException, UnexpectedAnswerException, CqiServerError ;
374

  
398
			throws IOException, UnexpectedAnswerException, CqiServerError;
399
	
375 400
	public int[][] fdist1(String arg0, int arg1, byte arg2, String arg3)
376 401
			throws IOException, UnexpectedAnswerException, CqiServerError {
377 402
		int[] all = nfdist1(arg0, arg1, arg2, arg3);
......
380 405
		}
381 406
		int[][] freqs = new int[all.length / 2][2];
382 407
		int c = 0;
383
		for (int i = 0 ; i < freqs.length ;i++) {
408
		for (int i = 0; i < freqs.length; i++) {
384 409
			freqs[i][0] = all[c++];
385 410
			freqs[i][1] = all[c++];
386 411
		}
387 412
		return freqs;
388

  
413
		
389 414
	}
390

  
415
	
391 416
	public native int[] nfdist1(String arg0, int arg1, byte arg2, String arg3)
392 417
			throws IOException, UnexpectedAnswerException, CqiServerError;
393

  
418
	
394 419
	public int[][] fdist2(String arg0, int arg1, byte arg2, String arg3,
395 420
			byte arg4, String arg5) throws IOException,
396 421
			UnexpectedAnswerException, CqiServerError {
......
400 425
		}
401 426
		int[][] freqs = new int[all.length / 2][3];
402 427
		int c = 0;
403
		for (int i = 0 ; i < freqs.length ; i++) {
428
		for (int i = 0; i < freqs.length; i++) {
404 429
			freqs[i][0] = all[c++];
405 430
			freqs[i][1] = all[c++];
406 431
			freqs[i][2] = all[c++];
407 432
		}
408 433
		return freqs;
409 434
	}
410

  
435
	
411 436
	public native int[] nfdist2(String arg0, int arg1, byte arg2, String arg3,
412 437
			byte arg4, String arg5) throws IOException, UnexpectedAnswerException, CqiServerError;
413

  
414
	public native String getLastCQPError() ;
415

  
438
	
439
	public native String getLastCQPError();
440
	
416 441
	public native String getLastCqiError() throws UnexpectedAnswerException, IOException, CqiServerError;
417

  
418
	public native int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
419

  
420
	public native int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
421

  
422
	public native String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
423

  
424
	public native int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
425

  
426
	public native Integer lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
427

  
442
	
443
	public native int[] id2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
444
	
445
	public native int[] id2Freq(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
446
	
447
	public native String[] id2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
448
	
449
	public native int[] idList2Cpos(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
450
	
451
	public native Integer lexiconSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
452
	
428 453
	public native String[] listCorpora() throws UnexpectedAnswerException, IOException, CqiServerError;
429

  
430
	public native String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus ;
431

  
432
	public Boolean reconnect() { return true; } ;
433

  
434
	public native int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
435

  
436
	public native int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError ;
437

  
438
	public native int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
439

  
440
	public native String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError ;
441

  
442
	public native Boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError ;
443

  
444
	public native Integer subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError ;
445

  
454
	
455
	public native String[] listSubcorpora(String arg0) throws UnexpectedAnswerException, IOException, CqiCqpErrorNoSuchCorpus;
456
	
457
	public Boolean reconnect() {
458
		return true;
459
	};
460
	
461
	public native int[] regex2Id(String arg0, String arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
462
	
463
	public native int[] str2Id(String arg0, String[] arg1) throws IOException, UnexpectedAnswerException, CqiServerError;
464
	
465
	public native int[] struc2Cpos(String arg0, int arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
466
	
467
	public native String[] struc2Str(String arg0, int[] arg1) throws UnexpectedAnswerException, IOException, CqiServerError;
468
	
469
	public native Boolean subCorpusHasField(String arg0, byte arg1) throws IOException, UnexpectedAnswerException, CqiServerError;
470
	
471
	public native Integer subCorpusSize(String arg0) throws IOException, UnexpectedAnswerException, CqiServerError;
472
	
446 473
	/**
447 474
	 * @param args
448
	 * @throws Exception 
475
	 * @throws Exception
449 476
	 */
450 477
	public static void main(String[] args) throws Exception {
451 478
		String pathToCQPLibDirectory = "/home/mdecorde/workspace047/org.txm.libs.cqp.linux/res/linux64/";
452
		String cqpserverPathToExecutable = pathToCQPLibDirectory+"cqpserver";
479
		String cqpserverPathToExecutable = pathToCQPLibDirectory + "cqpserver";
453 480
		String pathToRegistry = "/home/mdecorde/TXM-0.8.0/corpora/DEMOCRATLYON5/registry";
454 481
		String pathToInitFile = "/home/mdecorde/workspace047/org.txm.libs.cqp.linux/res/cqpserver.init";
455

  
482
		
456 483
		String corpus = "DEMOCRATLYON5";
457 484
		String subcorpusname = "SUB";
458
		String subcorpusid = corpus+":"+subcorpusname;
485
		String subcorpusid = corpus + ":" + subcorpusname;
459 486
		String query = "[word=\"j.*\"]";
460 487
		String regex = "j.*";
461
		String pattribute1 = corpus+".word";
462
		String pattribute2 = corpus+".frpos";
463
		String pattribute3 = corpus+".frlemma";
464
		String sattribute1 = corpus+".text_id";
465
		String sattribute2 = corpus+".p_id";
466
		String sattribute3 = corpus+".s_id";
467

  
488
		String pattribute1 = corpus + ".word";
489
		String pattribute2 = corpus + ".frpos";
490
		String pattribute3 = corpus + ".frlemma";
491
		String sattribute1 = corpus + ".text_id";
492
		String sattribute2 = corpus + ".p_id";
493
		String sattribute3 = corpus + ".s_id";
494
		
468 495
		String align_attr = "p_id";
469

  
470
		int[] cpos = {0,10000,2,3,4,5,6,7,8,9,10};
471
		//	int id = 1;
472
		int[] ids = {0,1,2,3,4,5,6,7,8,9,10};
473
		String[] strings = {"je", "jamais"};
474
		int[] strucpos = {0, 1, 2, 3 , 4};
475

  
496
		
497
		int[] cpos = { 0, 10000, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
498
		// int id = 1;
499
		int[] ids = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
500
		String[] strings = { "je", "jamais" };
501
		int[] strucpos = { 0, 1, 2, 3, 4 };
502
		
476 503
		CQPLibPreferences.getInstance().put(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, pathToCQPLibDirectory);
477

  
504
		
478 505
		MemCqiServer server = new MemCqiServer(pathToRegistry, pathToInitFile, " -b 10000000 -d OFF", false);
479 506
		if (server.start()) System.out.println("Mem Server ok");
480
		System.out.println("SERVER="+server);
507
		System.out.println("SERVER=" + server);
481 508
		MemCqiClient client = new MemCqiClient(server);
482 509
		if (client.connect("anonymous", "")) System.out.println("Mem Client ok");
483

  
510
		
484 511
		NetCqiServer netServer = new NetCqiServer(cqpserverPathToExecutable, pathToRegistry, pathToInitFile, "", false);
485 512
		if (netServer.start()) System.out.println("Net Server ok");
486 513
		NetCqiClient netClient = new NetCqiClient("127.0.0.1", 4877);
487 514
		if (netClient.connect("anonymous", "")) System.out.println("Net Client ok");
488

  
515
		
489 516
		ExecTimer.start();
490

  
517
		
491 518
		try {
492
			System.out.println("client.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(client.alg2Cpos(sattribute1, 0)));
493
		} catch(Exception e) { System.out.println("Exception : "+e);}
519
			System.out.println("client.alg2Cpos(sattribute, struct_id) : " + Arrays.toString(client.alg2Cpos(sattribute1, 0)));
520
		}
521
		catch (Exception e) {
522
			System.out.println("Exception : " + e);
523
		}
494 524
		try {
495
			System.out.println("netClient.alg2Cpos(sattribute, struct_id) : "+Arrays.toString(netClient.alg2Cpos(sattribute1, 0)));
496
		} catch(Exception e) { System.out.println("Exception : "+e);}
497

  
525
			System.out.println("netClient.alg2Cpos(sattribute, struct_id) : " + Arrays.toString(netClient.alg2Cpos(sattribute1, 0)));
526
		}
527
		catch (Exception e) {
528
			System.out.println("Exception : " + e);
529
		}
530
		
498 531
		try {
499
			System.out.println("client.attributeSize(sattribute1) : "+client.attributeSize(sattribute1));
500
		} catch(Exception e) { System.out.println("Exception : "+e);}
532
			System.out.println("client.attributeSize(sattribute1) : " + client.attributeSize(sattribute1));
533
		}
534
		catch (Exception e) {
535
			System.out.println("Exception : " + e);
536
		}
501 537
		try {
502
			System.out.println("netClient.attributeSize(sattribute1) : "+netClient.attributeSize(sattribute1));
503
		} catch(Exception e) { System.out.println("Exception : "+e);}
504

  
505

  
538
			System.out.println("netClient.attributeSize(sattribute1) : " + netClient.attributeSize(sattribute1));
539
		}
540
		catch (Exception e) {
541
			System.out.println("Exception : " + e);
542
		}
543
		
544
		
506 545
		try {
507
			System.out.println("client.attributeSize(sattribute2) : "+client.attributeSize(sattribute2));
508
		} catch(Exception e) { System.out.println("Exception : "+e);}
546
			System.out.println("client.attributeSize(sattribute2) : " + client.attributeSize(sattribute2));
547
		}
548
		catch (Exception e) {
549
			System.out.println("Exception : " + e);
550
		}
509 551
		try {
510
			System.out.println("netClient.attributeSize(sattribute2) : "+netClient.attributeSize(sattribute2));
511
		} catch(Exception e) { System.out.println("Exception : "+e);}
512

  
513

  
552
			System.out.println("netClient.attributeSize(sattribute2) : " + netClient.attributeSize(sattribute2));
553
		}
554
		catch (Exception e) {
555
			System.out.println("Exception : " + e);
556
		}
557
		
558
		
514 559
		try {
515
			System.out.println("client.attributeSize(sattribute3) : "+client.attributeSize(sattribute3));
516
		} catch(Exception e) { System.out.println("Exception : "+e);}
560
			System.out.println("client.attributeSize(sattribute3) : " + client.attributeSize(sattribute3));
561
		}
562
		catch (Exception e) {
563
			System.out.println("Exception : " + e);
564
		}
517 565
		try {
518
			System.out.println("netClient.attributeSize(sattribute3) : "+netClient.attributeSize(sattribute3));
519
		} catch(Exception e) { System.out.println("Exception : "+e);}
520

  
521

  
566
			System.out.println("netClient.attributeSize(sattribute3) : " + netClient.attributeSize(sattribute3));
567
		}
568
		catch (Exception e) {
569
			System.out.println("Exception : " + e);
570
		}
571
		
572
		
522 573
		try {
523
			System.out.println("client.corpusAlignementAttributes(corpus) : "+Arrays.toString(client.corpusAlignementAttributes(corpus)));
524
		} catch(Exception e) { System.out.println("Exception : "+e);}
574
			System.out.println("client.corpusAlignementAttributes(corpus) : " + Arrays.toString(client.corpusAlignementAttributes(corpus)));
575
		}
576
		catch (Exception e) {
577
			System.out.println("Exception : " + e);
578
		}
525 579
		try {
526
			System.out.println("netClient.corpusAlignementAttributes(corpus) : "+Arrays.toString(netClient.corpusAlignementAttributes(corpus)));
527
		} catch(Exception e) { System.out.println("Exception : "+e);}
528

  
580
			System.out.println("netClient.corpusAlignementAttributes(corpus) : " + Arrays.toString(netClient.corpusAlignementAttributes(corpus)));
581
		}
582
		catch (Exception e) {
583
			System.out.println("Exception : " + e);
584
		}
585
		
529 586
		try {
530
			System.out.println("client.corpusCharset(corpus) : "+client.corpusCharset(corpus));
531
		} catch(Exception e) { System.out.println("Exception : "+e);}
587
			System.out.println("client.corpusCharset(corpus) : " + client.corpusCharset(corpus));
588
		}
589
		catch (Exception e) {
590
			System.out.println("Exception : " + e);
591
		}
532 592
		try {
533
			System.out.println("netClient.corpusCharset(corpus) : "+netClient.corpusCharset(corpus));
534
		} catch(Exception e) { System.out.println("Exception : "+e);}
535

  
536

  
593
			System.out.println("netClient.corpusCharset(corpus) : " + netClient.corpusCharset(corpus));
594
		}
595
		catch (Exception e) {
596
			System.out.println("Exception : " + e);
597
		}
598
		
599
		
537 600
		try {
538
			System.out.println("client.corpusFullName(corpus) : "+client.corpusFullName(corpus));
539
		} catch(Exception e) { System.out.println("Exception : "+e);}
601
			System.out.println("client.corpusFullName(corpus) : " + client.corpusFullName(corpus));
602
		}
603
		catch (Exception e) {
604
			System.out.println("Exception : " + e);
605
		}
540 606
		try {
541
			System.out.println("netClient.corpusFullName(corpus) : "+netClient.corpusFullName(corpus));
542
		} catch(Exception e) { System.out.println("Exception : "+e);}
543

  
607
			System.out.println("netClient.corpusFullName(corpus) : " + netClient.corpusFullName(corpus));
608
		}
609
		catch (Exception e) {
610
			System.out.println("Exception : " + e);
611
		}
612
		
544 613
		try {
545
			System.out.println("client.corpusInfo(corpus) : "+client.corpusInfo(corpus));
546
		} catch(Exception e) { System.out.println("Exception : "+e);}
614
			System.out.println("client.corpusInfo(corpus) : " + client.corpusInfo(corpus));
615
		}
616
		catch (Exception e) {
617
			System.out.println("Exception : " + e);
618
		}
547 619
		try {
548
			System.out.println("netClient.corpusInfo(corpus) : "+netClient.corpusInfo(corpus));
549
		} catch(Exception e) { System.out.println("Exception : "+e);}
550

  
551

  
620
			System.out.println("netClient.corpusInfo(corpus) : " + netClient.corpusInfo(corpus));
621
		}
622
		catch (Exception e) {
623
			System.out.println("Exception : " + e);
624
		}
625
		
626
		
552 627
		try {
553
			System.out.println("client.corpusPositionalAttributes(corpus) : "+Arrays.toString(client.corpusPositionalAttributes(corpus)));
554
		} catch(Exception e) { System.out.println("Exception : "+e);}
628
			System.out.println("client.corpusPositionalAttributes(corpus) : " + Arrays.toString(client.corpusPositionalAttributes(corpus)));
629
		}
630
		catch (Exception e) {
631
			System.out.println("Exception : " + e);
632
		}
555 633
		try {
556
			System.out.println("netClient.corpusPositionalAttributes(corpus) : "+Arrays.toString(netClient.corpusPositionalAttributes(corpus)));
557
		} catch(Exception e) { System.out.println("Exception : "+e);}
558

  
559

  
634
			System.out.println("netClient.corpusPositionalAttributes(corpus) : " + Arrays.toString(netClient.corpusPositionalAttributes(corpus)));
635
		}
636
		catch (Exception e) {
637
			System.out.println("Exception : " + e);
638
		}
639
		
640
		
560 641
		try {
561
			System.out.println("client.corpusProperties(corpus) : "+Arrays.toString(client.corpusProperties(corpus)));
562
		} catch(Exception e) { System.out.println("Exception : "+e);}
642
			System.out.println("client.corpusProperties(corpus) : " + Arrays.toString(client.corpusProperties(corpus)));
643
		}
644
		catch (Exception e) {
645
			System.out.println("Exception : " + e);
646
		}
563 647
		try {
564
			System.out.println("netClient.corpusProperties(corpus) : "+Arrays.toString(netClient.corpusProperties(corpus)));
565
		} catch(Exception e) { System.out.println("Exception : "+e);}
566

  
567

  
648
			System.out.println("netClient.corpusProperties(corpus) : " + Arrays.toString(netClient.corpusProperties(corpus)));
649
		}
650
		catch (Exception e) {
651
			System.out.println("Exception : " + e);
652
		}
653
		
654
		
568 655
		try {
569
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : "+client.corpusStructuralAttributeHasValues(sattribute1));
570
		} catch(Exception e) { System.out.println("Exception : "+e);}
656
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute1) : " + client.corpusStructuralAttributeHasValues(sattribute1));
657
		}
658
		catch (Exception e) {
659
			System.out.println("Exception : " + e);
660
		}
571 661
		try {
572
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute1) : "+netClient.corpusStructuralAttributeHasValues(sattribute1));
573
		} catch(Exception e) { System.out.println("Exception : "+e);}
574

  
662
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute1) : " + netClient.corpusStructuralAttributeHasValues(sattribute1));
663
		}
664
		catch (Exception e) {
665
			System.out.println("Exception : " + e);
666
		}
667
		
575 668
		try {
576
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : "+client.corpusStructuralAttributeHasValues(sattribute2));
577
		} catch(Exception e) { System.out.println("Exception : "+e);}
669
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute2) : " + client.corpusStructuralAttributeHasValues(sattribute2));
670
		}
671
		catch (Exception e) {
672
			System.out.println("Exception : " + e);
673
		}
578 674
		try {
579
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute2) : "+netClient.corpusStructuralAttributeHasValues(sattribute2));
580
		} catch(Exception e) { System.out.println("Exception : "+e);}
581

  
675
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute2) : " + netClient.corpusStructuralAttributeHasValues(sattribute2));
676
		}
677
		catch (Exception e) {
678
			System.out.println("Exception : " + e);
679
		}
680
		
582 681
		try {
583
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : "+client.corpusStructuralAttributeHasValues(sattribute3));
584
		} catch(Exception e) { System.out.println("Exception : "+e);}
682
			System.out.println("client.corpusStructuralAttributeHasValues(sattribute3) : " + client.corpusStructuralAttributeHasValues(sattribute3));
683
		}
684
		catch (Exception e) {
685
			System.out.println("Exception : " + e);
686
		}
585 687
		try {
586
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute3) : "+netClient.corpusStructuralAttributeHasValues(sattribute3));
587
		} catch(Exception e) { System.out.println("Exception : "+e);}
588

  
688
			System.out.println("netClient.corpusStructuralAttributeHasValues(sattribute3) : " + netClient.corpusStructuralAttributeHasValues(sattribute3));
689
		}
690
		catch (Exception e) {
691
			System.out.println("Exception : " + e);
692
		}
693
		
589 694
		try {
590
			System.out.println("client.corpusStructuralAttributes(corpus) : "+Arrays.toString(client.corpusStructuralAttributes(corpus)));
591
		} catch(Exception e) { System.out.println("Exception : "+e);}
695
			System.out.println("client.corpusStructuralAttributes(corpus) : " + Arrays.toString(client.corpusStructuralAttributes(corpus)));
696
		}
697
		catch (Exception e) {
698
			System.out.println("Exception : " + e);
699
		}
592 700
		try {
593
			System.out.println("netClient.corpusStructuralAttributes(corpus) : "+Arrays.toString(netClient.corpusStructuralAttributes(corpus)));
594
		} catch(Exception e) { System.out.println("Exception : "+e);}
595

  
701
			System.out.println("netClient.corpusStructuralAttributes(corpus) : " + Arrays.toString(netClient.corpusStructuralAttributes(corpus)));
702
		}
703
		catch (Exception e) {
704
			System.out.println("Exception : " + e);
705
		}
706
		
596 707
		try {
597
			System.out.println("client.cpos2Alg(align_attr, cpos) : "+Arrays.toString(client.cpos2Alg(align_attr, cpos)));
598
		} catch(Exception e) { System.out.println("Exception : "+e);}
708
			System.out.println("client.cpos2Alg(align_attr, cpos) : " + Arrays.toString(client.cpos2Alg(align_attr, cpos)));
709
		}
710
		catch (Exception e) {
711
			System.out.println("Exception : " + e);
712
		}
599 713
		try {
600
			System.out.println("netClient.cpos2Alg(align_attr, cpos) : "+Arrays.toString(netClient.cpos2Alg(align_attr, cpos)));
601
		} catch(Exception e) { System.out.println("Exception : "+e);}
602

  
714
			System.out.println("netClient.cpos2Alg(align_attr, cpos) : " + Arrays.toString(netClient.cpos2Alg(align_attr, cpos)));
715
		}
716
		catch (Exception e) {
717
			System.out.println("Exception : " + e);
718
		}
719
		
603 720
		try {
604
			System.out.println("client.cpos2Id(pattribute1, cpos) : "+Arrays.toString(client.cpos2Id(pattribute1, cpos)));
605
		} catch(Exception e) { System.out.println("Exception : "+e);}
721
			System.out.println("client.cpos2Id(pattribute1, cpos) : " + Arrays.toString(client.cpos2Id(pattribute1, cpos)));
722
		}
723
		catch (Exception e) {
724
			System.out.println("Exception : " + e);
725
		}
606 726
		try {
607
			System.out.println("netClient.cpos2Id(pattribute1, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute1, cpos)));
608
		} catch(Exception e) { System.out.println("Exception : "+e);}
609

  
727
			System.out.println("netClient.cpos2Id(pattribute1, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute1, cpos)));
728
		}
729
		catch (Exception e) {
730
			System.out.println("Exception : " + e);
731
		}
732
		
610 733
		try {
611
			System.out.println("client.cpos2Id(pattribute2, cpos) : "+Arrays.toString(client.cpos2Id(pattribute2, cpos)));
612
		} catch(Exception e) { System.out.println("Exception : "+e);}
734
			System.out.println("client.cpos2Id(pattribute2, cpos) : " + Arrays.toString(client.cpos2Id(pattribute2, cpos)));
735
		}
736
		catch (Exception e) {
737
			System.out.println("Exception : " + e);
738
		}
613 739
		try {
614
			System.out.println("netClient.cpos2Id(pattribute2, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute2, cpos)));
615
		} catch(Exception e) { System.out.println("Exception : "+e);}
616

  
740
			System.out.println("netClient.cpos2Id(pattribute2, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute2, cpos)));
741
		}
742
		catch (Exception e) {
743
			System.out.println("Exception : " + e);
744
		}
745
		
617 746
		try {
618
			System.out.println("client.cpos2Id(pattribute3, cpos) : "+Arrays.toString(client.cpos2Id(pattribute3, cpos)));
619
		} catch(Exception e) { System.out.println("Exception : "+e);}
747
			System.out.println("client.cpos2Id(pattribute3, cpos) : " + Arrays.toString(client.cpos2Id(pattribute3, cpos)));
748
		}
749
		catch (Exception e) {
750
			System.out.println("Exception : " + e);
751
		}
620 752
		try {
621
			System.out.println("netClient.cpos2Id(pattribute3, cpos) : "+Arrays.toString(netClient.cpos2Id(pattribute3, cpos)));
622
		} catch(Exception e) { System.out.println("Exception : "+e);}
623

  
753
			System.out.println("netClient.cpos2Id(pattribute3, cpos) : " + Arrays.toString(netClient.cpos2Id(pattribute3, cpos)));
754
		}
755
		catch (Exception e) {
756
			System.out.println("Exception : " + e);
757
		}
758
		
624 759
		try {
625
			System.out.println("client.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute1, cpos)));
626
		} catch(Exception e) { System.out.println("Exception : "+e);}
760
			System.out.println("client.cpos2LBound(sattribute1, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute1, cpos)));
761
		}
762
		catch (Exception e) {
763
			System.out.println("Exception : " + e);
764
		}
627 765
		try {
628
			System.out.println("netClient.cpos2LBound(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute1, cpos)));
629
		} catch(Exception e) { System.out.println("Exception : "+e);}
630

  
766
			System.out.println("netClient.cpos2LBound(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute1, cpos)));
767
		}
768
		catch (Exception e) {
769
			System.out.println("Exception : " + e);
770
		}
771
		
631 772
		try {
632
			System.out.println("client.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute2, cpos)));
633
		} catch(Exception e) { System.out.println("Exception : "+e);}
773
			System.out.println("client.cpos2LBound(sattribute2, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute2, cpos)));
774
		}
775
		catch (Exception e) {
776
			System.out.println("Exception : " + e);
777
		}
634 778
		try {
635
			System.out.println("netClient.cpos2LBound(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute2, cpos)));
636
		} catch(Exception e) { System.out.println("Exception : "+e);}
637

  
779
			System.out.println("netClient.cpos2LBound(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute2, cpos)));
780
		}
781
		catch (Exception e) {
782
			System.out.println("Exception : " + e);
783
		}
784
		
638 785
		try {
639
			System.out.println("client.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2LBound(sattribute3, cpos)));
640
		} catch(Exception e) { System.out.println("Exception : "+e);}
786
			System.out.println("client.cpos2LBound(sattribute3, cpos) : " + Arrays.toString(client.cpos2LBound(sattribute3, cpos)));
787
		}
788
		catch (Exception e) {
789
			System.out.println("Exception : " + e);
790
		}
641 791
		try {
642
			System.out.println("netClient.cpos2LBound(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2LBound(sattribute3, cpos)));
643
		} catch(Exception e) { System.out.println("Exception : "+e);}
644

  
792
			System.out.println("netClient.cpos2LBound(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2LBound(sattribute3, cpos)));
793
		}
794
		catch (Exception e) {
795
			System.out.println("Exception : " + e);
796
		}
797
		
645 798
		try {
646
			System.out.println("client.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute1, cpos)));
647
		} catch(Exception e) { System.out.println("Exception : "+e);}
799
			System.out.println("client.cpos2RBound(sattribute1, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute1, cpos)));
800
		}
801
		catch (Exception e) {
802
			System.out.println("Exception : " + e);
803
		}
648 804
		try {
649
			System.out.println("netClient.cpos2RBound(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute1, cpos)));
650
		} catch(Exception e) { System.out.println("Exception : "+e);}
651

  
805
			System.out.println("netClient.cpos2RBound(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute1, cpos)));
806
		}
807
		catch (Exception e) {
808
			System.out.println("Exception : " + e);
809
		}
810
		
652 811
		try {
653
			System.out.println("client.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute2, cpos)));
654
		} catch(Exception e) { System.out.println("Exception : "+e);}
812
			System.out.println("client.cpos2RBound(sattribute2, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute2, cpos)));
813
		}
814
		catch (Exception e) {
815
			System.out.println("Exception : " + e);
816
		}
655 817
		try {
656
			System.out.println("netClient.cpos2RBound(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute2, cpos)));
657
		} catch(Exception e) { System.out.println("Exception : "+e);}
658

  
818
			System.out.println("netClient.cpos2RBound(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute2, cpos)));
819
		}
820
		catch (Exception e) {
821
			System.out.println("Exception : " + e);
822
		}
823
		
659 824
		try {
660
			System.out.println("client.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(client.cpos2RBound(sattribute3, cpos)));
661
		} catch(Exception e) { System.out.println("Exception : "+e);}
825
			System.out.println("client.cpos2RBound(sattribute3, cpos) : " + Arrays.toString(client.cpos2RBound(sattribute3, cpos)));
826
		}
827
		catch (Exception e) {
828
			System.out.println("Exception : " + e);
829
		}
662 830
		try {
663
			System.out.println("netClient.cpos2RBound(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2RBound(sattribute3, cpos)));
664
		} catch(Exception e) { System.out.println("Exception : "+e);}
665

  
831
			System.out.println("netClient.cpos2RBound(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2RBound(sattribute3, cpos)));
832
		}
833
		catch (Exception e) {
834
			System.out.println("Exception : " + e);
835
		}
836
		
666 837
		try {
667
			System.out.println("client.cpos2Str(pattribute1, cpos) : "+Arrays.toString(client.cpos2Str(pattribute1, cpos)));
668
		} catch(Exception e) { System.out.println("Exception : "+e);}
838
			System.out.println("client.cpos2Str(pattribute1, cpos) : " + Arrays.toString(client.cpos2Str(pattribute1, cpos)));
839
		}
840
		catch (Exception e) {
841
			System.out.println("Exception : " + e);
842
		}
669 843
		try {
670
			System.out.println("netClient.cpos2Str(pattribute1, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute1, cpos)));
671
		} catch(Exception e) { System.out.println("Exception : "+e);}
672

  
844
			System.out.println("netClient.cpos2Str(pattribute1, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute1, cpos)));
845
		}
846
		catch (Exception e) {
847
			System.out.println("Exception : " + e);
848
		}
849
		
673 850
		try {
674
			System.out.println("client.cpos2Str(pattribute2, cpos) : "+Arrays.toString(client.cpos2Str(pattribute2, cpos)));
675
		} catch(Exception e) { System.out.println("Exception : "+e);}
851
			System.out.println("client.cpos2Str(pattribute2, cpos) : " + Arrays.toString(client.cpos2Str(pattribute2, cpos)));
852
		}
853
		catch (Exception e) {
854
			System.out.println("Exception : " + e);
855
		}
676 856
		try {
677
			System.out.println("netClient.cpos2Str(pattribute2, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute2, cpos)));
678
		} catch(Exception e) { System.out.println("Exception : "+e);}
679

  
857
			System.out.println("netClient.cpos2Str(pattribute2, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute2, cpos)));
858
		}
859
		catch (Exception e) {
860
			System.out.println("Exception : " + e);
861
		}
862
		
680 863
		try {
681
			System.out.println("client.cpos2Str(pattribute3, cpos) : "+Arrays.toString(client.cpos2Str(pattribute3, cpos)));
682
		} catch(Exception e) { System.out.println("Exception : "+e);}
864
			System.out.println("client.cpos2Str(pattribute3, cpos) : " + Arrays.toString(client.cpos2Str(pattribute3, cpos)));
865
		}
866
		catch (Exception e) {
867
			System.out.println("Exception : " + e);
868
		}
683 869
		try {
684
			System.out.println("netClient.cpos2Str(pattribute3, cpos) : "+Arrays.toString(netClient.cpos2Str(pattribute3, cpos)));
685
		} catch(Exception e) { System.out.println("Exception : "+e);}
686

  
870
			System.out.println("netClient.cpos2Str(pattribute3, cpos) : " + Arrays.toString(netClient.cpos2Str(pattribute3, cpos)));
871
		}
872
		catch (Exception e) {
873
			System.out.println("Exception : " + e);
874
		}
875
		
687 876
		try {
688
			System.out.println("client.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute1, cpos)));
689
		} catch(Exception e) { System.out.println("Exception : "+e);}
877
			System.out.println("client.cpos2Struc(sattribute1, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute1, cpos)));
878
		}
879
		catch (Exception e) {
880
			System.out.println("Exception : " + e);
881
		}
690 882
		try {
691
			System.out.println("netClient.cpos2Struc(sattribute1, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute1, cpos)));
692
		} catch(Exception e) { System.out.println("Exception : "+e);}
693

  
883
			System.out.println("netClient.cpos2Struc(sattribute1, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute1, cpos)));
884
		}
885
		catch (Exception e) {
886
			System.out.println("Exception : " + e);
887
		}
888
		
694 889
		try {
695
			System.out.println("client.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute2, cpos)));
696
		} catch(Exception e) { System.out.println("Exception : "+e);}
890
			System.out.println("client.cpos2Struc(sattribute2, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute2, cpos)));
891
		}
892
		catch (Exception e) {
893
			System.out.println("Exception : " + e);
894
		}
697 895
		try {
698
			System.out.println("netClient.cpos2Struc(sattribute2, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute2, cpos)));
699
		} catch(Exception e) { System.out.println("Exception : "+e);}
700

  
896
			System.out.println("netClient.cpos2Struc(sattribute2, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute2, cpos)));
897
		}
898
		catch (Exception e) {
899
			System.out.println("Exception : " + e);
900
		}
901
		
701 902
		try {
702
			System.out.println("client.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(client.cpos2Struc(sattribute3, cpos)));
703
		} catch(Exception e) { System.out.println("Exception : "+e);}
903
			System.out.println("client.cpos2Struc(sattribute3, cpos) : " + Arrays.toString(client.cpos2Struc(sattribute3, cpos)));
904
		}
905
		catch (Exception e) {
906
			System.out.println("Exception : " + e);
907
		}
704 908
		try {
705
			System.out.println("netClient.cpos2Struc(sattribute3, cpos) : "+Arrays.toString(netClient.cpos2Struc(sattribute3, cpos)));
706
		} catch(Exception e) { System.out.println("Exception : "+e);}
707

  
909
			System.out.println("netClient.cpos2Struc(sattribute3, cpos) : " + Arrays.toString(netClient.cpos2Struc(sattribute3, cpos)));
910
		}
911
		catch (Exception e) {
912
			System.out.println("Exception : " + e);
913
		}
914
		
708 915
		try {
709
			System.out.println("client.cqpQuery(corpus, subcorpus, query)");client.cqpQuery(corpus, subcorpusname, query);
710
		} catch(Exception e) { System.out.println("Exception : "+e);}
916
			System.out.println("client.cqpQuery(corpus, subcorpus, query)");
917
			client.cqpQuery(corpus, subcorpusname, query);
918
		}
919
		catch (Exception e) {
920
			System.out.println("Exception : " + e);
921
		}
711 922
		try {
712
			System.out.println("netClient.cqpQuery(corpus, subcorpus, query)");netClient.cqpQuery(corpus, subcorpusname, query);
713
		} catch(Exception e) { System.out.println("Exception : "+e);}
714

  
923
			System.out.println("netClient.cqpQuery(corpus, subcorpus, query)");
924
			netClient.cqpQuery(corpus, subcorpusname, query);
925
		}
926
		catch (Exception e) {
927
			System.out.println("Exception : " + e);
928
		}
929
		
715 930
		try {
716
			System.out.println("client.dropAttribute(pattribute1)");client.dropAttribute(pattribute1);
717
		} catch(Exception e) { System.out.println("Exception : "+e);}
931
			System.out.println("client.dropAttribute(pattribute1)");
932
			client.dropAttribute(pattribute1);
933
		}
934
		catch (Exception e) {
935
			System.out.println("Exception : " + e);
936
		}
718 937
		try {
719
			System.out.println("netClient.dropAttribute(pattribute1)");netClient.dropAttribute(pattribute1);
720
		} catch(Exception e) { System.out.println("Exception : "+e);}
721

  
938
			System.out.println("netClient.dropAttribute(pattribute1)");
939
			netClient.dropAttribute(pattribute1);
940
		}
941
		catch (Exception e) {
942
			System.out.println("Exception : " + e);
943
		}
944
		
722 945
		try {
723
			System.out.println("client.dropAttribute(pattribute2)");client.dropAttribute(pattribute2);
724
		} catch(Exception e) { System.out.println("Exception : "+e);}
946
			System.out.println("client.dropAttribute(pattribute2)");
947
			client.dropAttribute(pattribute2);
948
		}
949
		catch (Exception e) {
950
			System.out.println("Exception : " + e);
951
		}
725 952
		try {
726
			System.out.println("netClient.dropAttribute(pattribute2)");netClient.dropAttribute(pattribute2);
727
		} catch(Exception e) { System.out.println("Exception : "+e);}
728

  
953
			System.out.println("netClient.dropAttribute(pattribute2)");
954
			netClient.dropAttribute(pattribute2);
955
		}
956
		catch (Exception e) {
957
			System.out.println("Exception : " + e);
958
		}
959
		
729 960
		try {
730
			System.out.println("client.dropAttribute(pattribute3)");client.dropAttribute(pattribute3);
731
		} catch(Exception e) { System.out.println("Exception : "+e);}
961
			System.out.println("client.dropAttribute(pattribute3)");
962
			client.dropAttribute(pattribute3);
963
		}
964
		catch (Exception e) {
965
			System.out.println("Exception : " + e);
966
		}
732 967
		try {
733
			System.out.println("netClient.dropAttribute(pattribute3)");netClient.dropAttribute(pattribute3);
734
		} catch(Exception e) { System.out.println("Exception : "+e);}
735

  
968
			System.out.println("netClient.dropAttribute(pattribute3)");
969
			netClient.dropAttribute(pattribute3);
970
		}
971
		catch (Exception e) {
972
			System.out.println("Exception : " + e);
973
		}
974
		
736 975
		try {
737
			System.out.println("client.dropCorpus(corpus)");client.dropCorpus(corpus);
738
		} catch(Exception e) { System.out.println("Exception : "+e);}
976
			System.out.println("client.dropCorpus(corpus)");
977
			client.dropCorpus(corpus);
978
		}
979
		catch (Exception e) {
980
			System.out.println("Exception : " + e);
981
		}
739 982
		try {
740
			System.out.println("netClient.dropCorpus(corpus)");netClient.dropCorpus(corpus);
741
		} catch(Exception e) { System.out.println("Exception : "+e);}
742

  
983
			System.out.println("netClient.dropCorpus(corpus)");
984
			netClient.dropCorpus(corpus);
985
		}
986
		catch (Exception e) {
987
			System.out.println("Exception : " + e);
988
		}
989
		
743 990
		try {
744
			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
745
		} catch(Exception e) { System.out.println("Exception : "+e);}
991
			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : " + Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
992
		}
993
		catch (Exception e) {
994
			System.out.println("Exception : " + e);
995
		}
746 996
		try {
747
			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : "+Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
748
		} catch(Exception e) { System.out.println("Exception : "+e);}
749

  
997
			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCH, 1, 2) : " + Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 10)));
998
		}
999
		catch (Exception e) {
1000
			System.out.println("Exception : " + e);
1001
		}
1002
		
750 1003
		try {
751
			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
752
		} catch(Exception e) { System.out.println("Exception : "+e);}
1004
			System.out.println("client.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : " + Arrays.toString(client.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
1005
		}
1006
		catch (Exception e) {
1007
			System.out.println("Exception : " + e);
1008
		}
753 1009
		try {
754
			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : "+Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1, 10)));
755
		} catch(Exception e) { System.out.println("Exception : "+e);}
756

  
757
		//		try {
758
		//			System.out.println("client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
759
		//		} catch(Exception e) { System.out.println("Exception : "+e);}
760
		//		try {
761
		//			System.out.println("netClient.fdist1(arg0, arg1, arg2, arg3) : "+netClient.fdist1(arg0, arg1, arg2, arg3));
762
		//		} catch(Exception e) { System.out.println("Exception : "+e);}
763

  
764
		//		try {
765
		//			System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
766
		//		} catch(Exception e) { System.out.println("Exception : "+e);}
767
		//		try {
768
		//			System.out.println("//netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
769
		//		} catch(Exception e) { System.out.println("Exception : "+e);}
770

  
1010
			System.out.println("netClient.dumpSubCorpus(subcorpus, CQI_CONST_FIELD_MATCHEND, 1, 2) : " + Arrays.toString(netClient.dumpSubCorpus(subcorpusid, NetCqiClient.CQI_CONST_FIELD_MATCHEND, 1,
1011
					10)));
1012
		}
1013
		catch (Exception e) {
1014
			System.out.println("Exception : " + e);
1015
		}
1016
		
1017
		// try {
1018
		// System.out.println("client.fdist1(arg0, arg1, arg2, arg3) : "+client.fdist1(arg0, arg1, arg2, arg3));
1019
		// } catch(Exception e) { System.out.println("Exception : "+e);}
1020
		// try {
1021
		// System.out.println("netClient.fdist1(arg0, arg1, arg2, arg3) : "+netClient.fdist1(arg0, arg1, arg2, arg3));
1022
		// } catch(Exception e) { System.out.println("Exception : "+e);}
1023
		
1024
		// try {
1025
		// System.out.println("//client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+client.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
1026
		// } catch(Exception e) { System.out.println("Exception : "+e);}
1027
		// try {
1028
		// System.out.println("//netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5) : "+netClient.fdist2(arg0, arg1, arg2, arg3, arg4, arg5));
1029
		// } catch(Exception e) { System.out.println("Exception : "+e);}
1030
		
771 1031
		try {
772
			System.out.println("client.getLastCqiError() : "+client.getLastCqiError());
773
		} catch(Exception e) { System.out.println("Exception : "+e);}
1032
			System.out.println("client.getLastCqiError() : " + client.getLastCqiError());
1033
		}
1034
		catch (Exception e) {
1035
			System.out.println("Exception : " + e);
1036
		}
774 1037
		try {
775
			System.out.println("netClient.getLastCqiError() : "+netClient.getLastCqiError());
776
		} catch(Exception e) { System.out.println("Exception : "+e);}
777

  
1038
			System.out.println("netClient.getLastCqiError() : " + netClient.getLastCqiError());
1039
		}
1040
		catch (Exception e) {
1041
			System.out.println("Exception : " + e);
1042
		}
1043
		
778 1044
		try {
779
			System.out.println("client.getLastCQPError() : "+client.getLastCQPError());
780
		} catch(Exception e) { System.out.println("Exception : "+e);}
1045
			System.out.println("client.getLastCQPError() : " + client.getLastCQPError());
1046
		}
1047
		catch (Exception e) {
1048
			System.out.println("Exception : " + e);
1049
		}
781 1050
		try {
782
			System.out.println("netClient.getLastCQPError() : "+netClient.getLastCQPError());
783
		} catch(Exception e) { System.out.println("Exception : "+e);}
784

  
1051
			System.out.println("netClient.getLastCQPError() : " + netClient.getLastCQPError());
1052
		}
1053
		catch (Exception e) {
1054
			System.out.println("Exception : " + e);
1055
		}
1056
		
785 1057
		try {
786
			System.out.println("client.id2Cpos(pattribute1, 0) : "+Arrays.toString(client.id2Cpos(pattribute1, 0)));
787
		} catch(Exception e) { System.out.println("Exception : "+e);}
1058
			System.out.println("client.id2Cpos(pattribute1, 0) : " + Arrays.toString(client.id2Cpos(pattribute1, 0)));
1059
		}
1060
		catch (Exception e) {
1061
			System.out.println("Exception : " + e);
1062
		}
788 1063
		try {
789
			System.out.println("netClient.id2Cpos(pattribute1, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute1, 0)));
790
		} catch(Exception e) { System.out.println("Exception : "+e);}
791

  
1064
			System.out.println("netClient.id2Cpos(pattribute1, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute1, 0)));
1065
		}
1066
		catch (Exception e) {
1067
			System.out.println("Exception : " + e);
1068
		}
1069
		
792 1070
		try {
793
			System.out.println("client.id2Cpos(pattribute2, 0) : "+Arrays.toString(client.id2Cpos(pattribute2, 0)));
794
		} catch(Exception e) { System.out.println("Exception : "+e);}
1071
			System.out.println("client.id2Cpos(pattribute2, 0) : " + Arrays.toString(client.id2Cpos(pattribute2, 0)));
1072
		}
1073
		catch (Exception e) {
1074
			System.out.println("Exception : " + e);
1075
		}
795 1076
		try {
796
			System.out.println("netClient.id2Cpos(pattribute2, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute2, 0)));
797
		} catch(Exception e) { System.out.println("Exception : "+e);}
798

  
1077
			System.out.println("netClient.id2Cpos(pattribute2, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute2, 0)));
1078
		}
1079
		catch (Exception e) {
1080
			System.out.println("Exception : " + e);
1081
		}
1082
		
799 1083
		try {
800
			System.out.println("client.id2Cpos(pattribute3, 0) : "+Arrays.toString(client.id2Cpos(pattribute3, 0)));
801
		} catch(Exception e) { System.out.println("Exception : "+e);}
1084
			System.out.println("client.id2Cpos(pattribute3, 0) : " + Arrays.toString(client.id2Cpos(pattribute3, 0)));
1085
		}
1086
		catch (Exception e) {
1087
			System.out.println("Exception : " + e);
1088
		}
802 1089
		try {
803
			System.out.println("netClient.id2Cpos(pattribute3, 0) : "+Arrays.toString(netClient.id2Cpos(pattribute3, 0)));
804
		} catch(Exception e) { System.out.println("Exception : "+e);}
805

  
1090
			System.out.println("netClient.id2Cpos(pattribute3, 0) : " + Arrays.toString(netClient.id2Cpos(pattribute3, 0)));
1091
		}
1092
		catch (Exception e) {
1093
			System.out.println("Exception : " + e);
1094
		}
1095
		
806 1096
		try {
807
			System.out.println("client.id2Cpos(pattribute1, 1) : "+Arrays.toString(client.id2Cpos(pattribute1, 1)));
808
		} catch(Exception e) { System.out.println("Exception : "+e);}
1097
			System.out.println("client.id2Cpos(pattribute1, 1) : " + Arrays.toString(client.id2Cpos(pattribute1, 1)));
1098
		}
1099
		catch (Exception e) {
1100
			System.out.println("Exception : " + e);
1101
		}
809 1102
		try {
810
			System.out.println("netClient.id2Cpos(pattribute1, 1) : "+Arrays.toString(netClient.id2Cpos(pattribute1, 1)));
811
		} catch(Exception e) { System.out.println("Exception : "+e);}
812

  
1103
			System.out.println("netClient.id2Cpos(pattribute1, 1) : " + Arrays.toString(netClient.id2Cpos(pattribute1, 1)));
1104
		}
1105
		catch (Exception e) {
1106
			System.out.println("Exception : " + e);
1107
		}
1108
		
813 1109
		try {
814
			System.out.println("client.id2Cpos(pattribute2, 1) : "+Arrays.toString(client.id2Cpos(pattribute2, 1)));
815
		} catch(Exception e) { System.out.println("Exception : "+e);}
1110
			System.out.println("client.id2Cpos(pattribute2, 1) : " + Arrays.toString(client.id2Cpos(pattribute2, 1)));
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff