Statistics
| Revision:

root / tmp / org.txm.analec.rcp / src / org / txm / macro / urs / DemoMacro.groovy @ 2143

History | View | Annotate | Download (1.3 kB)

1
package org.txm.macro.urs
2

    
3
import org.txm.annotation.urs.URSCorpora
4
import org.txm.searchengine.cqp.corpus.CQPCorpus
5

    
6
// get the CQP corpus
7
if (!(corpusViewSelection instanceof CQPCorpus)) {
8
        println "Corpus view selection is no a corpus: $corpusViewSelection"
9
        return false;
10
}
11
def corpus = corpusViewSelection
12

    
13
// get the Analec corpus
14
def analecCorpus = URSCorpora.getCorpus(corpus)
15

    
16
// get the annotations structure
17
def structure = analecCorpus.getStructure()
18

    
19
// get the annotations view
20
def view = URSCorpora.getVue(corpus)
21

    
22
// get annotations
23

    
24
        // Units
25
        println "Units:"
26
        for (String type : structure.getUnites()) {
27
                def units = analecCorpus.getUnites(type)
28
                if (units.size() > 0) {
29
                        println "        ${units.size()} $type"
30
                }
31
        }
32
        
33
        // Relations
34
        println "Relations:"
35
        for (String type : structure.getRelations()) {
36
                def relations = analecCorpus.getRelations(type)
37
                if (relations.size() > 0) {
38
                        println "        ${relations.size()} $type"
39
                }
40
        }
41
        
42
        // Schemas
43
        println "Schemas:"
44
        for (String type : structure.getSchemas()) {
45
                def schemas = analecCorpus.getSchemas(type)
46
                if (schemas.size() > 0) {
47
                        println "        ${schemas.size()} $type"
48
                }
49
        }
50
        
51
        // Create annotations
52
        
53
        // Edit annotations
54

    
55
        // Delete annotations
56
        
57
        // Revert changes
58
        
59
        // Save changes
60
        URSCorpora.getView(corpus)