Revision 1973 tmp/org.txm.analec.rcp/src/org/txm/macro/urs/edit/UnitsAnnotateMacro.groovy

UnitsAnnotateMacro.groovy (revision 1973)
16 16
import org.txm.macro.urs.AnalecUtils
17 17
import org.txm.searchengine.cqp.AbstractCqiClient
18 18
import org.txm.searchengine.cqp.corpus.*
19
import org.txm.searchengine.cqp.corpus.query.CQLQuery
19 20

  
21
import visuAnalec.donnees.Corpus
20 22
import visuAnalec.donnees.Structure
21 23
import visuAnalec.elements.*
22 24
import visuAnalec.vue.Vue
......
41 43
		int minimum_schema_size
42 44
@Field @Option(name="unit_ursql", usage="TYPE@PROP=VALUE", widget="String", required=false, def="MENTION")
43 45
		String unit_ursql
46
@Field @Option(name="limit_distance_in_schema", usage="Unit distance in schema (0 = no selection, 1 = first after limit, -1 = last before limit, etc.)", widget="Integer", required=true, def="0")
47
		int limit_distance_in_schema
44 48
@Field @Option(name="limit_cql", usage="CQL to build structure limits", widget="Query", required=true, def="<div> [] expand to div")
45 49
		limit_cql
46 50
@Field @Option(name="strict_inclusion", usage="Units must be strictly included into corpus matches", widget="Boolean", required=true, def="true")
......
57 61
if (!ParametersDialog.open(this)) return
58 62
	if (debug == "OFF") debug = 0; else if (debug == "ON") debug = 1; else if (debug == "ALL") debug = 2 else if (debug == "REALLY ALL") debug = 3
59 63

  
60
def CQI = CQPSearchEngine.getCqiClient()
61

  
62 64
if (unit_property_to_set.length() == 0) {
63 65
	println "unit_property_to_set not set: aborting."
64 66
}
......
68 70
def errors = new HashSet()
69 71
for (def corpus : selection) {
70 72
	println "Annotate $corpus..."
71
	MainCorpus mainCorpus = corpus.getMainCorpus()
72 73

  
73
	def word = mainCorpus.getWordProperty()
74
	def analecCorpus = URSCorpora.getCorpus(mainCorpus.getName())
75
	Vue analecView = URSCorpora.getVue(mainCorpus.getName())
74
	def word = corpus.getWordProperty()
75
	def analecCorpus = URSCorpora.getCorpus(corpus)
76
	Vue analecView = URSCorpora.getVue(corpus)
76 77
	Structure structure = analecCorpus.getStructure()
77 78

  
78 79
	AnalecUtils.defineProperty(Unite.class, analecCorpus, unit_ursql, unit_property_to_set)
79 80
	analecView.initVueParDefaut()
80 81

  
81 82
	def selectedUnits = AnalecUtils.selectUnitsInSchema(debug, analecCorpus, corpus, schema_ursql, minimum_schema_size, Integer.MAX_VALUE,
82
			unit_ursql, limit_cql, strict_inclusion, limit_distance);
83
			unit_ursql, limit_distance_in_schema, limit_cql, strict_inclusion, limit_distance);
84
		
83 85
	println " "+selectedUnits.size()+" units to annotate..."
84 86
	def n = 0
85 87
	def nerrors = 0
......
93 95
		}
94 96
	}
95 97
	
96
	mainCorpus.setIsModified(true)
98
	corpus.getMainCorpus().setIsModified(true)
97 99
	allResults[corpus] = selectedUnits
98 100
	println " $n valeurs affectées à $corpus"
99 101
	println " $nerrors erreurs lors de l'annotation de $corpus"

Also available in: Unified diff