use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class NlpEntityTest method setUp.
@BeforeClass
public static void setUp() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
relationManager.createTable(ONE_SENTENCE_TABLE, "../index/test_tables/" + ONE_SENTENCE_TABLE, NlpEntityTestConstants.SCHEMA_ONE_SENTENCE, LuceneAnalyzerConstants.standardAnalyzerString());
relationManager.createTable(TWO_SENTENCE_TABLE, "../index/test_tables/" + TWO_SENTENCE_TABLE, NlpEntityTestConstants.SCHEMA_TWO_SENTENCE, LuceneAnalyzerConstants.standardAnalyzerString());
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class NlpEntityTest method deleteData.
// table is cleared after each test case
@After
public void deleteData() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
DataWriter oneSentenceDataWriter = relationManager.getTableDataWriter(ONE_SENTENCE_TABLE);
oneSentenceDataWriter.open();
oneSentenceDataWriter.clearData();
oneSentenceDataWriter.close();
DataWriter twoSentenceDataWriter = relationManager.getTableDataWriter(TWO_SENTENCE_TABLE);
twoSentenceDataWriter.open();
twoSentenceDataWriter.clearData();
twoSentenceDataWriter.close();
}
use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.
the class DictionaryMatcherTestHelper method deleteTestTables.
public static void deleteTestTables() throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
relationManager.deleteTable(PEOPLE_TABLE);
relationManager.deleteTable(CHINESE_TABLE);
}
use of edu.uci.ics.textdb.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 TextDBException
*/
public static List<Tuple> getScanSourceResults(String tableName, Dictionary dictionary, List<String> attributeNames, KeywordMatchingType matchingType, int limit, int offset) throws TextDBException {
RelationManager relationManager = RelationManager.getRelationManager();
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.textdb.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 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();
}
Aggregations