Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseFeatureStore.java |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | import de.brightbyte.data.MapLabeledVector; |
14 | 14 | import de.brightbyte.data.cursor.DataSet; |
15 | 15 | import de.brightbyte.db.DatabaseDataSet; |
| 16 | +import de.brightbyte.db.DatabaseTable; |
16 | 17 | import de.brightbyte.db.DatabaseUtil; |
17 | 18 | import de.brightbyte.db.EntityTable; |
18 | 19 | import de.brightbyte.db.QueryDataSet; |
— | — | @@ -236,8 +237,8 @@ |
237 | 238 | @Override |
238 | 239 | public Cursor<ConceptFeatures<T, Integer>> cursor() throws PersistenceException { |
239 | 240 | try { |
240 | | - String n = database.createTemporaryTable("id integer not null, name varchar(255) default null, primary key (id)"); |
241 | | - String sql = "INSERT IGNORE INTO "+n+" (id) "; |
| 241 | + DatabaseTable tmp = database.createTemporaryTable("id integer not null, name varchar(255) default null, primary key (id)"); |
| 242 | + String sql = "INSERT IGNORE INTO "+tmp.getSQLName()+" (id) "; |
242 | 243 | sql += " SELECT N.feature as id "; |
243 | 244 | sql += " FROM "+featureTable.getSQLName()+" AS F "; |
244 | 245 | sql += " JOIN "+featureTable.getSQLName()+" AS N ON F.feature = N.concept "; |
— | — | @@ -245,18 +246,18 @@ |
246 | 247 | |
247 | 248 | database.executeUpdate("getNeighbourhoodFeatures#neighbours", sql); |
248 | 249 | |
249 | | - sql = "UPDATE "+n+" as N "; |
| 250 | + sql = "UPDATE "+tmp.getSQLName()+" as N "; |
250 | 251 | sql+= " JOIN "+conceptTable.getSQLName()+" AS C ON C.id = N.id "; |
251 | 252 | sql+= " SET N.name = C.name "; |
252 | 253 | |
253 | 254 | database.executeUpdate("getNeighbourhoodFeatures#names", sql); |
254 | 255 | |
255 | 256 | sql = "SELECT N.id as concept, N.name as name, X.feature as feature, X.normal_weight as value "; |
256 | | - sql+= " FROM "+n+" AS N "; |
| 257 | + sql+= " FROM "+tmp.getSQLName()+" AS N "; |
257 | 258 | sql+= " JOIN "+featureTable.getSQLName()+" as X ON X.concept = N.id "; |
258 | 259 | |
259 | 260 | ResultSet rs = database.executeQuery("getNeighbourhoodFeatures#features", sql); |
260 | | - return new TemporaryTableDataSet.Cursor<ConceptFeatures<T, Integer>>(rs, factory, database, new String[] { n }, database.getLogOutput() ); |
| 261 | + return new TemporaryTableDataSet.Cursor<ConceptFeatures<T, Integer>>(rs, factory, database, new String[] { tmp.getSQLName() }, database.getLogOutput() ); |
261 | 262 | } catch (SQLException e) { |
262 | 263 | throw new PersistenceException(e); |
263 | 264 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseProximityStoreBuilder.java |
— | — | @@ -266,14 +266,14 @@ |
267 | 267 | } |
268 | 268 | |
269 | 269 | if (beginTask("buildProximityAround", "buildFeatures(join)")) { |
270 | | - String t = database.createTemporaryTable("id INT, PRIMARY KEY (id)"); |
| 270 | + DatabaseTable tmp = database.createTemporaryTable("id INT, PRIMARY KEY (id)"); |
271 | 271 | |
272 | | - String sql = "INSERT INTO "+t+" SELECT id FROM "+featureTable.getSQLName()+" WHERE concept = "+concept; |
| 272 | + String sql = "INSERT INTO "+tmp.getSQLName()+" SELECT id FROM "+featureTable.getSQLName()+" WHERE concept = "+concept; |
273 | 273 | database.executeUpdate("buildProximityAround::getFirstLevelConceptIds", sql); |
274 | 274 | |
275 | | - buildFeatures(new ConceptSetRestriction("JOIN "+t+" ON {concept} = "+t+".id "+concept, false, false)); |
| 275 | + buildFeatures(new ConceptSetRestriction("JOIN "+tmp.getSQLName()+" ON {concept} = "+tmp.getSQLName()+".id "+concept, false, false)); |
276 | 276 | |
277 | | - database.executeUpdate("buildProximityAround::dropFirstLevelConceptIds", "DROP TEMPORARY TABLE "+t); |
| 277 | + database.executeUpdate("buildProximityAround::dropFirstLevelConceptIds", "DROP TEMPORARY TABLE "+tmp.getSQLName()); |
278 | 278 | endTask("buildProximityAround", "buildFeatures(join)", "ok"); |
279 | 279 | } |
280 | 280 | |