|
1 |
// STANDARD DECLARATIONS
|
|
2 |
package org.txm.macro.urs.edit
|
|
3 |
|
|
4 |
import org.kohsuke.args4j.*
|
|
5 |
import groovy.transform.Field
|
|
6 |
import org.txm.rcp.swt.widget.parameters.*
|
|
7 |
import org.txm.annotation.urs.*
|
|
8 |
import org.txm.searchengine.cqp.corpus.*
|
|
9 |
import visuAnalec.elements.*
|
|
10 |
|
|
11 |
if (!(corpusViewSelection instanceof CQPCorpus)) {
|
|
12 |
println "Corpora selection is not a Corpus"
|
|
13 |
return;
|
|
14 |
}
|
|
15 |
|
|
16 |
def corpus = corpusViewSelection
|
|
17 |
if (!URSCorpora.isAnnotationStructureReady(corpus)) {
|
|
18 |
println "** URS Annotation Structure of "+corpusViewSelection+" is not ready. Aborting."
|
|
19 |
return
|
|
20 |
}
|
|
21 |
|
|
22 |
@Field @Option(name="CONFIRMATION", usage="select to confirm the annotations reset", widget="Boolean", required=false, def="false")
|
|
23 |
def CONFIRMATION
|
|
24 |
|
|
25 |
// Open the parameters input dialog box
|
|
26 |
if (!ParametersDialog.open(this)) return;
|
|
27 |
|
|
28 |
if (!CONFIRMATION) {
|
|
29 |
println "Aborting: CONFIRMATION was no checked."
|
|
30 |
return;
|
|
31 |
}
|
|
32 |
|
|
33 |
def analecCorpus = URSCorpora.getCorpus(corpus);
|
|
34 |
//def structure = analecCorpus.getStructure()
|
|
35 |
def vue = URSCorpora.getVue(corpus)
|
|
36 |
|
|
37 |
/*
|
|
38 |
Class[] classes = [Unite.class, Relation.class, Schema.class]
|
|
39 |
println "Removing unites..."
|
|
40 |
for (String type : vue.getTypes(Unite.class)) {
|
|
41 |
for (Unite unite : analecCorpus.getUnites(type).toArray(new Unite[0])) {
|
|
42 |
analecCorpus.supUnite(unite)
|
|
43 |
}
|
|
44 |
}
|
|
45 |
|
|
46 |
println "Removing relations..."
|
|
47 |
for (String type : vue.getTypes(Relation.class)) {
|
|
48 |
for (Relation relation : analecCorpus.getRelations(type).toArray(new Relation[0])) {
|
|
49 |
analecCorpus.supRelation(relation)
|
|
50 |
}
|
|
51 |
}
|
|
52 |
|
|
53 |
println "Removing schemas..."
|
|
54 |
for (String type : vue.getTypes(Schema.class)) {
|
|
55 |
for (Schema schema : analecCorpus.getSchemas(type).toArray(new Schema[0])) {
|
|
56 |
analecCorpus.supSchema(schema)
|
|
57 |
}
|
|
58 |
}
|
|
59 |
*/
|
|
60 |
|
|
61 |
vue.retablirVueParDefaut();
|
|
62 |
|
|
63 |
println "Done. Save the corpus to finish the annotations reset."
|
|
64 |
|