use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class JoinTestHelper method insertToTable.
public static void insertToTable(String tableName, Tuple... tuples) throws StorageException {
RelationManager relationManager = RelationManager.getInstance();
DataWriter tableDataWriter = relationManager.getTableDataWriter(tableName);
tableDataWriter.open();
for (Tuple tuple : Arrays.asList(tuples)) {
tableDataWriter.insertTuple(tuple);
}
tableDataWriter.close();
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class JoinTestHelper method deleteTestTables.
/**
* Deletes all test tables
* @throws TexeraException
*/
public static void deleteTestTables() throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
relationManager.deleteTable(BOOK_TABLE);
relationManager.deleteTable(NEWS_TABLE_OUTER);
relationManager.deleteTable(NEWS_TABLE_INNER);
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class KeywordTestHelper method deleteTestTables.
public static void deleteTestTables() throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
relationManager.deleteTable(PEOPLE_TABLE);
relationManager.deleteTable(MEDLINE_TABLE);
relationManager.deleteTable(CHINESE_TABLE);
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class KeywordTestHelper method getKeywordSourceResults.
public static List<Tuple> getKeywordSourceResults(String tableName, String keywordQuery, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
KeywordSourcePredicate keywordSourcePredicate = new KeywordSourcePredicate(keywordQuery, attributeNames, relationManager.getTableAnalyzerString(tableName), matchingType, tableName, RESULTS);
KeywordMatcherSourceOperator keywordSource = new KeywordMatcherSourceOperator(keywordSourcePredicate);
keywordSource.setLimit(limit);
keywordSource.setOffset(offset);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
keywordSource.open();
while ((tuple = keywordSource.getNextTuple()) != null) {
results.add(tuple);
}
keywordSource.close();
return results;
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class KeywordTestHelper method writeTestTables.
public static void writeTestTables() throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
// create the people table and write tuples
relationManager.createTable(PEOPLE_TABLE, TestUtils.getDefaultTestIndex().resolve(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 medline table and write tuples
relationManager.createTable(MEDLINE_TABLE, TestUtils.getDefaultTestIndex().resolve(MEDLINE_TABLE), keywordTestConstants.SCHEMA_MEDLINE, LuceneAnalyzerConstants.standardAnalyzerString());
DataWriter medDataWriter = relationManager.getTableDataWriter(MEDLINE_TABLE);
medDataWriter.open();
for (Tuple tuple : keywordTestConstants.getSampleMedlineRecord()) {
medDataWriter.insertTuple(tuple);
}
medDataWriter.close();
// create the people table and write tuples in Chinese
relationManager.createTable(CHINESE_TABLE, TestUtils.getDefaultTestIndex().resolve(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();
}
Aggregations