From: <jen...@us...> - 2009-11-11 21:04:38
|
Revision: 1910 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1910&view=rev Author: jenslehmann Date: 2009-11-11 21:04:26 +0000 (Wed, 11 Nov 2009) Log Message: ----------- PostgreSQL ms2ph to OWL conversion implemented Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java Added Paths: ----------- trunk/lib/db/ trunk/lib/db/postgresql-8.4-701.jdbc4.jar Removed Paths: ------------- trunk/lib/mysql/ Added: trunk/lib/db/postgresql-8.4-701.jdbc4.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/db/postgresql-8.4-701.jdbc4.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java 2009-11-05 09:06:10 UTC (rev 1909) +++ trunk/src/dl-learner/org/dllearner/examples/MonogenicDiseases.java 2009-11-11 21:04:26 UTC (rev 1910) @@ -62,7 +62,7 @@ // whether to generate a class containing the positive examples private static boolean generatePosExampleClass = true; // set to true if accessing PostreSQL and false for MySQL - private static boolean pgSQL = false; + private static boolean pgSQL = true; public static void main(String[] args) throws ClassNotFoundException, BackingStoreException, SQLException { @@ -79,7 +79,8 @@ String url = "jdbc:"; if(pgSQL) { Class.forName("org.postgresql.Driver"); - url += "postgresql://"+dbServer+":5432/"+dbName; + // adapt the port if necessary + url += "postgresql://"+dbServer+":5433/"+dbName; } else { Class.forName("com.mysql.jdbc.Driver"); url += "mysql://"+dbServer+":3306/"+dbName; @@ -234,7 +235,13 @@ // select data (restricted to pos/neg examples for efficiency) Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE (gain_contact is not null) && (gain_contact != 0)"); + ResultSet rs = null; + if(pgSQL) { + // join tables + rs = stmt.executeQuery("SELECT * FROM fiche_mutant, mutants WHERE fiche_mutant.id = mutants.id AND(gain_contact is not null)"); + } else { + rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE (gain_contact is not null) AND (gain_contact != 0)"); + } int count = 0; while(rs.next()) { @@ -375,8 +382,13 @@ // selecting examples // -> only a fraction of examples are selected as positive/negative - rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE " //lower(phenotype) not like 'polymorphism' AND " - + " (gain_contact is not null) && (gain_contact != 0)"); + if(pgSQL) { + rs = stmt.executeQuery("SELECT * FROM fiche_mutant, mutants WHERE fiche_mutant.id=mutants.id AND " //lower(phenotype) not like 'polymorphism' AND " + + " (gain_contact is not null) AND (gain_contact != 0)"); + } else { + rs = stmt.executeQuery("SELECT * FROM " + table + " WHERE " //lower(phenotype) not like 'polymorphism' AND " + + " (gain_contact is not null) AND (gain_contact != 0)"); + } List<Individual> posExamples = new LinkedList<Individual>(); List<Individual> negExamples = new LinkedList<Individual>(); while(rs.next()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |