use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class JoinTestHelper method insertToTable.
public static void insertToTable(String tableName, List<Tuple> tuples) throws StorageException {
RelationManager relationManager = RelationManager.getRelationManager();
DataWriter outerDataWriter = relationManager.getTableDataWriter(tableName);
outerDataWriter.open();
for (Tuple tuple : tuples) {
outerDataWriter.insertTuple(tuple);
}
outerDataWriter.close();
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class DictionaryMatcherTestHelper method writeTestTables.
public static void writeTestTables() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
// create the people table and write tuples
relationManager.createTable(PEOPLE_TABLE, "../index/test_tables/" + PEOPLE_TABLE, TestConstants.SCHEMA_PEOPLE, LuceneAnalyzerConstants.standardAnalyzerString());
DataWriter peopleDataWriter = relationManager.getTableDataWriter(PEOPLE_TABLE);
peopleDataWriter.open();
for (Tuple tuple : TestConstants.getSamplePeopleTuples()) {
peopleDataWriter.insertTuple(tuple);
}
peopleDataWriter.close();
// create the people table and write tuples in Chinese
relationManager.createTable(CHINESE_TABLE, "../index/test_tables/" + CHINESE_TABLE, TestConstantsChinese.SCHEMA_PEOPLE, LuceneAnalyzerConstants.chineseAnalyzerString());
DataWriter chineseDataWriter = relationManager.getTableDataWriter(CHINESE_TABLE);
chineseDataWriter.open();
for (Tuple tuple : TestConstantsChinese.getSamplePeopleTuples()) {
chineseDataWriter.insertTuple(tuple);
}
chineseDataWriter.close();
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class DictionaryMatcherTestHelper method getDictionarySourceResults.
/**
* Get the results from the DictionarySourceOperator
* (which performs a index-based lookup for each keyword in the dictionary)
*
* @param tableName
* @param dictionary
* @param attributeNames
* @param matchingType
* @param limit
* @param offset
* @return
* @throws TextDBException
*/
public static List<Tuple> getDictionarySourceResults(String tableName, Dictionary dictionary, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
String luceneAnalyzerStr = relationManager.getTableAnalyzerString(tableName);
DictionarySourcePredicate dictiaonrySourcePredicate = new DictionarySourcePredicate(dictionary, attributeNames, luceneAnalyzerStr, matchingType, tableName, RESULTS);
DictionaryMatcherSourceOperator dictionarySource = new DictionaryMatcherSourceOperator(dictiaonrySourcePredicate);
dictionarySource.setLimit(limit);
dictionarySource.setOffset(offset);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
dictionarySource.open();
while ((tuple = dictionarySource.getNextTuple()) != null) {
results.add(tuple);
}
dictionarySource.close();
return results;
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class FuzzyTokenMatcherTestHelper method deleteTestTables.
/*
* Deletes the test table(s)
*/
public static void deleteTestTables() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
relationManager.deleteTable(PEOPLE_TABLE);
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class JoinTestHelper method createTestTables.
public static void createTestTables() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
// create the book table
relationManager.createTable(BOOK_TABLE, "../index/test_tables/" + BOOK_TABLE, JoinTestConstants.BOOK_SCHEMA, LuceneAnalyzerConstants.standardAnalyzerString());
// data for the book table are written in each test cases
// create the news table
relationManager.createTable(NEWS_TABLE_OUTER, "../index/test_tables/" + NEWS_TABLE_OUTER, JoinTestConstants.NEWS_SCHEMA, LuceneAnalyzerConstants.standardAnalyzerString());
relationManager.createTable(NEWS_TABLE_INNER, "../index/test_tables/" + NEWS_TABLE_INNER, JoinTestConstants.NEWS_SCHEMA, LuceneAnalyzerConstants.standardAnalyzerString());
}
Aggregations