pairs = BIF_IO.getLinksFromFile(filename);
49 |
50 | //System.out.print(id);
51 | for (String[] pair : pairs) {
52 | Statement st = con.createStatement();
53 |
54 | logger.fine("INSERT ignore INTO " + tableName + " VALUES (\'" + id + "\', \'" + pair[1] + "\', \'" + pair[0] + "\');");
55 | st.execute("INSERT ignore INTO " + tableName + " VALUES (\'" + id + "\', \'" + pair[1] + "\', \'" + pair[0] + "\');");
56 |
57 | }
58 | }
59 | }
60 |
61 |
62 | /*
63 | *BIFImport.Import("output" + File.separator + "xml" + File.separator + id.replace("`","") + ".xml", id, "Entity_BayesNets", con2);
64 | */
--------------------------------------------------------------------------------
/obsolete/jars/Jama-1.0.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/Jama-1.0.3.jar
--------------------------------------------------------------------------------
/obsolete/jars/colt.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/colt.jar
--------------------------------------------------------------------------------
/obsolete/jars/commons-collections-3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/commons-collections-3.1.jar
--------------------------------------------------------------------------------
/obsolete/jars/commons-lang-2.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/commons-lang-2.6.jar
--------------------------------------------------------------------------------
/obsolete/jars/ibatis-common-2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/ibatis-common-2.jar
--------------------------------------------------------------------------------
/obsolete/jars/mtj.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/mtj.jar
--------------------------------------------------------------------------------
/obsolete/jars/mysql-connector-java-5.1.22-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/mysql-connector-java-5.1.22-bin.jar
--------------------------------------------------------------------------------
/obsolete/jars/unreferenced/junit.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/unreferenced/junit.jar
--------------------------------------------------------------------------------
/obsolete/jars/unreferenced/opt77.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/unreferenced/opt77.jar
--------------------------------------------------------------------------------
/obsolete/jars/unreferenced/pal-1.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/unreferenced/pal-1.4.jar
--------------------------------------------------------------------------------
/obsolete/jars/weka.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/weka.jar
--------------------------------------------------------------------------------
/obsolete/jars/xom-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/jars/xom-1.1.jar
--------------------------------------------------------------------------------
/obsolete/old-factorbase/FactorBase.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/old-factorbase/FactorBase.jar
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/config.cfg:
--------------------------------------------------------------------------------
1 | dbaddress = mysql://127.0.0.1
2 | dbusername = root
3 | dbpassword = 123456
4 | dbBNschema = unielwin_BN
5 | dbDataSchema = unielwin
6 | dbOutputSchema = unielwin_db
7 | pathBayesNet = Path_BayesNets
8 |
9 | LinkAnalysis = 1
10 |
11 | Continuous = 0
12 | Grounded = 0
13 |
14 | dbname = unielwin
15 | AutomaticSetup = 1
16 | LinkCorrelations = 1
17 | ComputeKLD = 0
18 |
19 | dbschema = unielwin_BN
20 | dbcounts = unielwin_db
21 | dbcondprob = unielwin_db
22 |
23 | UseLocal_CT = 0
24 |
25 | CrossValidation = 0
26 |
27 |
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/scripts/storedprocs.sql:
--------------------------------------------------------------------------------
1 | CREATE PROCEDURE `find_values`()
2 | BEGIN
3 | DECLARE done INT DEFAULT 0;
4 | DECLARE tablename VARCHAR(30);
5 | DECLARE columnname VARCHAR(30);
6 | DECLARE cur1 CURSOR FOR
7 | SELECT TABLE_NAME, COLUMN_NAME FROM AttributeColumns;
8 | DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
9 | OPEN cur1;
10 |
11 | DROP TABLE IF EXISTS Attribute_Value;
12 | CREATE TABLE
13 | Attribute_Value (
14 | COLUMN_NAME VARCHAR(30),
15 | VALUE VARCHAR(30));
16 |
17 | LOOP1: LOOP
18 | FETCH cur1 INTO tablename, columnname;
19 | IF done = 1 THEN
20 | LEAVE LOOP1;
21 | END IF;
22 | SET @SQLQUERY = 'INSERT INTO Attribute_Value (';
23 | SET @SQLQUERY = CONCAT(@SQLQUERY, 'SELECT distinct "', columnname);
24 | SET @SQLQUERY = CONCAT(@SQLQUERY, '", ', columnname);
25 | SET @SQLQUERY = CONCAT(@SQLQUERY, ' FROM @database@.', tablename, ')');
26 |
27 | PREPARE stmt1 FROM @SQLQUERY;
28 | EXECUTE stmt1;
29 | END LOOP LOOP1;
30 |
31 | CLOSE cur1;
32 |
33 | END
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/scripts/transfer.sql:
--------------------------------------------------------------------------------
1 | DROP SCHEMA IF EXISTS @database@_BN;
2 | create schema @database@_BN;
3 |
4 | DROP SCHEMA IF EXISTS @database@_CT;
5 | create schema @database@_CT;
6 |
7 | USE @database@_BN;
8 | SET storage_engine=INNODB;
9 |
10 |
11 | /*copy tables from setup database */
12 |
13 |
14 | create table 1Nodes as select * from @database@_setup.1Nodes;
15 | create table 2Nodes as select * from @database@_setup.2Nodes;
16 | create table RNodes as select * from @database@_setup.RNodes;
17 | create table PVariables as select * from @database@_setup.PVariables;
18 | create table EntityTables as select * from @database@_setup.EntityTables;
19 | create table AttributeColumns as select * from @database@_setup.AttributeColumns;
20 | create table TernaryRelations as select * from @database@_setup.TernaryRelations;
21 | create table RelationTables as select * from @database@_setup.RelationTables;
22 | create table NoPKeys as select * from @database@_setup.NoPKeys;
23 | create table ForeignKeyColumns as select * from @database@_setup.ForeignKeyColumns;
24 | create table ForeignKeys_pvars as select * from @database@_setup.ForeignKeys_pvars;
25 | create table InputColumns as select * from @database@_setup.InputColumns;
26 | create table Attribute_Value as select * from @database@_setup.Attribute_Value;
27 | /*
28 | create table Groundings like @database@_setup.Groundings;
29 | insert into Groundings select * from @database@_setup.Groundings;
30 | */
31 |
32 | /*
33 | create table Path_BN_nodes as select * from @database@_setup.Path_BN_nodes;
34 | create table lattice_membership as select * from @database@_setup.lattice_membership;
35 | create table lattice_set as select * from @database@_setup.lattice_set;
36 | create table Path_Aux_Edges as select * from @database@_setup.Path_Aux_Edges;
37 | create table SchemaEdges as select * from @database@_setup.SchemaEdges;
38 | */
39 |
40 |
41 |
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/unused-scripts/markov_blanket.sql:
--------------------------------------------------------------------------------
1 | /*
2 | * Author: Kurt Routley
3 | * Date: Sept 18, 2013
4 | */
5 |
6 | use @database@_BN;
7 |
8 | /*
9 | * Create Markov Blanket
10 | * For each entry in 1Nodes, 2Nodes, and RNodes, get
11 | * 1. Parents
12 | * 2. Children
13 | * 3. Children's Parents
14 | */
15 |
16 | /* Create Parents Table */
17 | drop table if exists TargetParents;
18 |
19 | create table TargetParents as
20 | select child as TargetNode, parent as TargetParent
21 | from Path_BayesNets
22 | where rchain='@largestrchain@'
23 | and ( child in ( select 1nid from 1Nodes ) or
24 | child in ( select 2nid from 2Nodes ) or
25 | child in ( select rnid from RNodes ) )
26 | and parent <> '';
27 |
28 |
29 | /* Create Children Table */
30 | drop table if exists TargetChildren;
31 |
32 | create table TargetChildren as
33 | select parent as TargetNode, child as TargetChild
34 | from Path_BayesNets
35 | where rchain='@largestrchain@'
36 | and ( parent in ( select 1nid from 1Nodes ) or
37 | parent in ( select 2nid from 2Nodes ) or
38 | parent in ( select rnid from RNodes ) )
39 | and child <> '';
40 |
41 |
42 | /* Create Children's Parents Table */
43 | drop table if exists TargetChildrensParents;
44 |
45 | create table TargetChildrensParents as
46 | select Path_BayesNets.parent as TargetNode,
47 | TargetParents.TargetParent as TargetChildParent
48 | from TargetParents, Path_BayesNets
49 | where TargetParents.TargetNode in
50 | ( select TargetChildren.TargetChild
51 | from TargetChildren
52 | where TargetChildren.TargetNode = Path_BayesNets.Parent )
53 | and TargetParents.TargetParent <> Path_BayesNets.Parent
54 | group by Path_BayesNets.parent, TargetParents.TargetParent;
55 |
56 |
57 |
58 | /* Create Markov Blanket Table */
59 | drop table if exists TargetMB;
60 |
61 | create table TargetMB as
62 | ( select TargetNode, TargetParent as TargetMBNode
63 | from TargetParents )
64 | union distinct
65 | ( select TargetNode, TargetChild as TargetMBNode
66 | from TargetChildren ) /*zqian, only use children and parent of the target node, April 8th, 2014*/
67 | union distinct
68 | ( select TargetNode, TargetChildParent as TargetMBNode
69 | from TargetChildrensParents )
70 | ORDER BY TargetNode;
71 |
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/unused-scripts/transfer2.sql:
--------------------------------------------------------------------------------
1 | DROP SCHEMA IF EXISTS @database@_BN;
2 | create schema @database@_BN;
3 |
4 | DROP SCHEMA IF EXISTS @database@_CT;
5 | create schema @database@_CT;
6 |
7 | USE @database@_BN;
8 | SET storage_engine=INNODB;
9 |
10 |
11 | /*copy tables from setup database */
12 |
13 |
14 | create table 1Nodes as select * from @database@_setup.1Nodes;
15 | create table 2Nodes as select * from @database@_setup.2Nodes;
16 | create table RNodes as select * from @database@_setup.RNodes;
17 | create table PVariables as select * from @database@_setup.PVariables;
18 | create table EntityTables as select * from @database@_setup.EntityTables;
19 | create table AttributeColumns as select * from @database@_setup.AttributeColumns;
20 | create table TernaryRelations as select * from @database@_setup.TernaryRelations;
21 | create table RelationTables as select * from @database@_setup.RelationTables;
22 | create table NoPKeys as select * from @database@_setup.NoPKeys;
23 | create table ForeignKeyColumns as select * from @database@_setup.ForeignKeyColumns;
24 | create table ForeignKeys_pvars as select * from @database@_setup.ForeignKeys_pvars;
25 | create table InputColumns as select * from @database@_setup.InputColumns;
26 | create table Attribute_Value as select * from @database@_setup.Attribute_Value;
27 | /*June 19, 2014, for testing database*/
28 | create table FNodes_pvars_UNION_RNodes_pvars as select * from @database@_setup.FNodes_pvars_UNION_RNodes_pvars ;
29 | create table Test_Node like @database@_setup.Test_Node;
30 | insert into Test_Node select * from @database@_setup.Test_Node;
31 |
32 | insert into 1Nodes
33 | SELECT
34 | CONCAT('`', COLUMN_NAME, '(', pvid, ')', '`') AS 1nid,
35 | COLUMN_NAME,
36 | pvid,
37 | index_number = 0 AS main
38 | FROM
39 | EntityTables
40 | natural join
41 | PVariables
42 | natural join
43 | FNodes_pvars_UNION_RNodes_pvars
44 | natural join
45 | Test_Node;
46 |
47 | /*June 24, 2014, prepare the primary key list for testing data*/
48 | Drop table if exists Test_1nid ;
49 | create table Test_1nid as
50 | SELECT
51 | CONCAT('`', COLUMN_NAME, '(', pvid, ')', '`') AS 1nid,
52 | COLUMN_NAME,
53 | pvid,
54 | index_number = 0 AS main
55 | FROM
56 | EntityTables
57 | natural join
58 | PVariables
59 | natural join
60 | FNodes_pvars_UNION_RNodes_pvars
61 | natural join
62 | Test_Node;
63 |
64 |
65 |
66 |
67 | /*
68 | create table lattice_mapping as select * from @databasebase@_BN.lattice_mapping;
69 | create table lattice_membership as select * from @databasebase@_BN.lattice_membership;
70 | create table lattice_rel as select * from @databasebase@_BN.lattice_rel;
71 | create table lattice_set as select * from @databasebase@_BN.lattice_set;
72 | */
73 |
74 | /*
75 | create table Path_BN_nodes as select * from @database@_setup.Path_BN_nodes;
76 | create table lattice_membership as select * from @database@_setup.lattice_membership;
77 | create table lattice_set as select * from @database@_setup.lattice_set;
78 | create table Path_Aux_Edges as select * from @database@_setup.Path_Aux_Edges;
79 | create table SchemaEdges as select * from @database@_setup.SchemaEdges;
80 | */
81 |
82 |
83 |
--------------------------------------------------------------------------------
/obsolete/old-factorbase/src/unused-scripts/transfer_to_target.sql:
--------------------------------------------------------------------------------
1 | /*
2 | * transfer_to_target.sql
3 | * - Creates @database@_target_setup schema
4 | * - Gets Markov Blanket for Functors
5 | * Author: Kurt Routley
6 | * Date: September 23, 2013
7 | */
8 |
9 | DROP SCHEMA IF EXISTS @database@_target_setup;
10 | create schema @database@_target_setup;
11 |
12 | USE @database@_target_setup;
13 | SET storage_engine=INNODB;
14 |
15 | /*copy tables from setup database */
16 | create table FNodes as select * from @database@_BN.FNodes;
17 | create table FNodes_pvars as select * from @database@_BN.FNodes_pvars;
18 | create table PVariables as select * from @database@_BN.PVariables;
19 | create table EntityTables as select * from @database@_BN.EntityTables;
20 | create table AttributeColumns as select * from @database@_BN.AttributeColumns;
21 | create table TernaryRelations as select * from @database@_BN.TernaryRelations;
22 | create table RelationTables as select * from @database@_BN.RelationTables;
23 | create table NoPKeys as select * from @database@_BN.NoPKeys;
24 | create table ForeignKeyColumns as select * from @database@_BN.ForeignKeyColumns;
25 | create table ForeignKeys_pvars as select * from @database@_BN.ForeignKeys_pvars;
26 | create table InputColumns as select * from @database@_BN.InputColumns;
27 | create table Attribute_Value as select * from @database@_BN.Attribute_Value;
28 | create table RNodes_pvars as select * from @database@_BN.RNodes_pvars;
29 |
30 |
31 | /*June 19, 2014, for testing database*/
32 | create table FNodes_pvars_UNION_RNodes_pvars as select * from @database@_BN.FNodes_pvars_UNION_RNodes_pvars ;
33 |
34 |
35 | DROP SCHEMA IF EXISTS @database@_target;
36 | create schema @database@_target;
37 |
38 |
--------------------------------------------------------------------------------
/obsolete/old-mlnexporter/MLNExporter.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/old-mlnexporter/MLNExporter.jar
--------------------------------------------------------------------------------
/obsolete/refactored/MakeSetup.java:
--------------------------------------------------------------------------------
1 | package ca.sfu.cs.factorbase.tables;
2 |
3 | /*analyze schema data to create setup database. This can be edited by the user before learning.
4 | If setup = 0, we skip this step and use the existing setup database
5 | Yan Sept 10th*/
6 |
7 |
8 | //Assumption:
9 | // No suffix or *_std refers to the original database provided to FactorBase
10 | // *_setup is the setup database
11 |
12 |
13 |
14 | import java.sql.DriverManager;
15 | import java.sql.SQLException;
16 |
17 | import ca.sfu.cs.common.Configuration.Config;
18 | import ca.sfu.cs.factorbase.util.BZScriptRunner;
19 |
20 | import com.mysql.jdbc.Connection;
21 |
22 |
23 | public class MakeSetup {
24 |
25 | static Connection con;
26 |
27 | // to be read from config.cfg.
28 | // The config.cfg file should be the working directory.
29 | static String databaseName, databaseName_setup;
30 | static String dbUsername;
31 | static String dbPassword;
32 | static String dbaddress;
33 |
34 | public static void main(String args[]) throws Exception {
35 | runMS();
36 | }
37 |
38 | public static void runMS() throws Exception {
39 | setVarsFromConfig();
40 | connectDB();
41 | //analyze schema data to create setup database. This can be edited by the user before learning.
42 | //If setup = 0, we skip this step and use the existing setup database
43 |
44 | BZScriptRunner bzsr = new BZScriptRunner(databaseName,con);
45 |
46 | bzsr.runScript(Config.SCRIPTS_DIRECTORY + "setup.sql");
47 | bzsr.createSP(Config.SCRIPTS_DIRECTORY + "storedprocs.sql");
48 | bzsr.callSP("find_values");
49 |
50 | disconnectDB();
51 | }
52 |
53 |
54 | public static void setVarsFromConfig(){
55 | Config conf = new Config();
56 | databaseName = conf.getProperty("dbname");
57 | databaseName_setup = databaseName + "_setup";
58 | dbUsername = conf.getProperty("dbusername");
59 | dbPassword = conf.getProperty("dbpassword");
60 | dbaddress = conf.getProperty("dbaddress");
61 | }
62 |
63 | public static void connectDB() throws SQLException {
64 | //open database connections to the original database
65 | String CONN_STR = "jdbc:" + dbaddress + "/" + databaseName;
66 | try {
67 | java.lang.Class.forName("com.mysql.jdbc.Driver");
68 | } catch (Exception ex) {
69 | System.err.println("Unable to load MySQL JDBC driver");
70 | }
71 | con = (Connection) DriverManager.getConnection(CONN_STR, dbUsername, dbPassword);
72 | }
73 |
74 | public static void disconnectDB() throws SQLException {
75 | con.close();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/obsolete/scripts/add_orig_rnid.sql:
--------------------------------------------------------------------------------
1 | USE @database@_BN;
2 | SET storage_engine=INNODB;
3 |
4 | UPDATE `lattice_membership`
5 | JOIN
6 | `LatticeRNodes` ON `lattice_membership`.member = `LatticeRNodes`.short_rnid
7 | SET
8 | `lattice_membership`.rnid = `LatticeRNodes`.orig_rnid
9 | WHERE
10 | `lattice_membership`.member = `LatticeRNodes`.short_rnid;
11 |
12 | UPDATE `lattice_rel`
13 | JOIN
14 | `LatticeRNodes` ON `lattice_rel`.removed = `LatticeRNodes`.short_rnid
15 | SET
16 | `lattice_rel`.orig_rnid = `LatticeRNodes`.orig_rnid
17 | WHERE
18 | `lattice_rel`.removed = `LatticeRNodes`.short_rnid;
--------------------------------------------------------------------------------
/obsolete/scripts/drop_tmpProc.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sfu-cl-lab/FactorBase/e0833fd2b30577dfa7222de86edad6b4b5deb8a5/obsolete/scripts/drop_tmpProc.sql
--------------------------------------------------------------------------------
/obsolete/scripts/markov_blanket.sql:
--------------------------------------------------------------------------------
1 | /*
2 | * Author: Kurt Routley
3 | * Date: Sept 18, 2013
4 | */
5 |
6 | use @database@_BN;
7 |
8 | /*
9 | * Create Markov Blanket
10 | * For each entry in 1Nodes, 2Nodes, and RNodes, get
11 | * 1. Parents
12 | * 2. Children
13 | * 3. Children's Parents
14 | */
15 |
16 | /* Create Parents Table */
17 | drop table if exists TargetParents;
18 |
19 | create table TargetParents as
20 | select child as TargetNode, parent as TargetParent
21 | from Path_BayesNets
22 | where rchain='@largestrchain@'
23 | and ( child in ( select 1nid from 1Nodes ) or
24 | child in ( select 2nid from 2Nodes ) or
25 | child in ( select rnid from RNodes ) )
26 | and parent <> '';
27 |
28 |
29 | /* Create Children Table */
30 | drop table if exists TargetChildren;
31 |
32 | create table TargetChildren as
33 | select parent as TargetNode, child as TargetChild
34 | from Path_BayesNets
35 | where rchain='@largestrchain@'
36 | and ( parent in ( select 1nid from 1Nodes ) or
37 | parent in ( select 2nid from 2Nodes ) or
38 | parent in ( select rnid from RNodes ) )
39 | and child <> '';
40 |
41 |
42 | /* Create Children's Parents Table */
43 | drop table if exists TargetChildrensParents;
44 |
45 | create table TargetChildrensParents as
46 | select Path_BayesNets.parent as TargetNode,
47 | TargetParents.TargetParent as TargetChildParent
48 | from TargetParents, Path_BayesNets
49 | where TargetParents.TargetNode in
50 | ( select TargetChildren.TargetChild
51 | from TargetChildren
52 | where TargetChildren.TargetNode = Path_BayesNets.Parent )
53 | and TargetParents.TargetParent <> Path_BayesNets.Parent
54 | group by Path_BayesNets.parent, TargetParents.TargetParent;
55 |
56 |
57 |
58 | /* Create Markov Blanket Table */
59 | drop table if exists TargetMB;
60 |
61 | create table TargetMB as
62 | ( select TargetNode, TargetParent as TargetMBNode
63 | from TargetParents )
64 | union distinct
65 | ( select TargetNode, TargetChild as TargetMBNode
66 | from TargetChildren ) /*zqian, only use children and parent of the target node, April 8th, 2014*/
67 | union distinct
68 | ( select TargetNode, TargetChildParent as TargetMBNode
69 | from TargetChildrensParents )
70 | ORDER BY TargetNode;
71 |
--------------------------------------------------------------------------------
/obsolete/scripts/metadata.sql:
--------------------------------------------------------------------------------
1 | /******* extracting more metadata to support learning ***/
2 | /* should be superseded */
3 |
4 | /*adding covering index to speed up the query, however hash index does not support this technique, so replace it with default index, ie. B_Tree @ zqian May 22nd*/
5 | USE @database@_BN;
6 | SET storage_engine=INNODB;
7 |
8 | /* Set up a table that contains all functor nodes of any arity, useful for Bayes net learning later. */
9 | CREATE TABLE FNodes ( /*May 10th */
10 | `Fid` varchar(199) ,
11 | `FunctorName` varchar(64) ,
12 | `Type` varchar(5) ,
13 | `main` int(11) ,
14 | PRIMARY KEY (`Fid`)
15 | );
16 |
17 | /******* make comprehensive table for all functor nodes *****/
18 |
19 | insert into FNodes
20 | SELECT
21 | 1nid AS Fid,
22 | COLUMN_NAME as FunctorName,
23 | '1Node' as Type,
24 | main
25 | FROM
26 | 1Nodes
27 | UNION SELECT
28 | 2nid AS Fid,
29 | COLUMN_NAME as FunctorName,
30 | '2Node' as Type,
31 | main
32 | FROM
33 | 2Nodes
34 | union select
35 | orig_rnid as FID,
36 | /* was rnid as FID */
37 | TABLE_NAME as FunctorName,
38 | 'Rnode' as Type,
39 | main
40 | from
41 | RNodes;
42 |
43 | /*** for each functor node, record which population variables appear in it ***/
44 | /* this should be superseded by transfer script August 16, 2017 */
45 |
46 | create table FNodes_pvars as
47 | SELECT FNodes.Fid, PVariables.pvid FROM
48 | FNodes,
49 | 2Nodes,
50 | PVariables
51 | where
52 | FNodes.Type = '2Node'
53 | and FNodes.Fid = 2Nodes.2nid
54 | and PVariables.pvid = 2Nodes.pvid1
55 | union
56 | SELECT
57 | FNodes.Fid, PVariables.pvid
58 | FROM
59 | FNodes,
60 | 2Nodes,
61 | PVariables
62 | where
63 | FNodes.Type = '2Node'
64 | and FNodes.Fid = 2Nodes.2nid
65 | and PVariables.pvid = 2Nodes.pvid2
66 | union
67 | SELECT
68 | FNodes.Fid, PVariables.pvid
69 | FROM
70 | FNodes,
71 | 1Nodes,
72 | PVariables
73 | where
74 | FNodes.Type = '1Node'
75 | and FNodes.Fid = 1Nodes.1nid
76 | and PVariables.pvid = 1Nodes.pvid;
77 |
78 |
79 | /*** for each relationship node, record which population variables appear in it.
80 | Plus metadata about those variable, e.g. the name of the id column associated with them.
81 | /* this should be superseded by transfer script August 16, 2017 */
82 | ***************/
83 |
84 | CREATE TABLE RNodes_pvars AS SELECT DISTINCT orig_rnid,
85 | pvid,
86 | PVariables.TABLE_NAME,
87 | ForeignKeyColumns.COLUMN_NAME,
88 | ForeignKeyColumns.REFERENCED_COLUMN_NAME
89 | FROM
90 | ForeignKeyColumns,
91 | RNodes,
92 | PVariables
93 | WHERE
94 | pvid1 = pvid
95 | AND ForeignKeyColumns.TABLE_NAME = RNodes.TABLE_NAME
96 | AND ForeignKeyColumns.COLUMN_NAME = RNodes.COLUMN_NAME1
97 | AND ForeignKeyColumns.REFERENCED_TABLE_NAME = PVariables.TABLE_NAME
98 | UNION
99 | SELECT DISTINCT
100 | orig_rnid,
101 | pvid,
102 | PVariables.TABLE_NAME,
103 | ForeignKeyColumns.COLUMN_NAME,
104 | ForeignKeyColumns.REFERENCED_COLUMN_NAME
105 | FROM
106 | ForeignKeyColumns,
107 | RNodes,
108 | PVariables
109 | WHERE
110 | pvid2 = pvid
111 | AND ForeignKeyColumns.TABLE_NAME = RNodes.TABLE_NAME
112 | AND ForeignKeyColumns.COLUMN_NAME = RNodes.COLUMN_NAME2
113 | AND ForeignKeyColumns.REFERENCED_TABLE_NAME = PVariables.TABLE_NAME;
114 |
--------------------------------------------------------------------------------
/obsolete/scripts/transfer2.sql:
--------------------------------------------------------------------------------
1 | DROP SCHEMA IF EXISTS @database@_BN;
2 | create schema @database@_BN;
3 |
4 | DROP SCHEMA IF EXISTS @database@_CT;
5 | create schema @database@_CT;
6 |
7 | USE @database@_BN;
8 | SET storage_engine=INNODB;
9 |
10 |
11 | /*copy tables from setup database */
12 |
13 |
14 | create table 1Nodes as select * from @database@_setup.1Nodes;
15 | create table 2Nodes as select * from @database@_setup.2Nodes;
16 | create table RNodes as select * from @database@_setup.RNodes;
17 | create table PVariables as select * from @database@_setup.PVariables;
18 | create table EntityTables as select * from @database@_setup.EntityTables;
19 | create table AttributeColumns as select * from @database@_setup.AttributeColumns;
20 | create table TernaryRelations as select * from @database@_setup.TernaryRelations;
21 | create table RelationTables as select * from @database@_setup.RelationTables;
22 | create table NoPKeys as select * from @database@_setup.NoPKeys;
23 | create table ForeignKeyColumns as select * from @database@_setup.ForeignKeyColumns;
24 | create table ForeignKeys_pvars as select * from @database@_setup.ForeignKeys_pvars;
25 | create table InputColumns as select * from @database@_setup.InputColumns;
26 | create table Attribute_Value as select * from @database@_setup.Attribute_Value;
27 | /*June 19, 2014, for testing database*/
28 | create table FNodes_pvars_UNION_RNodes_pvars as select * from @database@_setup.FNodes_pvars_UNION_RNodes_pvars ;
29 | create table Test_Node like @database@_setup.Test_Node;
30 | insert into Test_Node select * from @database@_setup.Test_Node;
31 |
32 | insert into 1Nodes
33 | SELECT
34 | CONCAT('`', COLUMN_NAME, '(', pvid, ')', '`') AS 1nid,
35 | COLUMN_NAME,
36 | pvid,
37 | index_number = 0 AS main
38 | FROM
39 | EntityTables
40 | natural join
41 | PVariables
42 | natural join
43 | FNodes_pvars_UNION_RNodes_pvars
44 | natural join
45 | Test_Node;
46 |
47 | /*June 24, 2014, prepare the primary key list for testing data*/
48 | Drop table if exists Test_1nid ;
49 | create table Test_1nid as
50 | SELECT
51 | CONCAT('`', COLUMN_NAME, '(', pvid, ')', '`') AS 1nid,
52 | COLUMN_NAME,
53 | pvid,
54 | index_number = 0 AS main
55 | FROM
56 | EntityTables
57 | natural join
58 | PVariables
59 | natural join
60 | FNodes_pvars_UNION_RNodes_pvars
61 | natural join
62 | Test_Node;
63 |
64 |
65 |
66 |
67 | /*
68 | create table lattice_mapping as select * from @databasebase@_BN.lattice_mapping;
69 | create table lattice_membership as select * from @databasebase@_BN.lattice_membership;
70 | create table lattice_rel as select * from @databasebase@_BN.lattice_rel;
71 | create table lattice_set as select * from @databasebase@_BN.lattice_set;
72 | */
73 |
74 | /*
75 | create table Path_BN_nodes as select * from @database@_setup.Path_BN_nodes;
76 | create table lattice_membership as select * from @database@_setup.lattice_membership;
77 | create table lattice_set as select * from @database@_setup.lattice_set;
78 | create table Path_Aux_Edges as select * from @database@_setup.Path_Aux_Edges;
79 | create table SchemaEdges as select * from @database@_setup.SchemaEdges;
80 | */
81 |
82 |
83 |
--------------------------------------------------------------------------------
/obsolete/scripts/transfer_to_target.sql:
--------------------------------------------------------------------------------
1 | /*
2 | * transfer_to_target.sql
3 | * - Creates @database@_target_setup schema
4 | * - Gets Markov Blanket for Functors
5 | * Author: Kurt Routley
6 | * Date: September 23, 2013
7 | */
8 |
9 | DROP SCHEMA IF EXISTS @database@_target_setup;
10 | create schema @database@_target_setup;
11 |
12 | USE @database@_target_setup;
13 | SET storage_engine=INNODB;
14 |
15 | /*copy tables from setup database */
16 | create table FNodes as select * from @database@_BN.FNodes;
17 | create table FNodes_pvars as select * from @database@_BN.FNodes_pvars;
18 | create table PVariables as select * from @database@_BN.PVariables;
19 | create table EntityTables as select * from @database@_BN.EntityTables;
20 | create table AttributeColumns as select * from @database@_BN.AttributeColumns;
21 | create table TernaryRelations as select * from @database@_setup.TernaryRelations;
22 | create table RelationTables as select * from @database@_BN.RelationTables;
23 | create table NoPKeys as select * from @database@_setup.NoPKeys;
24 | create table ForeignKeyColumns as select * from @database@_BN.ForeignKeyColumns;
25 | create table ForeignKeys_pvars as select * from @database@_BN.ForeignKeys_pvars;
26 | create table InputColumns as select * from @database@_BN.InputColumns;
27 | create table Attribute_Value as select * from @database@_BN.Attribute_Value;
28 | create table RNodes_pvars as select * from @database@_BN.RNodes_pvars;
29 |
30 |
31 | /*June 19, 2014, for testing database*/
32 | create table FNodes_pvars_UNION_RNodes_pvars as select * from @database@_BN.FNodes_pvars_UNION_RNodes_pvars ;
33 |
34 |
35 | DROP SCHEMA IF EXISTS @database@_target;
36 | create schema @database@_target;
37 |
38 |
--------------------------------------------------------------------------------
/obsolete/tetrad/data/DataFilter.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.data;
23 |
24 |
25 | /**
26 | * Interface implemented by classes whose purpose is to generate modifications
27 | * of data sets. See implementations for details.
28 | *
29 | * @author Joseph Ramsey
30 | */
31 | public interface DataFilter {
32 |
33 | /**
34 | * Interpolates the given data set, producing a data set with no missing
35 | * values.
36 | */
37 | DataSet filter(DataSet dataSet);
38 | }
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/obsolete/tetrad/data/DataModel.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.data;
23 |
24 | import edu.cmu.tetrad.util.TetradSerializable;
25 |
26 | /**
27 | * Interface implemented by classes, instantiations of which can serve as
28 | * data models in Tetrad. Data models may be named if desired; if provided,
29 | * these names will be used for display purposes.
This interface is
30 | * relatively free of methods, mainly because classes that can serve as data
31 | * models in Tetrad are diverse, including continuous and discrete data sets,
32 | * covariance and correlation matrices, graphs, and lists of other data models.
33 | * So this is primarily a taqging interface.
34 | *
35 | * @author Joseph Ramsey jdramsey@andrew.cmu.edu
36 | */
37 | public interface DataModel
38 | extends KnowledgeTransferable, VariableSource, TetradSerializable {
39 | static final long serialVersionUID = 23L;
40 |
41 | /**
42 | * Returns the name of the data model (may be null).
43 | */
44 | String getName();
45 |
46 | /**
47 | * Sets the name of the data model (may be null).
48 | */
49 | void setName(String name);
50 |
51 | /**
52 | * Renders the data model as as String.
53 | */
54 | @Override
55 | String toString();
56 | }
57 |
58 |
59 |
--------------------------------------------------------------------------------
/obsolete/tetrad/data/DiscretizationSpec.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.data;
23 |
24 | /**
25 | * Created by IntelliJ IDEA.
26 | * User: josephramsey
27 | * Date: Jul 10, 2010
28 | * Time: 4:28:50 PM
29 | * To change this template use File | Settings | File Templates.
30 | */
31 | public interface DiscretizationSpec {
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/obsolete/tetrad/data/ICovarianceMatrix.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.data;
23 |
24 | import edu.cmu.tetrad.util.TetradSerializable;
25 | import edu.cmu.tetrad.graph.Node;
26 |
27 | import java.util.List;
28 |
29 | import cern.colt.matrix.DoubleMatrix2D;
30 |
31 | /**
32 | * Created by IntelliJ IDEA.
33 | * User: jdramsey
34 | * Date: Jun 22, 2010
35 | * Time: 4:07:19 PM
36 | * To change this template use File | Settings | File Templates.
37 | */
38 | public interface ICovarianceMatrix extends DataModel, TetradSerializable {
39 | @Override
40 | List getVariables();
41 |
42 | @Override
43 | List getVariableNames();
44 |
45 | String getVariableName(int index);
46 |
47 | int getDimension();
48 |
49 | int getSampleSize();
50 |
51 | @Override
52 | String getName();
53 |
54 | @Override
55 | void setName(String name);
56 |
57 | @Override
58 | Knowledge getKnowledge();
59 |
60 | @Override
61 | void setKnowledge(Knowledge knowledge);
62 |
63 | ICovarianceMatrix getSubmatrix(int[] indices);
64 |
65 | ICovarianceMatrix getSubmatrix(List submatrixVarNames);
66 |
67 | ICovarianceMatrix getSubmatrix(String[] submatrixVarNames);
68 |
69 | double getValue(int i, int j);
70 |
71 | void setMatrix(DoubleMatrix2D matrix);
72 |
73 | void setSampleSize(int sampleSize);
74 |
75 | int getSize();
76 |
77 | DoubleMatrix2D getMatrix();
78 |
79 | void select(Node variable);
80 |
81 | void clearSelection();
82 |
83 | boolean isSelected(Node variable);
84 |
85 | List getSelectedVariableNames();
86 |
87 | @Override
88 | String toString();
89 |
90 | Node getVariable(String name);
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/obsolete/tetrad/data/VariableSource.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.data;
23 |
24 | import edu.cmu.tetrad.graph.Node;
25 | import edu.cmu.tetrad.util.TetradSerializable;
26 |
27 | import java.util.List;
28 |
29 | /**
30 | * Inteface implemented by classes, instantiations of which are associated with
31 | * lists of variables. Such lists of variables are used for a number of
32 | * purposes--creating data sets, creating graphs, comparing one data to another,
33 | * and so on.
34 | *
35 | * @author Joseph Ramsey
36 | */
37 | public interface VariableSource extends TetradSerializable {
38 | static final long serialVersionUID = 23L;
39 |
40 | /**
41 | * Returns the list of variables associated with this object.
42 | */
43 | List getVariables();
44 |
45 | /**
46 | * Returns the variable names associated with this getVariableNames.
47 | */
48 | List getVariableNames();
49 | }
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/obsolete/tetrad/graph/DirectedEdgesOnly.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.graph;
23 |
24 |
25 | /**
26 | * A graph constraint permitting only directed edges to be added to the graph.
27 | *
28 | * @author Joseph Ramsey
29 | */
30 | public final class DirectedEdgesOnly implements GraphConstraint {
31 | static final long serialVersionUID = 23L;
32 |
33 | //=============================CONSTRUCTORS===========================//
34 |
35 | public DirectedEdgesOnly() {
36 |
37 | }
38 |
39 | /**
40 | * Generates a simple exemplar of this class to test serialization.
41 | *
42 | * @see edu.cmu.TestSerialization
43 | * @see edu.cmu.tetradapp.util.TetradSerializableUtils
44 | */
45 | public static DirectedEdgesOnly serializableInstance() {
46 | return new DirectedEdgesOnly();
47 | }
48 |
49 | //=============================PUBLIC METHODS=========================//
50 |
51 |
52 | /**
53 | * Returns true iff the given edge is a directed edge.
54 | */
55 | @Override
56 | public boolean isEdgeAddable(Edge edge, Graph graph) {
57 | return Edges.isDirectedEdge(edge);
58 | }
59 |
60 | /**
61 | * Returns true;
62 | */
63 | @Override
64 | public boolean isNodeAddable(Node node, Graph graph) {
65 | return true;
66 | }
67 |
68 | /**
69 | * Returns true;
70 | */
71 | @Override
72 | public boolean isEdgeRemovable(Edge edge, Graph graph) {
73 | return true;
74 | }
75 |
76 | /**
77 | * Returns true;
78 | */
79 | @Override
80 | public boolean isNodeRemovable(Node node, Graph graph) {
81 | return true;
82 | }
83 |
84 | /**
85 | * Returns a string representation of the constraint.
86 | */
87 | @Override
88 | public String toString() {
89 | return "";
90 | }
91 | }
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/obsolete/tetrad/graph/NodePair.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.graph;
23 |
24 | /**
25 | * An unordered pair of nodes.
26 | *
27 | * @author Tyler Gibson
28 | */
29 | public class NodePair {
30 |
31 |
32 | /**
33 | * The "First" node.
34 | */
35 | private Node first;
36 |
37 |
38 | /**
39 | * The "second" node.
40 | */
41 | private Node second;
42 |
43 |
44 | public NodePair(Node first, Node second){
45 | if(first == null){
46 | throw new NullPointerException("First node must not be null.");
47 | }
48 | if(second == null){
49 | throw new NullPointerException("Second node must not be null.");
50 | }
51 | this.first = first;
52 | this.second = second;
53 | }
54 |
55 | //============================== Public methods =============================//
56 |
57 | public Node getFirst(){
58 | return this.first;
59 | }
60 |
61 | public Node getSecond(){
62 | return this.second;
63 | }
64 |
65 | @Override
66 | public int hashCode(){
67 | return this.first.hashCode() + this.second.hashCode();
68 | }
69 |
70 |
71 | @Override
72 | public boolean equals(Object o){
73 | if(o == this){
74 | return true;
75 | }
76 | if(!(o instanceof NodePair)){
77 | return false;
78 | }
79 | NodePair thatPair = (NodePair)o;
80 | if(this.first.equals(thatPair.first) && this.second.equals(thatPair.second)){
81 | return true;
82 | }
83 | return this.first.equals(thatPair.second) && this.second.equals(thatPair.first);
84 | }
85 |
86 | @Override
87 | public String toString(){
88 | return "{" + this.first + ", " + this.second + "}";
89 | }
90 |
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/obsolete/tetrad/regression/Regression.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.regression;
23 |
24 | import edu.cmu.tetrad.graph.Graph;
25 | import edu.cmu.tetrad.graph.Node;
26 |
27 | import java.util.List;
28 |
29 | /**
30 | * Implements a multiple regression model, allowing data to be specified
31 | * either as a tabular data set or as a covariance matrix plus list of means.
32 | *
33 | * @author Joseph Ramsey
34 | */
35 | public interface Regression {
36 |
37 | /**
38 | * Sets the significance level at which coefficients are judged to be
39 | * significant.
40 | * @param alpha the significance level.
41 | */
42 | void setAlpha(double alpha);
43 |
44 | /**
45 | * Returns the graph of significant regressors into the target.
46 | * @return This graph.
47 | */
48 | Graph getGraph();
49 |
50 | /**
51 | * Retresses target
on the regressors
, yielding
52 | * a regression plane.
53 | * @param target the target variable, being regressed.
54 | * @param regressors the list of variables being regressed on.
55 | * @return the regression plane.
56 | */
57 | RegressionResult regress(Node target, List regressors);
58 |
59 | /**
60 | * Retresses target
on the regressors
, yielding
61 | * a regression plane.
62 | * @param target the target variable, being regressed.
63 | * @param regressors the list of variables being regressed on.
64 | * @return the regression plane.
65 | */
66 | RegressionResult regress(Node target, Node...regressors);
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/GraphSearch.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import java.util.Map;
25 | import java.util.Set;
26 |
27 | import edu.cmu.tetrad.graph.Graph;
28 | import edu.cmu.tetrad.graph.Node;
29 |
30 | /**
31 | * Created by IntelliJ IDEA. User: jdramsey Date: Jan 27, 2006 Time: 10:15:26 AM To change this template use File |
32 | * Settings | File Templates.
33 | */
34 | public interface GraphSearch {
35 | Graph search();
36 | Graph search(Map, Double>> globalScoreHash);
37 |
38 | long getElapsedTime();
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/ImpliedOrientation.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import edu.cmu.tetrad.data.IKnowledge;
25 | import edu.cmu.tetrad.graph.Graph;
26 |
27 | /**
28 | * Adds any orientations implied by the given orientation.
29 | *
30 | * @author Joseph Ramsey
31 | */
32 | public interface ImpliedOrientation {
33 |
34 | /**
35 | * Sets knowledge.
36 | */
37 | void setKnowledge(IKnowledge knowledge);
38 |
39 | /**
40 | * Adds implied orientations.
41 | */
42 | void orientImplied(Graph graph);
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/LegalPairs.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import edu.cmu.tetrad.graph.Node;
25 |
26 | import java.util.List;
27 |
28 | /**
29 | * Determines whether nodes indexed as (n1, center, n2) form a legal pair of edges in a graph for purposes of some
30 | * algorithm that uses this information. The pair would be n1---center---n2.
31 | *
32 | * @author Joseph Ramsey
33 | */
34 | public interface LegalPairs {
35 |
36 | /**
37 | * Returns true iff x*-*y is a legal first edge for the base case.
38 | */
39 | boolean isLegalFirstEdge(Node x, Node y);
40 |
41 | /**
42 | * Returns true iff n1---center---n2 is a legal pair.
43 | */
44 | boolean isLegalPair(Node x, Node y, Node z, List c, List d);
45 | }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/LocalDiscreteScore.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import edu.cmu.tetrad.data.DataSet;
25 |
26 | /**
27 | * Created by IntelliJ IDEA. User: jdramsey Date: Jul 6, 2009 Time: 3:58:26 PM To change this template use File |
28 | * Settings | File Templates.
29 | */
30 | public interface LocalDiscreteScore {
31 | void setStructurePrior(double structurePrior);
32 |
33 | void setSamplePrior(double samplePrior);
34 |
35 | double localScore(int i, int[] parents);
36 |
37 | DataSet getDataSet();
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/LocalScoreCache.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import org.apache.commons.collections.map.MultiKeyMap;
25 |
26 | import java.util.HashSet;
27 | import java.util.Set;
28 |
29 | /**
30 | * Stores a map from (variable, parents) to score.
31 | *
32 | * @author Joseph Ramsey
33 | */
34 | public class LocalScoreCache {
35 | private MultiKeyMap map;
36 |
37 | public LocalScoreCache() {
38 | map = new MultiKeyMap();
39 | }
40 |
41 | public void add(int variable, int[] parents, double score) {
42 | Set _parents = new HashSet(parents.length);
43 |
44 | for (int parent : parents) {
45 | _parents.add(parent);
46 | }
47 |
48 | map.put(variable, _parents, score);
49 | }
50 |
51 | public double get(int variable, int[] parents) {
52 | Set _parents = new HashSet(parents.length);
53 |
54 | for (int parent : parents) {
55 | _parents.add(parent);
56 | }
57 |
58 | Double _score = (Double) map.get(variable, _parents);
59 | return _score == null ? Double.NaN : (_score);
60 | }
61 |
62 | public void clear() {
63 | map.clear();
64 | }
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/obsolete/tetrad/search/ScoredGraph.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.search;
23 |
24 | import edu.cmu.tetrad.graph.Graph;
25 | import edu.cmu.tetrad.graph.EdgeListGraph;
26 | import edu.cmu.tetrad.util.TetradSerializable;
27 |
28 | /**
29 | * Stores a graph with a score.
30 | *
31 | * @author Joseph Ramsey
32 | */
33 | public class ScoredGraph implements Comparable, TetradSerializable {
34 | static final long serialVersionUID = 23L;
35 | private Graph graph;
36 | private Double score;
37 |
38 | public ScoredGraph(Graph graph, Double score) {
39 | this.graph = graph;
40 | this.score = score;
41 | }
42 |
43 | public static ScoredGraph serializableInstance() {
44 | return new ScoredGraph(new EdgeListGraph(), 0.0);
45 | }
46 |
47 | public Graph getGraph() {
48 | return graph;
49 | }
50 |
51 | public Double getScore() {
52 | return score;
53 | }
54 |
55 | @Override
56 | public int hashCode() {
57 | return score.hashCode();
58 | }
59 |
60 | @Override
61 | public boolean equals(Object o) {
62 | ScoredGraph _scoredGraph = (ScoredGraph) o;
63 |
64 | if (!score.equals(_scoredGraph.getScore())) {
65 | return false;
66 | }
67 |
68 | if (!graph.equals(_scoredGraph.getGraph())) {
69 | return false;
70 | }
71 |
72 | return true;
73 | }
74 |
75 | @Override
76 | public int compareTo(Object o) {
77 | Double thisScore = getScore();
78 | Double otherScore = ((ScoredGraph) o).getScore();
79 | return thisScore.compareTo(otherScore);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/obsolete/tetrad/test/search/BDeuScoreTest.java:
--------------------------------------------------------------------------------
1 | package edu.cmu.tetrad.search;
2 |
3 | import static org.hamcrest.MatcherAssert.assertThat;
4 | import static org.hamcrest.Matchers.equalTo;
5 |
6 | import java.io.File;
7 | import java.net.URL;
8 | import java.sql.SQLException;
9 |
10 | import org.junit.AfterClass;
11 | import org.junit.BeforeClass;
12 | import org.junit.Test;
13 |
14 | import edu.cmu.tetrad.data.DataReader;
15 | import edu.cmu.tetrad.data.DataSet;
16 | import edu.cmu.tetrad.data.DelimiterType;
17 |
18 |
19 | /**
20 | * Tests for the file BDeuScore.java.
21 | */
22 | public class BDeuScoreTest {
23 | public static final double SAMPLE_PRIOR = 10.0000;
24 | public static final double STRUCTURE_PRIOR = 1.0000;
25 | public static final int POPULARITY = 0;
26 | public static final int TEACHINGABILITY = 1;
27 |
28 | private static DataSet dataset;
29 |
30 |
31 | @BeforeClass
32 | public static void setUpBeforeClass() throws Exception {
33 | URL url = BDeuScoreTest.class.getClassLoader().getResource("inputfiles/prof0.tsv");
34 | DataReader parser = new DataReader();
35 | parser.setDelimiter(DelimiterType.TAB);
36 | dataset = parser.parseTabular(new File(url.getFile()));
37 | }
38 |
39 | @AfterClass
40 | public static void tearDownAfterClass() throws Exception {
41 | dataset = null;
42 | }
43 |
44 | @Test
45 | public void localScore_ReturnsCorrectResults_WhenNoParents() throws SQLException {
46 | BDeuScore score = new BDeuScore(dataset, SAMPLE_PRIOR, STRUCTURE_PRIOR);
47 | Double scoreValue = score.localScore(POPULARITY, new int[] {});
48 | assertThat(scoreValue, equalTo(-4.269697449704091));
49 | }
50 |
51 | @Test
52 | public void localScore_ReturnsCorrectResults_WhenSingleParent() throws SQLException {
53 | BDeuScore score = new BDeuScore(dataset, SAMPLE_PRIOR, STRUCTURE_PRIOR);
54 | Double scoreValue = score.localScore(POPULARITY, new int[] {TEACHINGABILITY});
55 | assertThat(scoreValue, equalTo(-3.935739532045626));
56 | }
57 | }
--------------------------------------------------------------------------------
/obsolete/tetrad/util/NamingProtocol.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.util;
23 |
24 | /**
25 | * Specifies the protocol used in Tetrad for variable names. This protocol
26 | * should be used throughout Tetrad.
27 | *
28 | * @author Joseph Ramsey
29 | */
30 | public class NamingProtocol {
31 |
32 | /**
33 | * Returns true iff the given name is a legal variable name for Tetrad.
34 | *
35 | * @param name Ibid.
36 | * @return Ibid.
37 | */
38 | public static boolean isLegalName(String name) {
39 | return name.matches("[^0-9]?[^ \t]*");
40 | }
41 |
42 | /**
43 | * Returns a description of the protocol being used in Tetrad that can be
44 | * displayed to the user when they enter illegal variable names.
45 | *
46 | * @return Ibid.
47 | */
48 | public static String getProtocolDescription() {
49 | return "Names must begin with non-numeric characters and may not contain " +
50 | "\nspaces or tabs.";
51 | }
52 | }
53 |
54 |
55 |
--------------------------------------------------------------------------------
/obsolete/tetrad/util/NumberFormatUtil.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.util;
23 |
24 | import java.text.DecimalFormat;
25 | import java.text.NumberFormat;
26 | import java.util.prefs.Preferences;
27 |
28 | /**
29 | * Provides an application-wide "memory" of the number format to be used.
30 | *
31 | * @author Joseph Ramsey
32 | */
33 | public class NumberFormatUtil {
34 | private static final NumberFormatUtil INSTANCE = new NumberFormatUtil();
35 | // private NumberFormat nf = new DecimalFormat(Preferences.userRoot()
36 | // .get("numberFormat", "0.0000"));
37 | private NumberFormat nf;
38 |
39 | private NumberFormatUtil() {
40 |
41 | try {
42 | nf = new DecimalFormat(Preferences.userRoot().get("numberFormat", "0.0000"));
43 | }
44 | catch (Exception e) {
45 | nf = new DecimalFormat("0.0000");
46 | }
47 |
48 | }
49 |
50 | /**
51 | * Returns the singleton instance of this class.
52 | *
53 | * @return Ibid.
54 | */
55 | public static NumberFormatUtil getInstance() {
56 | return INSTANCE;
57 | }
58 |
59 | /**
60 | * Sets the number format, nf
.
61 | *
62 | * @param nf Ibid.
63 | * @throws NullPointerException if nf is null.
64 | */
65 | public void setNumberFormat(NumberFormat nf) {
66 | if (nf == null) {
67 | throw new NullPointerException();
68 | }
69 |
70 | this.nf = nf;
71 | }
72 |
73 | /**
74 | * Returns the stored number format.
75 | *
76 | * @return Ibid.
77 | */
78 | public NumberFormat getNumberFormat() {
79 | return nf;
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/obsolete/tetrad/util/TetradLoggerEvent.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.util;
23 |
24 | import java.util.EventObject;
25 |
26 | /**
27 | * An event associated with the TetradLoggerListener
.
28 | *
29 | * @author Tyler Gibson
30 | */
31 | public class TetradLoggerEvent extends EventObject {
32 |
33 |
34 | private final TetradLoggerConfig config;
35 |
36 |
37 | /**
38 | * Constructs the event given the source and the TetradLoggerConfig
39 | * associated with the event if there is one
40 | *
41 | * @param source - The source
42 | * @param config - The config, may be null.
43 | */
44 | public TetradLoggerEvent(Object source, TetradLoggerConfig config){
45 | super(source);
46 | this.config = config;
47 | }
48 |
49 |
50 |
51 | public TetradLoggerConfig getTetradLoggerConfig(){
52 | return this.config;
53 | }
54 |
55 |
56 |
57 |
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/obsolete/tetrad/util/TetradLoggerListener.java:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // For information as to what this class does, see the Javadoc, below. //
3 | // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, //
4 | // 2007, 2008, 2009, 2010 by Peter Spirtes, Richard Scheines, Joseph Ramsey, //
5 | // and Clark Glymour. //
6 | // //
7 | // This program is free software; you can redistribute it and/or modify //
8 | // it under the terms of the GNU General Public License as published by //
9 | // the Free Software Foundation; either version 2 of the License, or //
10 | // (at your option) any later version. //
11 | // //
12 | // This program is distributed in the hope that it will be useful, //
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
15 | // GNU General Public License for more details. //
16 | // //
17 | // You should have received a copy of the GNU General Public License //
18 | // along with this program; if not, write to the Free Software //
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
20 | ///////////////////////////////////////////////////////////////////////////////
21 |
22 | package edu.cmu.tetrad.util;
23 |
24 | /**
25 | * A listener for tetrad's logger.
26 | *
27 | * @author Tyler Gibson
28 | */
29 | public interface TetradLoggerListener {
30 |
31 |
32 | /**
33 | * Invoked whenever a logger configuration is set on the TetradLogger
and
34 | * the logger is active (i.e., logging isn't turned off etc).
35 | *
36 | * @param evt
37 | */
38 | public void configurationActived(TetradLoggerEvent evt);
39 |
40 |
41 | /**
42 | * Invoked whenever a previously set logger config is resert or set to null and
43 | * the logger is active (i.e., logging isn't turned off etc).
44 | *
45 | * @param evt
46 | */
47 | public void configurationDeactived(TetradLoggerEvent evt);
48 |
49 |
50 |
51 |
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/obsolete/unreferenced/Compute_Local_CT.java:
--------------------------------------------------------------------------------
1 | import java.sql.Connection;
2 | import java.sql.DriverManager;
3 | import java.sql.SQLException;
4 |
5 |
6 | public class Compute_Local_CT {
7 | static String databaseName;
8 | static Connection con4;
9 | static String dbUsername;
10 | static String dbPassword;
11 | static String dbaddress;
12 | static String databaseName1="PPLRuleDetectionJan23Movies";
13 | static String databaseName2="PPLRuleDetectionJan23Movies";
14 |
15 | public static void setVarsFromConfig(){
16 | Config conf = new Config();
17 | databaseName = conf.getProperty("dbname");
18 | dbUsername = conf.getProperty("dbusername");
19 | dbPassword = conf.getProperty("dbpassword");
20 | dbaddress = conf.getProperty("dbaddress");
21 | }
22 |
23 | public static void connectDB1() throws SQLException {
24 |
25 | String CONN_STR2 = "jdbc:" + dbaddress + "/" + databaseName1;
26 | try {
27 | java.lang.Class.forName("com.mysql.jdbc.Driver");
28 | } catch (Exception ex) {
29 | System.err.println("Unable to load MySQL JDBC driver");
30 | }
31 | con4 = (Connection) DriverManager.getConnection(CONN_STR2, dbUsername, dbPassword);
32 | }
33 |
34 | public static void connectDB2() throws SQLException {
35 |
36 | String CONN_STR2 = "jdbc:" + dbaddress + "/" + databaseName2;
37 | try {
38 | java.lang.Class.forName("com.mysql.jdbc.Driver");
39 | } catch (Exception ex) {
40 | System.err.println("Unable to load MySQL JDBC driver");
41 | }
42 | con4 = (Connection) DriverManager.getConnection(CONN_STR2, dbUsername, dbPassword);
43 | }
44 |
45 | /*
46 | public static void KeepTablesOnly(Connection con,String dbname,String tablename) throws SQLException {
47 | //drop temporary CT tables
48 | //1.0 keep one table
49 | String CONN_tmp = "jdbc:" + dbaddress + "/" + dbname;
50 | try {
51 | java.lang.Class.forName("com.mysql.jdbc.Driver");
52 | } catch (Exception ex) {
53 | System.err.println("Unable to load MySQL JDBC driver");
54 | }
55 |
56 | con = (Connection) DriverManager.getConnection(CONN_tmp, dbUsername, dbPassword);
57 | Statement st = con.createStatement();
58 |
59 | //select the delete tablenames,return a strinng
60 | st.execute("select concat('drop table ',table_name,';') as result FROM information_schema.tables where table_schema = " +dbname+ " and table_name != " +tablename+ ";" );
61 |
62 | Statement tmp = con.createStatement();
63 | for(int i = 0; i< result.length();i++){
64 | system.out.print(result[i]+"\n");
65 | //tmp.execute(result[i]);
66 | }
67 |
68 |
69 | }*/
70 |
71 | }
72 |
73 |
74 |
--------------------------------------------------------------------------------
/obsolete/unreferenced/RelationalClassification.java:
--------------------------------------------------------------------------------
1 | //package relationalClassification;
2 |
3 | import com.mysql.jdbc.Connection;
4 | import java.sql.DriverManager;
5 | import java.sql.SQLException;
6 |
7 | public class RelationalClassification {
8 |
9 | private static Connection con_std;
10 | private static Connection con_BN;
11 | private static Connection con_CT;
12 | private static Connection con_setup;
13 | private static String databaseName_std;
14 | private static String databaseName_BN;
15 | private static String databaseName_CT;
16 | private static String databaseName_setup;
17 | private static String dbbase;
18 | private static String dbUsername;
19 | private static String dbPassword;
20 | private static String dbaddress;
21 | private static String linkCorrelation;
22 | private static String continuous;
23 | private static String functorid;
24 |
25 | public static void main(String args[]) throws Exception {
26 |
27 | //computeRelationalClassification();
28 | computeGroundedCT();
29 | }
30 |
31 | public static void computeGroundedCT() throws Exception{
32 | setVarsFromConfig();
33 | System.out.println("Set variables");
34 |
35 | con_std = connectDB(databaseName_std);
36 | con_setup = connectDB(databaseName_setup);
37 | con_BN = connectDB(databaseName_BN);
38 | con_CT = connectDB(databaseName_CT);
39 | System.out.println("DBs connected");
40 |
41 | //create a new setup copy corresponding to Markov Chain of the targetNode
42 |
43 | BayesBaseCT_SortMerge.buildCT(con_std, con_setup, con_BN, con_CT, databaseName_std, linkCorrelation, continuous);
44 | }
45 |
46 | /**
47 | * Connects to database via MySQL JDBC driver
48 | * @throws SQLException
49 | */
50 | public static void setVarsFromConfig(){
51 | Config conf = new Config();
52 | databaseName_std = conf.getProperty("dbname");
53 | //dbbase = conf.getProperty("dbbase");
54 | databaseName_BN = databaseName_std + "_BN";
55 | databaseName_CT = databaseName_std + "_CT";
56 | databaseName_setup = databaseName_std + "_setup";
57 | dbUsername = conf.getProperty("dbusername");
58 | dbPassword = conf.getProperty("dbpassword");
59 | dbaddress = conf.getProperty("dbaddress");
60 | linkCorrelation = conf.getProperty("LinkCorrelations");
61 | continuous = conf.getProperty("Continuous");
62 | //ToDo: Move to separate config??
63 | //functorid = conf.getProperty("functorid");
64 | }
65 |
66 | public static Connection connectDB(String database) throws Exception{
67 |
68 | String CONN_STR= "jdbc:" + dbaddress + "/" + database;
69 | try {
70 | java.lang.Class.forName("com.mysql.jdbc.Driver");
71 | } catch (Exception ex) {
72 | System.err.println("Unable to load MySQL JDBC driver");
73 | }
74 | try{
75 |
76 | return ((Connection) DriverManager.getConnection(CONN_STR, dbUsername, dbPassword));
77 |
78 | }
79 | catch(Exception e){
80 | System.out.println("Could not conenct to the Database " + database);
81 | }
82 | return null;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/obsolete/unreferenced/callLocal_CT.java:
--------------------------------------------------------------------------------
1 | import java.sql.DriverManager;
2 | import java.sql.ResultSet;
3 | import java.sql.SQLException;
4 | import java.sql.Statement;
5 | import java.util.ArrayList;
6 |
7 | import com.mysql.jdbc.Connection;
8 | public class callLocal_CT {
9 | static String dbUsername;
10 | static String dbPassword;
11 | static String dbaddress;
12 | static String CT_databaseName = "unielwin_copy_CT";
13 | static String PB_databaseName = "unielwin_copy_BN";
14 | static String output_databaseName = "unielwin_db";
15 | static Connection con_CT;
16 | static Connection con_PB;
17 | static Connection con_output;
18 |
19 | static int maxNumberOfMembers = 0;
20 | public static void main(String[] args) throws Exception {
21 | setVarsFromConfig();
22 | connectDB();
23 | //Statement initst = con4.createStatement();
24 | Local_CT test = new Local_CT(CT_databaseName,PB_databaseName,output_databaseName ,con_CT,con_PB,con_output);
25 | test.big_CT_table="`a,b_CT`";
26 | //test.Rchain="`a`";
27 | Statement st_PB = con_PB.createStatement();
28 | ResultSet rs_chain = st_PB.executeQuery("select distinct rchain from RChain_pvars;");
29 | ArrayList chainlist = new ArrayList();
30 | while(rs_chain.next()){
31 | System.out.println("hasparent node: " + rs_chain.getString(1));
32 | chainlist.add(rs_chain.getString(1));
33 | }
34 | int size_chain = chainlist.size();
35 | for(int i = 0; i parlist = new ArrayList();
40 |
41 | while(rs_par.next()){
42 | System.out.println("hasparent node: " + rs_par.getString(1));
43 | parlist.add(rs_par.getString(1));
44 | }
45 | int size_par = parlist.size();
46 | for(int j = 0; j$output
41 |
42 | any_failure=0
43 |
44 | for database in "${name}_BN" "${name}_CT" "${name}_setup"
45 | do
46 | extractionFailed=0
47 | echo "Now extracting tables in database: $database..."
48 |
49 | tables=$($mysqlCommand "use $database; show tables;" | tail -n +2)
50 |
51 | if [[ $? -ne 0 ]]
52 | then
53 | extractionFailed=1
54 | any_failure=1
55 | fi
56 |
57 | for table in $tables
58 | do
59 | if [[ $table == "CallLogs" ]]
60 | then
61 | continue
62 | fi
63 |
64 | echo " Extracting table: $table"
65 | echo "Table: $table" >> $output
66 | $mysqlCommand "use $database; select * from \`$table\`;" | sort -f >> $output
67 | if [[ $? -ne 0 ]]
68 | then
69 | extractionFailed=1
70 | any_failure=1
71 | fi
72 | done
73 |
74 | if [[ $extractionFailed -eq 0 ]]
75 | then
76 | echo -e "\n ${GREEN}Extraction Complete!${CLEAR}\n"
77 | else
78 | echo -e "\n ${RED}Extraction Failed!${CLEAR}\n"
79 | fi
80 | done
81 |
82 | if [[ $any_failure -eq 1 ]]
83 | then
84 | echo -e "${RED}Failed to extract data!${CLEAR}"
85 | exit 1
86 | else
87 | echo -e " ${GREEN}ALL GOOD!${CLEAR}\n"
88 | echo -e " The extracted data can be found in $output.\n"
89 | fi
--------------------------------------------------------------------------------
/travis-resources/unielwin_RA.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS `unielwin` /*!40100 DEFAULT CHARACTER SET latin1 */;
2 | USE `unielwin`;
3 | -- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
4 | --
5 | -- Host: kripke.cs.sfu.ca Database: unielwin
6 | -- ------------------------------------------------------
7 | -- Server version 5.0.95
8 |
9 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12 | /*!40101 SET NAMES utf8 */;
13 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14 | /*!40103 SET TIME_ZONE='+00:00' */;
15 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 |
20 | --
21 | -- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
22 | --
23 |
24 | --
25 | -- Table structure for table `RA`
26 | --
27 |
28 | DROP TABLE IF EXISTS `RA`;
29 | /*!40101 SET @saved_cs_client = @@character_set_client */;
30 | /*!40101 SET character_set_client = utf8 */;
31 | CREATE TABLE `RA` (
32 | `capability` varchar(45) default NULL,
33 | `prof_id` int(11) NOT NULL default '0',
34 | `student_id` int(11) NOT NULL default '0',
35 | `salary` varchar(45) default NULL,
36 | PRIMARY KEY (`prof_id`,`student_id`),
37 | KEY `FK_u2base_1` (`student_id`),
38 | KEY `FK_u2base_2` (`prof_id`),
39 | KEY `RA_capability` USING HASH (`capability`),
40 | KEY `RA_salary` USING HASH (`salary`),
41 | CONSTRAINT `FK_RA_1` FOREIGN KEY (`student_id`) REFERENCES `student` (`student_id`) ON DELETE CASCADE ON UPDATE CASCADE,
42 | CONSTRAINT `FK_RA_2` FOREIGN KEY (`prof_id`) REFERENCES `prof` (`prof_id`) ON DELETE CASCADE ON UPDATE CASCADE
43 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
44 | /*!40101 SET character_set_client = @saved_cs_client */;
45 |
46 | --
47 | -- Dumping data for table `RA`
48 | --
49 |
50 | LOCK TABLES `RA` WRITE;
51 | /*!40000 ALTER TABLE `RA` DISABLE KEYS */;
52 | INSERT INTO `RA` VALUES ('3',4,17,'med'),('1',5,5,'low'),('2',5,14,'low'),('3',5,18,'high'),('4',5,26,'high'),('3',5,27,'med'),('3',5,28,'med'),('2',6,5,'low'),('4',6,8,'high'),('4',6,9,'high'),('1',6,15,'med'),('2',6,16,'med'),('5',6,23,'high'),('5',6,24,'high'),('5',6,25,'high'),('4',7,7,'high'),('4',7,8,'high'),('1',7,11,'med'),('5',7,19,'high'),('1',7,20,'low'),('3',7,22,'med'),('1',8,12,'med'),('2',8,13,'med'),('3',8,21,'low'),('3',9,10,'high');
53 | /*!40000 ALTER TABLE `RA` ENABLE KEYS */;
54 | UNLOCK TABLES;
55 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
56 |
57 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
58 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
59 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
60 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
61 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
62 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
63 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
64 |
65 | -- Dump completed on 2013-08-29 15:40:01
66 |
--------------------------------------------------------------------------------
/travis-resources/unielwin_course.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS `unielwin` /*!40100 DEFAULT CHARACTER SET latin1 */;
2 | USE `unielwin`;
3 | -- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
4 | --
5 | -- Host: kripke.cs.sfu.ca Database: unielwin
6 | -- ------------------------------------------------------
7 | -- Server version 5.0.95
8 |
9 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12 | /*!40101 SET NAMES utf8 */;
13 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14 | /*!40103 SET TIME_ZONE='+00:00' */;
15 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 |
20 | --
21 | -- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
22 | --
23 |
24 | --
25 | -- Table structure for table `course`
26 | --
27 |
28 | DROP TABLE IF EXISTS `course`;
29 | /*!40101 SET @saved_cs_client = @@character_set_client */;
30 | /*!40101 SET character_set_client = utf8 */;
31 | CREATE TABLE `course` (
32 | `course_id` int(11) NOT NULL,
33 | `rating` varchar(45) default NULL,
34 | `diff` varchar(45) default NULL,
35 | PRIMARY KEY (`course_id`),
36 | KEY `course_rating` USING HASH (`rating`),
37 | KEY `course_diff` USING HASH (`diff`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `course`
43 | --
44 |
45 | LOCK TABLES `course` WRITE;
46 | /*!40000 ALTER TABLE `course` DISABLE KEYS */;
47 | INSERT INTO `course` VALUES (4,'2','1'),(5,'2','2'),(6,'2','1'),(7,'2','2'),(8,'2','1'),(9,'2','2'),(10,'2','1'),(11,'1','2'),(12,'1','1'),(13,'1','2');
48 | /*!40000 ALTER TABLE `course` ENABLE KEYS */;
49 | UNLOCK TABLES;
50 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
51 |
52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
55 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
56 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
57 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
58 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
59 |
60 | -- Dump completed on 2013-08-29 15:40:01
61 |
--------------------------------------------------------------------------------
/travis-resources/unielwin_prof.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS `unielwin` /*!40100 DEFAULT CHARACTER SET latin1 */;
2 | USE `unielwin`;
3 | -- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
4 | --
5 | -- Host: kripke.cs.sfu.ca Database: unielwin
6 | -- ------------------------------------------------------
7 | -- Server version 5.0.95
8 |
9 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12 | /*!40101 SET NAMES utf8 */;
13 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14 | /*!40103 SET TIME_ZONE='+00:00' */;
15 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 |
20 | --
21 | -- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
22 | --
23 |
24 | --
25 | -- Table structure for table `prof`
26 | --
27 |
28 | DROP TABLE IF EXISTS `prof`;
29 | /*!40101 SET @saved_cs_client = @@character_set_client */;
30 | /*!40101 SET character_set_client = utf8 */;
31 | CREATE TABLE `prof` (
32 | `prof_id` int(11) NOT NULL default '0',
33 | `popularity` varchar(45) default NULL,
34 | `teachingability` varchar(45) default NULL,
35 | PRIMARY KEY (`prof_id`),
36 | KEY `prof_popularity` USING HASH (`popularity`),
37 | KEY `prof_teachingability` USING HASH (`teachingability`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `prof`
43 | --
44 |
45 | LOCK TABLES `prof` WRITE;
46 | /*!40000 ALTER TABLE `prof` DISABLE KEYS */;
47 | INSERT INTO `prof` VALUES (4,'2','3'),(5,'2','3'),(6,'2','3'),(7,'2','2'),(8,'1','2'),(9,'1','2');
48 | /*!40000 ALTER TABLE `prof` ENABLE KEYS */;
49 | UNLOCK TABLES;
50 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
51 |
52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
55 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
56 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
57 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
58 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
59 |
60 | -- Dump completed on 2013-08-29 15:40:01
61 |
--------------------------------------------------------------------------------
/travis-resources/unielwin_student.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS `unielwin` /*!40100 DEFAULT CHARACTER SET latin1 */;
2 | USE `unielwin`;
3 | -- MySQL dump 10.13 Distrib 5.1.69, for redhat-linux-gnu (x86_64)
4 | --
5 | -- Host: kripke.cs.sfu.ca Database: unielwin
6 | -- ------------------------------------------------------
7 | -- Server version 5.0.95
8 |
9 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12 | /*!40101 SET NAMES utf8 */;
13 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14 | /*!40103 SET TIME_ZONE='+00:00' */;
15 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 |
20 | --
21 | -- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
22 | --
23 |
24 | --
25 | -- Table structure for table `student`
26 | --
27 |
28 | DROP TABLE IF EXISTS `student`;
29 | /*!40101 SET @saved_cs_client = @@character_set_client */;
30 | /*!40101 SET character_set_client = utf8 */;
31 | CREATE TABLE `student` (
32 | `student_id` int(11) NOT NULL default '0',
33 | `intelligence` varchar(45) default NULL,
34 | `ranking` varchar(45) default NULL,
35 | PRIMARY KEY (`student_id`),
36 | KEY `student_intelligence` USING HASH (`intelligence`),
37 | KEY `student_ranking` USING HASH (`ranking`)
38 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `student`
43 | --
44 |
45 | LOCK TABLES `student` WRITE;
46 | /*!40000 ALTER TABLE `student` DISABLE KEYS */;
47 | INSERT INTO `student` VALUES (4,'3','1'),(5,'3','1'),(6,'3','2'),(7,'3','1'),(8,'3','1'),(9,'3','2'),(10,'3','1'),(11,'3','2'),(12,'2','2'),(13,'2','2'),(14,'2','2'),(15,'2','3'),(16,'2','3'),(17,'2','3'),(18,'2','3'),(19,'2','3'),(20,'2','3'),(21,'2','2'),(22,'2','4'),(23,'2','3'),(24,'2','2'),(25,'1','4'),(26,'1','4'),(27,'1','4'),(28,'1','4'),(29,'1','5'),(30,'1','5'),(31,'1','5'),(32,'1','5'),(33,'1','5'),(34,'1','4'),(35,'1','4'),(36,'1','5'),(37,'1','5'),(38,'1','5'),(39,'3','1'),(40,'3','1'),(41,'3','1');
48 | /*!40000 ALTER TABLE `student` ENABLE KEYS */;
49 | UNLOCK TABLES;
50 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
51 |
52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
55 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
56 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
57 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
58 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
59 |
60 | -- Dump completed on 2013-08-29 15:40:01
61 |
--------------------------------------------------------------------------------