Révision 293
tmp/org.txm.core/data.properties (revision 293) | ||
---|---|---|
1 |
#HSQL Database Engine 2.0.0 |
|
2 |
#Mon Oct 19 18:27:18 CEST 2015 |
|
3 |
version=2.0.0 |
|
4 |
modified=yes |
|
0 | 5 |
tmp/org.txm.core/log4j.properties (revision 293) | ||
---|---|---|
1 |
log4j.rootLogger=FATAL |
|
0 | 2 |
tmp/org.txm.core/data.script (revision 293) | ||
---|---|---|
1 |
SET DATABASE UNIQUE NAME HSQLDB5080D3E890 |
|
2 |
SET DATABASE GC 0 |
|
3 |
SET DATABASE DEFAULT RESULT MEMORY ROWS 0 |
|
4 |
SET DATABASE EVENT LOG LEVEL 0 |
|
5 |
SET DATABASE SQL SIZE TRUE |
|
6 |
SET DATABASE SQL NAMES FALSE |
|
7 |
SET DATABASE TRANSACTION CONTROL LOCKS |
|
8 |
SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED |
|
9 |
SET FILES WRITE DELAY 500 MILLIS |
|
10 |
SET FILES BACKUP INCREMENT TRUE |
|
11 |
SET FILES CACHE SIZE 10000 |
|
12 |
SET FILES CACHE ROWS 50000 |
|
13 |
SET FILES SCALE 8 |
|
14 |
SET FILES LOB SCALE 32 |
|
15 |
SET FILES DEFRAG 20 |
|
16 |
SET FILES NIO TRUE |
|
17 |
SET FILES LOG TRUE |
|
18 |
SET FILES LOG SIZE 50 |
|
19 |
SET DATABASE TEXT TABLE DEFAULTS '' |
|
20 |
CREATE USER SA PASSWORD '' |
|
21 |
CREATE SCHEMA PUBLIC AUTHORIZATION DBA |
|
22 |
SET SCHEMA PUBLIC |
|
23 |
ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 |
|
24 |
SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC |
|
25 |
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC |
|
26 |
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC |
|
27 |
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC |
|
28 |
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC |
|
29 |
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC |
|
30 |
GRANT DBA TO SA |
|
31 |
SET SCHEMA SYSTEM_LOBS |
|
32 |
INSERT INTO BLOCKS VALUES(0,2147483647,0) |
tmp/org.txm.core/.settings/org.eclipse.jdt.core.prefs (revision 293) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.groovy |
|
3 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
4 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
|
5 |
org.eclipse.jdt.core.compiler.compliance=1.6 |
|
6 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|
7 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|
8 |
org.eclipse.jdt.core.compiler.source=1.6 |
|
0 | 9 |
tmp/org.txm.core/.settings/org.eclipse.jdt.groovy.core.prefs (revision 293) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
groovy.compiler.level=23 |
|
3 |
groovy.script.filters=scripts/**/*.groovy,y,src/main/resources/**/*.groovy,y,src/test/resources/**/*.groovy,y |
|
0 | 4 |
tmp/org.txm.core/.settings/org.eclipse.core.resources.prefs (revision 293) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
encoding/<project>=UTF-8 |
|
0 | 3 |
tmp/org.txm.core/.settings/org.eclipse.ltk.core.refactoring.prefs (revision 293) | ||
---|---|---|
1 |
#Wed Jan 12 14:19:56 CET 2011 |
|
2 |
eclipse.preferences.version=1 |
|
3 |
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false |
|
0 | 4 |
tmp/org.txm.core/test/org/txm/StartToolbox.java (revision 293) | ||
---|---|---|
1 |
package org.txm; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.junit.Test; |
|
6 |
|
|
7 |
public class StartToolbox { |
|
8 |
|
|
9 |
@Test |
|
10 |
public void test() throws Exception { |
|
11 |
String home = System.getProperty("user.home"); |
|
12 |
String product_configuration_path = "runtime-rcpapplication.product/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.txm.rcpapplication.prefs"; |
|
13 |
File properties = new File(home, product_configuration_path); |
|
14 |
Toolbox.initialize(properties); |
|
15 |
} |
|
16 |
|
|
17 |
} |
|
0 | 18 |
tmp/org.txm.core/test/org/txm/annotation/temporary/AllTests.java (revision 293) | ||
---|---|---|
1 |
package org.txm.annotation.temporary; |
|
2 |
|
|
3 |
import org.junit.runner.RunWith; |
|
4 |
import org.junit.runners.Suite; |
|
5 |
import org.junit.runners.Suite.SuiteClasses; |
|
6 |
import org.txm.StartToolbox; |
|
7 |
|
|
8 |
@RunWith(Suite.class) |
|
9 |
@SuiteClasses({ StartToolbox.class, CreateAnnotation.class, DeleteAnnotation.class, |
|
10 |
UpdateAnnotation.class }) |
|
11 |
public class AllTests { |
|
12 |
|
|
13 |
} |
|
0 | 14 |
tmp/org.txm.core/test/org/txm/annotation/temporary/DeleteAnnotation.java (revision 293) | ||
---|---|---|
1 |
package org.txm.annotation.temporary; |
|
2 |
|
|
3 |
import static org.junit.Assert.*; |
|
4 |
|
|
5 |
import org.junit.Test; |
|
6 |
|
|
7 |
public class DeleteAnnotation { |
|
8 |
|
|
9 |
@Test |
|
10 |
public void test() { |
|
11 |
fail("Not yet implemented"); |
|
12 |
} |
|
13 |
|
|
14 |
} |
|
0 | 15 |
tmp/org.txm.core/test/org/txm/annotation/temporary/UpdateAnnotation.java (revision 293) | ||
---|---|---|
1 |
package org.txm.annotation.temporary; |
|
2 |
|
|
3 |
import static org.junit.Assert.*; |
|
4 |
|
|
5 |
import org.junit.Test; |
|
6 |
|
|
7 |
public class UpdateAnnotation { |
|
8 |
|
|
9 |
@Test |
|
10 |
public void test() { |
|
11 |
fail("Not yet implemented"); |
|
12 |
} |
|
13 |
|
|
14 |
} |
|
0 | 15 |
tmp/org.txm.core/test/org/txm/annotation/temporary/CreateAnnotation.java (revision 293) | ||
---|---|---|
1 |
package org.txm.annotation.temporary; |
|
2 |
|
|
3 |
import static org.junit.Assert.*; |
|
4 |
|
|
5 |
import java.util.HashMap; |
|
6 |
|
|
7 |
import org.junit.Test; |
|
8 |
import org.txm.Toolbox; |
|
9 |
import org.txm.annotation.storage.temporary.TemporaryAnnotationManager; |
|
10 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
11 |
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException; |
|
12 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
13 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
14 |
|
|
15 |
public class CreateAnnotation { |
|
16 |
|
|
17 |
@Test |
|
18 |
public void test() throws CqiClientException, InvalidCqpIdException { |
|
19 |
if (!Toolbox.isInitialized()) fail("Toolbox not initialized."); |
|
20 |
MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus("VOEUX"); |
|
21 |
if (corpus == null) fail("Corpus Voeux not loaded."); |
|
22 |
|
|
23 |
HashMap<String, Object> properties = TemporaryAnnotationManager.getInitialisationProperties(corpus); |
|
24 |
properties.put("eclipselink.persistencexml", System.getProperty("user.home")+"/workspace442/org.txm.toolbox/META-INF/persistence.xml"); |
|
25 |
|
|
26 |
TemporaryAnnotationManager tam = new TemporaryAnnotationManager(corpus, properties); |
|
27 |
System.out.println(tam); |
|
28 |
} |
|
29 |
|
|
30 |
} |
|
0 | 31 |
tmp/org.txm.core/default.xml (revision 293) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<workspace name="default"> |
|
3 |
<projects> |
|
4 |
<project name="default"> |
|
5 |
<bases> |
|
6 |
</bases> |
|
7 |
|
|
8 |
<corpora> |
|
9 |
</corpora> |
|
10 |
</project> |
|
11 |
</projects> |
|
12 |
</workspace> |
|
0 | 13 |
tmp/org.txm.core/.project (revision 293) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.core</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
<buildCommand> |
|
24 |
<name>net.sourceforge.metrics.builder</name> |
|
25 |
<arguments> |
|
26 |
</arguments> |
|
27 |
</buildCommand> |
|
28 |
<buildCommand> |
|
29 |
<name>com.stateofflow.eclipse.metrics.MetricsBuilder</name> |
|
30 |
<arguments> |
|
31 |
</arguments> |
|
32 |
</buildCommand> |
|
33 |
</buildSpec> |
|
34 |
<natures> |
|
35 |
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature> |
|
36 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
37 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
38 |
<nature>net.sourceforge.metrics.nature</nature> |
|
39 |
<nature>com.stateofflow.eclipse.metrics.MetricsNature</nature> |
|
40 |
</natures> |
|
41 |
</projectDescription> |
|
0 | 42 |
tmp/org.txm.core/buildTST.properties (revision 293) | ||
---|---|---|
1 |
bin.includes = META-INF/,\ |
|
2 |
.,\ |
|
3 |
lib/ |
|
4 |
jars.compile.order = .,\ |
|
5 |
bin/ |
|
6 |
source.. = src/groovy/,\ |
|
7 |
src/java/ |
|
8 |
jars.extra.classpath = lib/ant-1.7.1.jar,\ |
|
9 |
lib/antlr-2.7.7.jar,\ |
|
10 |
lib/asm-analysis-2.2.3.jar,\ |
|
11 |
lib/asm-tree-2.2.3.jar,\ |
|
12 |
lib/colt-1.2.0.jar,\ |
|
13 |
lib/commons-cli-1.2.jar,\ |
|
14 |
lib/commons-io-1.4.jar,\ |
|
15 |
lib/commons-lang-2.4.jar,\ |
|
16 |
lib/concurrent-1.3.4.jar,\ |
|
17 |
lib/hsqldb.jar,\ |
|
18 |
lib/jline-0.9.94.jar,\ |
|
19 |
lib/junit-4.5.jar,\ |
|
20 |
lib/log4j-1.2.12.jar,\ |
|
21 |
lib/REngine.jar,\ |
|
22 |
lib/RserveEngine.jar,\ |
|
23 |
lib/saxon-xom-9.2.jar |
|
24 |
source.. = src/java/ |
|
25 |
output.. = bin/ |
|
0 | 26 |
tmp/org.txm.core/buildJavadoc.xml (revision 293) | ||
---|---|---|
1 |
<project name="Toolbox" default="doc"> |
|
2 |
|
|
3 |
<path id="lib.dir"> |
|
4 |
<!-- fileset : TO BE DEFINED MANUALLY --> |
|
5 |
<fileset dir="/home/mdecorde/LIBRAIRIES/groovy-2.2.1/embeddable"> |
|
6 |
<include name="*.jar" /> |
|
7 |
</fileset> |
|
8 |
</path> |
|
9 |
|
|
10 |
<tstamp> |
|
11 |
<format property="TODAY" pattern="yyyy-MM-dd HH:mm" /> |
|
12 |
</tstamp> |
|
13 |
|
|
14 |
<taskdef name="groovydoc" classname="org.codehaus.groovy.ant.Groovydoc" classpathref="lib.dir" /> |
|
15 |
|
|
16 |
<target name="doc"> |
|
17 |
<mkdir dir="javadoc/" /> |
|
18 |
<!-- packagenames : TO BE UPDATED MANUALLY using TBX exported packages list. BECAUSE org.txm.utils.tostring.ToString make groovydoc raise an exception ... --> |
|
19 |
<groovydoc |
|
20 |
destdir="javadoc/" |
|
21 |
sourcepath="src/java:src/groovy" |
|
22 |
packagenames="filters.BuildXmlLiturgie,filters.Concatenator,filters.CutHeader,filters.EliminateWhiteSpaces,filters.FusionHeader,filters.FusionXmlHeaderBody,filters.MinimalFilter,filters.OneOpenTagPerLine,filters.OneTagPerLine,filters.ProcessEnclitics,filters.ProcessQuotes,filters.RegexFilter,filters.ReunitBrokenTags,filters.ReunitBrokenWords,filters.TagSentences,filters.Tokeniser,filters.WordInternalElement,filters.eliminateNAttributes,org.txm,org.txm.annotation,org.txm.doc,org.txm.export,org.txm.export.conll2009,org.txm.export.ts,org.txm.functions,org.txm.functions.ca,org.txm.functions.classification,org.txm.functions.concordances,org.txm.functions.concordances.comparators,org.txm.functions.contrasts,org.txm.functions.cooccurrences,org.txm.functions.cooccurrences.comparators,org.txm.functions.coocmatrix,org.txm.functions.diagnostic,org.txm.functions.internal,org.txm.functions.intertextualdistance,org.txm.functions.mesures,org.txm.functions.parabrowser,org.txm.functions.parallelcontexts,org.txm.functions.preview,org.txm.functions.queryindex,org.txm.functions.referencer,org.txm.functions.progression,org.txm.functions.selection,org.txm.functions.specificities,org.txm.functions.summary,org.txm.functions.index,org.txm.importer,org.txm.importer.RGAQCJ,org.txm.importer.alceste,org.txm.importer.bfm,org.txm.importer.bvh,org.txm.importer.corptef,org.txm.importer.csv,org.txm.importer.cwb,org.txm.importer.discours,org.txm.importer.doc,org.txm.importer.europress,org.txm.importer.factiva,org.txm.importer.filters,org.txm.importer.fleurs,org.txm.importer.frantext,org.txm.importer.graal,org.txm.importer.hyperbase,org.txm.importer.hyperprince,org.txm.importer.lasla,org.txm.importer.limsi,org.txm.importer.perrault,org.txm.importer.quick,org.txm.importer.scripting,org.txm.importer.tigersearch,org.txm.importer.tmx,org.txm.importer.transana,org.txm.importer.transcriber,org.txm.importer.wtc,org.txm.importer.xml,org.txm.importer.xmltxm,org.txm.importer.xmltxmpara,org.txm.metadatas,org.txm.objects,org.txm.renderer,org.txm.scripts,org.txm.scripts.clix,org.txm.scripts.i18n,org.txm.scripts.teitxm,org.txm.scripts.tigersearch,org.txm.searchengine.cqp,org.txm.searchengine.cqp.clientExceptions,org.txm.searchengine.cqp.corpus,org.txm.searchengine.cqp.corpus.query,org.txm.searchengine.cqp.serverException,org.txm.searchengine.ts,org.txm.setup,org.txm.sql,org.txm.stat,org.txm.stat.data,org.txm.stat.engine.r,org.txm.stat.engine.r.data,org.txm.stat.engine.r.function,org.txm.stat.engine.r.rcolt,org.txm.stat.utils,org.txm.svn,org.txm.sw,org.txm.test,org.txm.tests,org.txm.tokenizer,org.txm.toolbox,org.txm.utils,org.txm.utils.i18n,org.txm.utils.logger,org.txm.utils.processbuilder,org.txm.utils.saxon,org.txm.utils.treetagger" |
|
23 |
use="true" |
|
24 |
windowtitle="TXM Groovy and Java documentation ${TODAY}" |
|
25 |
doctitle="TXM Groovy and Java documentation ${TODAY}" |
|
26 |
header="TXM Groovy and Java documentation ${TODAY}" |
|
27 |
footer="TXM Groovy and Java documentation ${TODAY}" |
|
28 |
private="false"> |
|
29 |
|
|
30 |
<link packages="java.,org.xml.,javax.,org.xml." href="http://java.sun.com/j2se/1.5.0/docs/api" /> |
|
31 |
<link packages="org.apache.ant.,org.apache.tools.ant." href="http://www.dpml.net/api/ant/1.7.0" /> |
|
32 |
<link packages="org.junit.,junit.framework." href="http://junit.sourceforge.net/junit3.8.1/javadoc/" /> |
|
33 |
<link packages="groovy.,org.codehaus.groovy." href="http://groovy.codehaus.org/api/" /> |
|
34 |
</groovydoc> |
|
35 |
</target> |
|
36 |
</project> |
|
0 | 37 |
tmp/org.txm.core/src/groovy/tests/tests_cql.groovy (revision 293) | ||
---|---|---|
1 |
package tests |
|
2 |
import java.util.UUID; |
|
3 |
|
|
4 |
import org.txm.Toolbox |
|
5 |
import org.txm.searchengine.cqp.MemCqiClient |
|
6 |
import org.txm.searchengine.cqp.MemCqiServer |
|
7 |
import org.txm.searchengine.cqp.corpus.* |
|
8 |
import org.txm.functions.ReferencePattern |
|
9 |
import org.txm.rcpapplication.views.* |
|
10 |
import org.txm.searchengine.cqp.corpus.query.Query |
|
11 |
|
|
12 |
// Debug |
|
13 |
println "******************************** Starting ********************************************"; |
|
14 |
|
|
15 |
|
|
16 |
// Tests suite de requêtes directement sur le serveur et création manuelle du sous-corpus |
|
17 |
|
|
18 |
// parameters |
|
19 |
def CORPUS = "LIVRETOPERA10TEXTES" |
|
20 |
//def SUBCORPUS = "NOMDUSOUSCORPUS" |
|
21 |
// def SUBCORPUS = null // si partition sur corpus |
|
22 |
//def SUBCORPUSQUERY = '"je" expand to s' |
|
23 |
//def SUBCORPUSQUERY = null // si sous-corpus par nom |
|
24 |
|
|
25 |
|
|
26 |
def discours = CorpusManager.getCorpusManager().getCorpus(CORPUS) |
|
27 |
def subcorpusCqpId = 'S' + UUID.randomUUID().toString(); |
|
28 |
|
|
29 |
try { |
|
30 |
def server = (MemCqiServer)Toolbox.getCqiServer(); |
|
31 |
|
|
32 |
// server.query('show corpora;'); |
|
33 |
// server.query("info " + CORPUS + ";"); |
|
34 |
|
|
35 |
server.query(CORPUS + ";"); |
|
36 |
|
|
37 |
//client.query(SUBCORPUSQUERY); |
|
38 |
|
|
39 |
// Suppression de variable de résultats |
|
40 |
// server.query("discard A;"); |
|
41 |
// server.query("discard B;"); |
|
42 |
// server.query("discard C;"); |
|
43 |
|
|
44 |
// server.query('C = /region[sp,a]::a.sp_who="IPHIS";'); |
|
45 |
|
|
46 |
|
|
47 |
// Test mono ligne : ne fonctionne pas en mode server |
|
48 |
// server.query('A = /region[sp]; B = /region[speaker]; C = difference B A;'); |
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
// server.query('A = /region[sp];'); |
|
53 |
// server.query('B = /region[speaker];'); |
|
54 |
// server.query('C = difference A B;'); |
|
55 |
|
|
56 |
// Tests options d'affichage |
|
57 |
server.query('show cd;'); |
|
58 |
server.query('show +div1 +div2 +sp +lg +l +speaker;'); // Affichage des balises XML dans les listes de résultats |
|
59 |
//server.query('set ShowTagAttributes on;'); |
|
60 |
|
|
61 |
// Tests |
|
62 |
// server.query('A = /region[sp,a]::a.sp_who="THALIE";'); |
|
63 |
// server.query('B = /region[speaker];'); |
|
64 |
// server.query(subcorpusCqpId + ' = diff A B;'); |
|
65 |
|
|
66 |
|
|
67 |
//server.query(subcorpusCqpId + ' = B;'); |
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
// server.query(subcorpusCqpId + ' = <sp>[(_.) != "speaker"]+</sp>;'); |
|
72 |
//server.query(subcorpusCqpId + ' = <div1>[]*<sp>[]+</sp>[]*</div1>;'); |
|
73 |
|
|
74 |
//server.query(subcorpusCqpId + ' = <div1>[!speaker]*</div1>;'); |
|
75 |
|
|
76 |
// server.query(subcorpusCqpId + ' = <lg>[_.div1_n=".*" & _.sp_who="THALIE"]+</lg>;'); |
|
77 |
// server.query(subcorpusCqpId + ' = /region[i];'); |
|
78 |
|
|
79 |
|
|
80 |
// Tests de requête sur le sous-corpus créé |
|
81 |
//server.query('set MatchingStrategy shortest;'); // standard, shortest, longest, traditional |
|
82 |
//server.query(subcorpusCqpId + ' = [div1 & _.sp_who="THALIE" & !speaker];'); |
|
83 |
//server.query(subcorpusCqpId + ' = [_.div1_name=".*" & !speaker];'); |
|
84 |
//server.query(subcorpusCqpId + ' = [_.div1_name=".*" & !speaker] expand to lg;'); |
|
85 |
server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;'); |
|
86 |
|
|
87 |
|
|
88 |
//server.query('group ' + subcorpusCqpId + ' match word;'); |
|
89 |
|
|
90 |
server.query(subcorpusCqpId + ';'); |
|
91 |
|
|
92 |
|
|
93 |
//server.query(subcorpusCqpId + ' = [] !;'); |
|
94 |
//server.query(subcorpusCqpId + ';'); |
|
95 |
//server.query(subcorpusCqpId + ' = [] !;'); |
|
96 |
// server.query(subcorpusCqpId + ' = [] expand to div1 & !speaker;'); |
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
//server.query(subcorpusCqpId + ' = [div1 & !speaker];'); |
|
101 |
//server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;'); |
|
102 |
//server.query(subcorpusCqpId + ' = [div1 & !speaker] expand to lg;'); |
|
103 |
|
|
104 |
//server.query(subcorpusCqpId + ' = [div1 & !speaker];'); |
|
105 |
|
|
106 |
//server.query(subcorpusCqpId + ' = [div1 &_.sp_who="THALIE" & !speaker];'); |
|
107 |
|
|
108 |
//server.query(subcorpusCqpId + ' = [div1 &_.sp_who="THALIE" & !speaker];'); |
|
109 |
//server.query(subcorpusCqpId + ' = "fin" [];'); |
|
110 |
//server.query(subcorpusCqpId + ' = [div1 & _.sp_who="THALIE" & !speaker];'); |
|
111 |
|
|
112 |
// Affichage du sous-corpus |
|
113 |
//server.query("cat " + subcorpusCqpId + " 0 10;") |
|
114 |
server.query("cat " + subcorpusCqpId + ";") |
|
115 |
|
|
116 |
//server.cqpQuery(discours.getCqpId(), 'subcorpusid', SUBCORPUSQUERY); |
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
// Affichage des erreurs |
|
121 |
try { |
|
122 |
System.out.println("client.getLastCqiError() : "+server.getLastCqiError()); |
|
123 |
} catch(Exception e) { System.out.println("Exception : "+e);} |
|
124 |
try { |
|
125 |
System.out.println("client.getLastCQPError() : "+server.getLastCQPError()); |
|
126 |
} catch(Exception e) { System.out.println("Exception : "+e);} |
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
// Création manuelle du sous-corpus |
|
131 |
// Subcorpus subcorpus = new Subcorpus(subcorpusCqpId, "subcorpus" + subcorpusCqpId.toString().substring(0, 5), discours, new Query()); // FIXME : est-ce que cela pose un problème de passer une Query() vide ici ? |
|
132 |
// discours.subcorpora.add(subcorpus); |
|
133 |
// subcorpus.registerToParent(); |
|
134 |
|
|
135 |
// Création manuelle d'une partition |
|
136 |
// subcorpus.createPartition(NAME, QUERIES, PARTNAMES) |
|
137 |
|
|
138 |
|
|
139 |
} |
|
140 |
catch(Exception e) { |
|
141 |
System.out.println("Exception : "+e); |
|
142 |
} |
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
// Refresh de l'interface |
|
147 |
monitor.syncExec(new Runnable() { |
|
148 |
public void run() { |
|
149 |
CorporaView.refresh(); |
|
150 |
//CorporaView.expand(partition.getParent()); |
|
151 |
} |
|
152 |
}); |
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
//// parameters |
|
160 |
//def CORPUS = "LIVRETOPERA10TEXTES" |
|
161 |
////def SUBCORPUS = "NOMDUSOUSCORPUS" |
|
162 |
//def SUBCORPUS = null // si partition sur corpus |
|
163 |
////def SUBCORPUSQUERY = '"je" expand to s' |
|
164 |
//def SUBCORPUSQUERY = null // si sous-corpus par nom |
|
165 |
// |
|
166 |
// |
|
167 |
// |
|
168 |
//// Liste des unités strcuturelles |
|
169 |
////def HIERARCHY = ['text_id', 'div1_n', 'sp_who', 'lg']; |
|
170 |
//def STRUCTURAL_UNITS = ['text', 'div1', 'sp']; |
|
171 |
//def STRUCTURAL_UNITS_PROPERTIES = ['id', 'n', 'who']; |
|
172 |
////def TARGET = 'lg'; |
|
173 |
// |
|
174 |
//String NAME = ''; |
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
179 |
//def TEXT = "01_ACHILLE ET POLYXENE" |
|
180 |
// def TEXT = "02_ZEPHIRE ET FLORE" |
|
181 |
/*def QUERIES = [ |
|
182 |
'<lg>[_.text_id="' + TEXT + '" & _.div1_n="1" & _.sp_who=".*"]+</lg>', |
|
183 |
'<lg>[_.text_id="' + TEXT + '" & _.div1_n="2" & _.sp_who=".*"]+</lg>', |
|
184 |
'<lg>[_.text_id="' + TEXT + '" & _.div1_n="3" & _.sp_who=".*"]+</lg>', |
|
185 |
'<lg>[_.text_id="' + TEXT + '" & _.div1_n="4" & _.sp_who=".*"]+</lg>', |
|
186 |
'<lg>[_.text_id="' + TEXT + '" & _.div1_n="5" & _.sp_who=".*"]+</lg>', |
|
187 |
] |
|
188 |
def PARTNAMES = [ |
|
189 |
"acte_1", |
|
190 |
"acte_2", |
|
191 |
"acte_3", |
|
192 |
"acte_4", |
|
193 |
"acte_5", |
|
194 |
]*/ |
|
195 |
|
|
196 |
|
|
197 |
//def discours = CorpusManager.getCorpusManager().getCorpus(CORPUS) |
|
198 |
// |
|
199 |
// |
|
200 |
//// Récupération des unités structurelles |
|
201 |
//def i = 0; |
|
202 |
//def supName; |
|
203 |
//def QUERIES; |
|
204 |
//def query; |
|
205 |
// |
|
206 |
//for (suName in STRUCTURAL_UNITS) { |
|
207 |
// |
|
208 |
// |
|
209 |
// // Définition auto du nom de partition |
|
210 |
// NAME += suName + '_'; |
|
211 |
// |
|
212 |
// //query = ''; |
|
213 |
// |
|
214 |
// |
|
215 |
// println "Structural Unit Name: $suName" |
|
216 |
// |
|
217 |
// // Récupération des valeurs des propriétés d'unités structurelles |
|
218 |
// for (sup in discours.getStructuralUnitProperties(suName.asType(String))) { |
|
219 |
// |
|
220 |
// supName = STRUCTURAL_UNITS_PROPERTIES[i]; |
|
221 |
// |
|
222 |
// if(supName != '' && sup.getName() == supName) { |
|
223 |
// |
|
224 |
// // Définition auto du nom de partition |
|
225 |
// NAME += supName + "."; |
|
226 |
// |
|
227 |
// println "Structural Unit Property: $supName"; |
|
228 |
// |
|
229 |
// for (supValue in sup.getOrderedValues()) { |
|
230 |
// |
|
231 |
// //query += '<' + TARGET + '>' + supName; |
|
232 |
// |
|
233 |
// |
|
234 |
// print "$supValue " |
|
235 |
// } |
|
236 |
// } |
|
237 |
// } |
|
238 |
// i++; |
|
239 |
//} |
|
240 |
// |
|
241 |
//// Suppression du dernier underscore ou point |
|
242 |
//NAME = NAME.substring(0, NAME.length() - 1); |
|
243 |
//// Debug |
|
244 |
//println "NAME: " + NAME; |
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
|
253 |
// start |
|
254 |
/*if (QUERIES.size() == PARTNAMES.size()) { |
|
255 |
|
|
256 |
def partition; |
|
257 |
|
|
258 |
|
|
259 |
// Test unités structurelles |
|
260 |
for (t in discours.getStructuralUnits()) { |
|
261 |
println "Structural Unit: $t" |
|
262 |
|
|
263 |
// Test propriétés d'unités structurelles |
|
264 |
for (g in discours.getStructuralUnitProperties(t.asType(String))) { |
|
265 |
|
|
266 |
println "\tStructural Unit Property: $g" |
|
267 |
|
|
268 |
// Test valeurs des propriétés d'unités structurelles |
|
269 |
for (h in g.getOrderedValues()) { |
|
270 |
|
|
271 |
print "$h, " |
|
272 |
|
|
273 |
} |
|
274 |
|
|
275 |
} |
|
276 |
|
|
277 |
} |
|
278 |
|
|
279 |
|
|
280 |
// Test propriétés |
|
281 |
for (t in discours.getProperties()) { |
|
282 |
println "Property: $t" |
|
283 |
} |
|
284 |
|
|
285 |
|
|
286 |
if (SUBCORPUS == null) { |
|
287 |
println "partition build with $discours" |
|
288 |
partition = discours.createPartition(NAME, QUERIES, PARTNAMES) |
|
289 |
} else { |
|
290 |
def subcorpus |
|
291 |
if (SUBCORPUSQUERY == null) { |
|
292 |
println "partition build with subcorpus by name $SUBCORPUS" |
|
293 |
subcorpus = discours.getSubcorpusByName(SUBCORPUS) |
|
294 |
if (subcorpus == null) { |
|
295 |
println "Error: SUBCORPUS NOT FOUND with name : $SUBCORPUS" |
|
296 |
} |
|
297 |
} else { |
|
298 |
println "partition build with subcorpus with query $SUBCORPUSQUERY" |
|
299 |
subcorpus = discours.createSubcorpus(new Query(SUBCORPUSQUERY), SUBCORPUS) |
|
300 |
} |
|
301 |
partition = subcorpus.createPartition(NAME, QUERIES, PARTNAMES) |
|
302 |
} |
|
303 |
|
|
304 |
def list = Arrays.asList(partition.getPartSizes()) |
|
305 |
println "Partition created $NAME: "+list+" parts" |
|
306 |
// println "Total size: "+list.sum()+" - is equal to (sub)corpus size : "+(list.sum() == partition.getCorpus().getSize()) |
|
307 |
println "Total size: "+list.sum()+" - (sub)corpus size : "+(partition.getCorpus().getSize()) |
|
308 |
|
|
309 |
monitor.syncExec(new Runnable() { |
|
310 |
public void run() { |
|
311 |
CorporaView.refresh(); |
|
312 |
CorporaView.expand(partition.getParent()); |
|
313 |
} |
|
314 |
}); |
|
315 |
} else { |
|
316 |
println "QUERIES.size() != PARTNAMES.size() = "+QUERIES.size()+" != "+PARTNAMES.size() |
|
317 |
}*/ |
|
318 |
|
tmp/org.txm.core/src/groovy/tests/tests_groovy.groovy (revision 293) | ||
---|---|---|
1 |
print(Progression5) |
tmp/org.txm.core/src/groovy/tests/advancedPartition.groovy (revision 293) | ||
---|---|---|
1 |
package tests |
|
2 |
|
|
3 |
import org.txm.rcpapplication.views.* |
|
4 |
import org.txm.searchengine.cqp.corpus.* |
|
5 |
|
|
6 |
|
|
7 |
/* |
|
8 |
import java.awt.Dimension |
|
9 |
import java.util.UUID; |
|
10 |
|
|
11 |
import javax.swing.JFrame; |
|
12 |
import javax.swing.JOptionPane; |
|
13 |
|
|
14 |
import org.txm.Toolbox |
|
15 |
import org.txm.searchengine.cqp.MemCqiClient |
|
16 |
import org.txm.searchengine.cqp.MemCqiServer |
|
17 |
import org.txm.searchengine.cqp.corpus.* |
|
18 |
import org.txm.functions.ReferencePattern |
|
19 |
import org.txm.rcpapplication.views.CorporaView |
|
20 |
import org.txm.searchengine.cqp.corpus.query.Query |
|
21 |
*/ |
|
22 |
|
|
23 |
|
|
24 |
/** |
|
25 |
* Create partition with advanced CQL queries and autoname the parts. |
|
26 |
* Can create partitions by defining a multi-level structural units hierarchy or by defining several properties values for one structural unit. |
|
27 |
* Can define some structural units to remove from the resulting parts subcorpus. |
|
28 |
* |
|
29 |
*/ |
|
30 |
|
|
31 |
// TODO : Log |
|
32 |
println "******************************** Starting ********************************************"; |
|
33 |
|
|
34 |
|
|
35 |
// *************************** User parameters ************************************************************ |
|
36 |
|
|
37 |
|
|
38 |
// Test 1 : partition en excluant des sections |
|
39 |
def CORPUS_NAME = "LIVRETOPERA2" // The name of the corpus to partition |
|
40 |
|
|
41 |
def SUBCORPUS_NAME = null // The name of the subcorpus to partition |
|
42 |
//def SUBCORPUS_NAME = "TEST" // The name of the subcorpus to partition if needed |
|
43 |
// FIXME: subcorpus management is bugged, when trying to create a CA on a Partition created on a subcorpus, it doesn't work because of the getLexicon() method which throws a CqiCqpErrorErrorGeneral exception |
|
44 |
|
|
45 |
PartitionQueriesGenerator.STRUCTURAL_UNITS = ['sp']; // Applying the partition on these structural units |
|
46 |
PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['who']; // Applying the partition on these properties of structural units defined above |
|
47 |
|
|
48 |
PartitionQueriesGenerator.STRUCTURAL_UNITS_TO_IGNORE = ['speaker']; // These structural units will be removed from the partition. NOTE : If doing that you need to define an EXPAND_TARGET |
|
49 |
// if you want some subcorpus parts that will manage sequential positions queries |
|
50 |
|
|
51 |
PartitionQueriesGenerator.EXPAND_TARGET = 'lg'; // Expand the results to this structural unit parent target. If some structural units to ignore are defined |
|
52 |
// and the expand target is upper on the hierarchy than them, the structural units to ignore WON'T be ignored |
|
53 |
|
|
54 |
//PartitionQueriesGenerator.PARTITION_NAME = 'gugu'; // The partition name. If empty or not defined, the partition will be autonamed regarding of the structural units and properties |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
// Test 2 : partition sur arborescence (multi-niveau sur 2 niveaux) |
|
60 |
//def CORPUS_NAME = "LIVRETOPERA10TEXTES" |
|
61 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1']; |
|
62 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name']; |
|
63 |
|
|
64 |
|
|
65 |
// Test 3 : partition sur arborescence (multi-niveau sur 3 niveaux) |
|
66 |
//def CORPUS_NAME = "LIVRETOPERA10TEXTES" |
|
67 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1', 'div2']; |
|
68 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name', 'name']; |
|
69 |
|
|
70 |
|
|
71 |
// Test 4 : partition sur arborescence (multi-niveau sur 4 niveaux) |
|
72 |
// Ajouter le 'n' permet par exemple ici de trier les parties par ordre de scène car sinon le tri est problématique, ex : "SCENE II" passe avant "SCENE PREMIERE" |
|
73 |
//def CORPUS_NAME = "LIVRETOPERA2" |
|
74 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'div1', 'div2', 'div2']; |
|
75 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['id', 'name', 'n', 'name']; |
|
76 |
|
|
77 |
|
|
78 |
// Test 5 : partitions croisées (sur plusieurs propriétés d'une même structure) |
|
79 |
//def CORPUS_NAME = "DISCOURS" |
|
80 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['text', 'text']; |
|
81 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['loc', 'type']; |
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
// Tests |
|
86 |
//def CORPUS_NAME = "LIVRETOPERA10TEXTES" |
|
87 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['div1', 'sp']; |
|
88 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['name', 'who']; |
|
89 |
|
|
90 |
// Tests |
|
91 |
//def CORPUS_NAME = "LIVRETOPERA10TEXTES" |
|
92 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS = ['div1']; |
|
93 |
//PartitionQueriesGenerator.STRUCTURAL_UNITS_PROPERTIES = ['n']; |
|
94 |
//PartitionQueriesGenerator.PART_NAMES_PREFIX = 'act_'; |
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
// *************************** Debug parameters ************************************************************ |
|
100 |
|
|
101 |
|
|
102 |
PartitionQueriesGenerator.DEBUG = 0; // If DEBUG != 0 then partition is not created, |
|
103 |
// script only outputs the created queries and part names strings in console |
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
// *************************** End of parameters ************************************************************ |
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
// Running |
|
116 |
def partition = PartitionQueriesGenerator.createPartition(CORPUS_NAME, SUBCORPUS_NAME); |
|
117 |
|
|
118 |
|
|
119 |
// Refreshing the RCP component |
|
120 |
if(partition != null) { |
|
121 |
monitor.syncExec(new Runnable() { |
|
122 |
public void run() { |
|
123 |
CorporaView.refresh(); |
|
124 |
CorporaView.expand(partition.getParent()); |
|
125 |
} |
|
126 |
}); |
|
127 |
} |
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
/** |
|
134 |
* Create a list of queries and part names regarding the structural units, structural units properties, structural units to ignore user defined lists and expand target value specified. |
|
135 |
* @author s |
|
136 |
* |
|
137 |
*/ |
|
138 |
public class PartitionQueriesGenerator { |
|
139 |
|
|
140 |
public static int DEBUG = 0; // si DEBUG != 0, alors les requêtes sont affichées mais la partition n'est pas créée |
|
141 |
|
|
142 |
public static String PARTITION_NAME = ''; |
|
143 |
public static String[] STRUCTURAL_UNITS = []; // Liste des unités structurelles sur lesquelles effectuer la partition, ex: ['text', 'div1'] |
|
144 |
public static String[] STRUCTURAL_UNITS_PROPERTIES = []; // Propriétés des unités structurelles sur lesquelles effectuer la partition, ex : ['id', 'name'] |
|
145 |
public static String[] STRUCTURAL_UNITS_TO_IGNORE = []; // Structure à ignorer, ex. CQL : !speaker |
|
146 |
public static String PART_NAMES_PREFIX = ''; |
|
147 |
public static String EXPAND_TARGET = null; // Expand to target, englobe les empans jusqu'à la balise parente spécifiée. NOTE : Le expand entre en conflit avec les sections à ignorer. |
|
148 |
// Si la target est à un niveau supérieur aux balises à ignorer, il les remet dans liste de résultats CWB et elles ne sont donc pas ignorées |
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
public static ArrayList<String> queries = new ArrayList<String>(); |
|
153 |
public static ArrayList<String> partNames = new ArrayList<String>(); |
|
154 |
|
|
155 |
|
|
156 |
/** |
|
157 |
* Init the generator and process. |
|
158 |
* @param corpusName |
|
159 |
*/ |
|
160 |
public static Partition createPartition(String corpusName, String subcorpusName) { |
|
161 |
|
|
162 |
if(STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size()) { |
|
163 |
|
|
164 |
// TODO : Log |
|
165 |
println '**************************************************************************************************************' |
|
166 |
println 'Creating the queries on corpus "' + corpusName + "'" ; |
|
167 |
|
|
168 |
Corpus corpus = CorpusManager.getCorpusManager().getCorpus(corpusName); |
|
169 |
|
|
170 |
|
|
171 |
// Subcorpora |
|
172 |
if(subcorpusName != null) { |
|
173 |
corpus = corpus.getSubcorpusByName(subcorpusName); |
|
174 |
} |
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
// Recursing through the corpus and subcorpus |
|
179 |
process(corpus, 0, '', ''); |
|
180 |
|
|
181 |
// Finalizing the queries |
|
182 |
finalizeQueries(); |
|
183 |
|
|
184 |
|
|
185 |
// TODO : Debug |
|
186 |
// Displaying the partition name |
|
187 |
println ''; |
|
188 |
println 'PARTITION_NAME: ' + PartitionQueriesGenerator.PARTITION_NAME; |
|
189 |
|
|
190 |
// Displaying the queries |
|
191 |
println 'Queries (count = ' + PartitionQueriesGenerator.queries.size() + '):'; |
|
192 |
for(query in PartitionQueriesGenerator.queries) { |
|
193 |
println query; |
|
194 |
} |
|
195 |
// Displaying the part names |
|
196 |
println 'Partnames (count = ' + PartitionQueriesGenerator.partNames.size() + '):'; |
|
197 |
for(partName in PartitionQueriesGenerator.partNames) { |
|
198 |
print partName + ' / '; |
|
199 |
} |
|
200 |
|
|
201 |
|
|
202 |
// TODO : Log |
|
203 |
println 'Queries created.'; |
|
204 |
|
|
205 |
// Creating the partition |
|
206 |
if(DEBUG == 0 && queries.size() == partNames.size()) { |
|
207 |
return corpus.createPartition(PARTITION_NAME, queries, partNames); |
|
208 |
} |
|
209 |
|
|
210 |
} |
|
211 |
else { |
|
212 |
// TODO : Log |
|
213 |
println 'Structural units count or structural units properties count error.'; |
|
214 |
return null |
|
215 |
} |
|
216 |
|
|
217 |
} |
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
/** |
|
223 |
* Recurse through structural units and structural units properties of corpus and create the queries and the part names. |
|
224 |
* @param corpus the corpus or subcorpus |
|
225 |
* @param index the index for recursion |
|
226 |
* @param tmpQuery the temporary query for creating subcorpus part |
|
227 |
* @param tmpPartName the temporary part name of the subcorpus part |
|
228 |
*/ |
|
229 |
protected static void process(Corpus corpus, int index, String tmpQuery, String tmpPartName) { |
|
230 |
|
|
231 |
|
|
232 |
// End of array |
|
233 |
if(index >= STRUCTURAL_UNITS.size()) { |
|
234 |
|
|
235 |
queries.add(tmpQuery); |
|
236 |
partNames.add(PART_NAMES_PREFIX + tmpPartName); |
|
237 |
|
|
238 |
return; |
|
239 |
} |
|
240 |
|
|
241 |
StructuralUnit su = corpus.getStructuralUnit(STRUCTURAL_UNITS[index]); |
|
242 |
StructuralUnitProperty sup = su.getProperty(STRUCTURAL_UNITS_PROPERTIES[index]); |
|
243 |
|
|
244 |
// TODO : Log |
|
245 |
println '' |
|
246 |
if(index == 0) { |
|
247 |
println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on mother corpus "' + corpus.getName() + '"'; |
|
248 |
} |
|
249 |
else { |
|
250 |
println 'Pocessing Structural Unit Property "' + sup.getFullName() + '" on subcorpus part "' + tmpPartName + '"'; |
|
251 |
} |
|
252 |
println '' |
|
253 |
|
|
254 |
|
|
255 |
// Creating the queries parts for each structural units properties values |
|
256 |
//for (supValue in sup.getOrderedValues()) { // TODO : signaler bug Matthieu, on ne devrait pas être obligé de repasser le sous-corpus à la méthode car sup a déjà été créée depuis le sous-corpus ? getValues() bugge aussi |
|
257 |
for (supValue in sup.getOrderedValues(corpus)) { |
|
258 |
|
|
259 |
// TODO : Log |
|
260 |
println '' |
|
261 |
println 'Value "' + supValue + '"'; |
|
262 |
println '' |
|
263 |
|
|
264 |
|
|
265 |
// Getting the subcorpus linked to the structural unit property value |
|
266 |
Subcorpus tmpSubcorpus = corpus.createSubcorpusWithQueryString(su, sup, supValue, "tmp" + UUID.randomUUID()); |
|
267 |
|
|
268 |
// Partition conditions and part name separators |
|
269 |
String and = ''; |
|
270 |
String underscore = ''; |
|
271 |
if(tmpQuery != '') { |
|
272 |
underscore = '_'; |
|
273 |
and = ' & '; |
|
274 |
} |
|
275 |
|
|
276 |
|
|
277 |
process(tmpSubcorpus, index + 1, (tmpQuery + and + '_.' + sup.getFullName() + '="' + supValue + '"'), tmpPartName + underscore + supValue); |
|
278 |
|
|
279 |
// Deleting the temporary subcorpus |
|
280 |
// TODO : bug : cette méthode ne supprime pas le corpus sans doute car il faut que le sous-corpus ne contienne pas d'autres sous-corpus ? le delete() en revanche fonctionne. |
|
281 |
// corpus.dropSubcorpus(tmpSubcorpus); |
|
282 |
tmpSubcorpus.delete(); |
|
283 |
|
|
284 |
} |
|
285 |
} |
|
286 |
|
|
287 |
|
|
288 |
/** |
|
289 |
* Autoname the partition. |
|
290 |
* @param partitionName |
|
291 |
*/ |
|
292 |
protected static void autoNamePartition(String partitionName) { |
|
293 |
|
|
294 |
// Structural units names and properties |
|
295 |
for(int i = 0; i < STRUCTURAL_UNITS.size(); i++) { |
|
296 |
partitionName += STRUCTURAL_UNITS[i] + '_' + STRUCTURAL_UNITS_PROPERTIES[i] + '.'; |
|
297 |
} |
|
298 |
|
|
299 |
// Structural units to ignore |
|
300 |
for(int i = 0; i < STRUCTURAL_UNITS_TO_IGNORE.size(); i++) { |
|
301 |
partitionName += 'NOT_' + STRUCTURAL_UNITS_TO_IGNORE[i] + '.'; |
|
302 |
} |
|
303 |
|
|
304 |
|
|
305 |
// Removing last point in name |
|
306 |
PARTITION_NAME = partitionName.substring(0, partitionName.length() - 1); |
|
307 |
} |
|
308 |
|
|
309 |
|
|
310 |
/** |
|
311 |
* Finalize the queries. |
|
312 |
*/ |
|
313 |
protected static void finalizeQueries() { |
|
314 |
|
|
315 |
String expandTo = ''; |
|
316 |
// Expanding to user defined target |
|
317 |
if(EXPAND_TARGET != null && EXPAND_TARGET != '') { |
|
318 |
expandTo = ' expand to ' + EXPAND_TARGET; |
|
319 |
} |
|
320 |
// Expanding to last child structural unit in user defined hierarchy |
|
321 |
else if(STRUCTURAL_UNITS_TO_IGNORE.size() == 0) { |
|
322 |
expandTo = ' expand to ' + STRUCTURAL_UNITS[STRUCTURAL_UNITS.size() - 1]; |
|
323 |
} |
|
324 |
|
|
325 |
// Autonaming the partition |
|
326 |
if(PARTITION_NAME == '') { |
|
327 |
autoNamePartition(PARTITION_NAME); |
|
328 |
// Finalizing partition name |
|
329 |
PARTITION_NAME += expandTo.replace(' expand to', '.EXPAND TO').replace(' ', '_'); |
|
330 |
} |
|
331 |
|
|
332 |
|
|
333 |
// Finalizing queries |
|
334 |
for(int j = 0; j < queries.size(); j++) { |
|
335 |
|
|
336 |
String queryEnd = ''; |
|
337 |
|
|
338 |
// Removing some sections |
|
339 |
for(sectionToIgnore in STRUCTURAL_UNITS_TO_IGNORE) { |
|
340 |
queryEnd += ' & !' + sectionToIgnore; |
|
341 |
} |
|
342 |
|
|
343 |
queryEnd += ']' + expandTo; |
|
344 |
|
|
345 |
queries.set(j, '[' + queries.get(j) + queryEnd); |
|
346 |
} |
|
347 |
} |
|
348 |
|
|
349 |
} |
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
/* |
|
357 |
// Test dialogue de confirmation avant création de la partition |
|
358 |
JFrame frame = new JFrame('test'); |
|
359 |
//frame.setMinimumSize(new Dimension(400, 400)); |
|
360 |
//frame.setVisible(true); |
|
361 |
//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
362 |
int n = JOptionPane.showConfirmDialog( |
|
363 |
frame, "Would you like green eggs and ham?", |
|
364 |
"An Inane Question", |
|
365 |
JOptionPane.YES_NO_OPTION); |
|
366 |
if (n == JOptionPane.YES_OPTION) { |
|
367 |
frame.setTitle("Ewww!"); |
|
368 |
} else if (n == JOptionPane.NO_OPTION) { |
|
369 |
frame.setTitle("Me neither!"); |
|
370 |
} else { |
|
371 |
frame.setTitle("Come on -- tell me!"); |
|
372 |
}*/ |
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
377 |
|
|
378 |
//// Récupération des unités structurelles et création de la liste des requêtes CQL |
|
379 |
//int i = 0; |
|
380 |
//ArrayList<String> queries = new ArrayList<String>(); |
|
381 |
//ArrayList<String> partNames = new ArrayList<String>(); |
|
382 |
// |
|
383 |
// |
|
384 |
//int currentQueriesCount; |
|
385 |
//if(STRUCTURAL_UNITS.size() > 0 && STRUCTURAL_UNITS.size() == STRUCTURAL_UNITS_PROPERTIES.size()) { |
|
386 |
// |
|
387 |
// // Parcours des unités strcuturelles à traiter |
|
388 |
// for (suName in STRUCTURAL_UNITS) { |
|
389 |
// |
|
390 |
// // Définition auto du nom de partition |
|
391 |
// PARTITION_NAME += suName + '_'; |
|
392 |
// |
|
393 |
// |
|
394 |
// StructuralUnit su = corpus.getStructuralUnit(suName); |
|
395 |
// |
|
396 |
// |
|
397 |
// // TODO : Debug |
|
398 |
// println '' |
|
399 |
// println 'Structural Unit Name: ' + su.getName(); |
Formats disponibles : Unified diff