EMMA Coverage Report (generated Sat Aug 20 11:00:51 CDT 2011)
[all classes][felix.io]

COVERAGE SUMMARY FOR SOURCE FILE [IDNormalizor.java]

nameclass, %method, %block, %line, %
IDNormalizor.java0%   (0/1)0%   (0/2)0%   (0/84)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IDNormalizor0%   (0/1)0%   (0/2)0%   (0/84)0%   (0/21)
IDNormalizor (): void 0%   (0/1)0%   (0/3)0%   (0/1)
loadFromDBTable (String, String, FelixPredicate, FelixQuery): void 0%   (0/1)0%   (0/81)0%   (0/20)

1package felix.io;
2 
3import java.sql.ResultSet;
4import java.sql.SQLException;
5import java.util.ArrayList;
6 
7import org.antlr.runtime.Token;
8 
9import felix.dstruct.FelixPredicate;
10import felix.dstruct.FelixQuery;
11 
12import tuffy.db.RDB;
13import tuffy.mln.Atom;
14import tuffy.mln.Type;
15 
16/**
17 * Class for normalizing ids of a database table.
18 * 
19 * @deprecated
20 * 
21 * @author Ce Zhang
22 *
23 */
24public class IDNormalizor {
25 
26        /**
27         * Normalizes ids of given schema.table.
28         * @param schema
29         * @param table
30         * @param p
31         * @param fq
32         */
33        public static void loadFromDBTable(String schema, String table, FelixPredicate p, FelixQuery fq){
34                
35                RDB db = RDB.getRDBbyConfig(schema);
36                String sql = "SELECT * FROM " + table;
37                db.disableAutoCommitForNow();
38                
39                ResultSet rs = db.query(sql);
40                try {
41                        while(rs.next()){
42//                                System.out.println(rs.getString(1));
43                                ArrayList<String> args = new ArrayList<String>();
44                                for(int i=0; i<p.arity(); i++){
45                                          Type type = p.getTypeAt(i);
46                                      String s;
47                                                s = rs.getString(i+1);
48                                      if(type.isNonSymbolicType()){
49                                        args.add(s);
50                                      }else{
51                                  Integer cid = fq.getSymbolID(s,type);
52                                               args.add(Integer.toString(cid));
53                                            }
54                            }
55                                  Atom gp = null;
56                                  //TODO: SOFT & TRUTH
57//                        if(pr == null) {
58                                    gp = new Atom(args, true);
59 //                       }else{
60 //                         gp = new Atom(args, pr);
61 //                       }
62                            p.addEvidence(gp);
63                                
64                                
65                        }
66                } catch (SQLException e) {
67                        // TODO Auto-generated catch block
68                        e.printStackTrace();
69                }
70                
71                db.close();
72        }
73        
74}

[all classes][felix.io]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov