Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / scripts / TxmToHSQL.groovy @ 479

History | View | Annotate | Download (2 kB)

1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun. 06 mai 2013) $
25
// $LastChangedRevision: 2386 $
26
// $LastChangedBy: mdecorde $ 
27
//
28
package org.txm.scripts;
29

    
30
import org.txm.lexicon.core.corpusengine.cqp.Lexicon
31
import org.txm.searchengine.cqp.corpus.Corpus;
32
import org.txm.searchengine.cqp.corpus.Property;
33
import org.txm.searchengine.cqp.corpus.CorpusManager;
34
// TODO: Auto-generated Javadoc
35

    
36
/**
37
 * temporary class.
38
 *
39
 * @author mdecorde
40
 */
41
class TxmToSQL 
42
{
43
        
44
        /**
45
         * Lexicon to sql.
46
         *
47
         * @param corpus the corpus
48
         * @param lexproperties the lexproperties
49
         * @return the string
50
         */
51
        static String LexiconToSQL(Corpus corpus, Property lexproperties)
52
        {
53
                
54
                Lexicon lex = corpus.getLexicon(lexproperties);
55
                
56
                String[] forms = lex.getForms();
57
                
58
                HSQLFunctions.CreateSimpleTable(lex.getName(),"form","VARCHAR(50)",forms)
59
                return lex.getName();
60
        }
61
        
62
        /**
63
         * Main.
64
         *
65
         * @param args the args
66
         */
67
        static main(args) 
68
        {
69
                //lexicon example
70
                CorpusManager cm = CorpusManager.getCorpusManager();
71
                Corpus corpus = cm.getCorpus("RGAQCJ");
72
                Property p = corpus.getProperty("word");
73
                
74
                String table = TxmToSQL.LexiconToSQL(corpus,p);
75
                HSQLFunctions.printTable(table);
76
        }
77
}