use of edu.uci.ics.texera.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 TexeraException
*/
public static List<Tuple> getDictionarySourceResults(String tableName, Dictionary dictionary, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
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.texera.storage.RelationManager in project textdb by TextDB.
the class DictionaryMatcherTestHelper method getScanSourceResults.
/**
* Get the results from a DictionaryMatcher with a ScanSource Operator
* (which scans the table first and then feeds the data into the dictionary matcher)
*
* @param tableName
* @param dictionary
* @param attributeNames
* @param matchingType
* @param limit
* @param offset
* @return
* @throws TexeraException
*/
public static List<Tuple> getScanSourceResults(String tableName, Dictionary dictionary, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
String luceneAnalyzerStr = relationManager.getTableAnalyzerString(tableName);
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
DictionaryPredicate dictiaonryPredicate = new DictionaryPredicate(dictionary, attributeNames, luceneAnalyzerStr, matchingType, RESULTS);
DictionaryMatcher dictionaryMatcher = new DictionaryMatcher(dictiaonryPredicate);
dictionaryMatcher.setLimit(limit);
dictionaryMatcher.setOffset(offset);
dictionaryMatcher.setInputOperator(scanSource);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
dictionaryMatcher.open();
while ((tuple = dictionaryMatcher.getNextTuple()) != null) {
results.add(tuple);
}
dictionaryMatcher.close();
return results;
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class FuzzyTokenMatcherTestHelper method writeTestTables.
/*
* Creates the test table(s) and writes data into it(them).
*/
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();
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class FuzzyTokenMatcherTestHelper method deleteTestTables.
/*
* Deletes the test table(s)
*/
public static void deleteTestTables() throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
relationManager.deleteTable(PEOPLE_TABLE);
}
use of edu.uci.ics.texera.storage.RelationManager in project textdb by TextDB.
the class JoinTestHelper method clearTestTables.
/**
* Clears the data of the inner and outer test tables.
* @throws TexeraException
*/
public static void clearTestTables() throws TexeraException {
RelationManager relationManager = RelationManager.getInstance();
DataWriter bookDataWriter = relationManager.getTableDataWriter(BOOK_TABLE);
bookDataWriter.open();
bookDataWriter.clearData();
bookDataWriter.close();
DataWriter innerNewsDataWriter = relationManager.getTableDataWriter(NEWS_TABLE_INNER);
innerNewsDataWriter.open();
innerNewsDataWriter.clearData();
innerNewsDataWriter.close();
DataWriter outerNewsDataWriter = relationManager.getTableDataWriter(NEWS_TABLE_OUTER);
outerNewsDataWriter.open();
outerNewsDataWriter.clearData();
outerNewsDataWriter.close();
}
Aggregations