Search in sources :

Example 6 with RelationManager

use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.

the class JoinTestHelper method clearTestTables.

/**
     * Clears the data of the inner and outer test tables.
     * @throws TextDBException
     */
public static void clearTestTables() throws TextDBException {
    RelationManager relationManager = RelationManager.getRelationManager();
    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();
}
Also used : RelationManager(edu.uci.ics.textdb.storage.RelationManager) DataWriter(edu.uci.ics.textdb.storage.DataWriter)

Example 7 with RelationManager

use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.

the class ComparableMatcherTest method cleanUp.

@AfterClass
public static void cleanUp() throws TextDBException {
    RelationManager relationManager = RelationManager.getRelationManager();
    relationManager.deleteTable(PEOPLE_TABLE);
}
Also used : RelationManager(edu.uci.ics.textdb.storage.RelationManager) AfterClass(org.junit.AfterClass)

Example 8 with RelationManager

use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.

the class WordCountTest method setUp.

@BeforeClass
public static void setUp() throws TextDBException {
    cleanUp();
    RelationManager relationManager = RelationManager.getRelationManager();
    // Create the people table and write tuples
    relationManager.createTable(COUNT_TABLE, "../index/test_tables/" + COUNT_TABLE, TestConstants.SCHEMA_PEOPLE, LuceneAnalyzerConstants.standardAnalyzerString());
    DataWriter dataWriter = relationManager.getTableDataWriter(COUNT_TABLE);
    dataWriter.open();
    for (Tuple tuple : TestConstants.getSamplePeopleTuples()) {
        dataWriter.insertTuple(tuple);
    }
    dataWriter.close();
    expectedResult = computeExpectedResult(TestConstants.getSamplePeopleTuples(), TestConstants.DESCRIPTION, LuceneAnalyzerConstants.getStandardAnalyzer());
    relationManager.createTable(COUNT_CHINESE_TABLE, "../index/test_tables/" + COUNT_CHINESE_TABLE, TestConstantsChineseWordCount.SCHEMA_PEOPLE, LuceneAnalyzerConstants.chineseAnalyzerString());
    DataWriter dataWriterChinese = relationManager.getTableDataWriter(COUNT_CHINESE_TABLE);
    dataWriterChinese.open();
    for (Tuple tuple : TestConstantsChineseWordCount.getSamplePeopleTuples()) {
        dataWriterChinese.insertTuple(tuple);
    }
    dataWriterChinese.close();
    expectedResultChinese = computeExpectedResult(TestConstantsChineseWordCount.getSamplePeopleTuples(), TestConstantsChineseWordCount.DESCRIPTION, LuceneAnalyzerConstants.getLuceneAnalyzer(LuceneAnalyzerConstants.chineseAnalyzerString()));
}
Also used : Tuple(edu.uci.ics.textdb.api.tuple.Tuple) RelationManager(edu.uci.ics.textdb.storage.RelationManager) DataWriter(edu.uci.ics.textdb.storage.DataWriter) BeforeClass(org.junit.BeforeClass)

Example 9 with RelationManager

use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.

the class RegexSplitOperatorTest method setUp.

@BeforeClass
public static void setUp() throws TextDBException {
    RelationManager relationManager = RelationManager.getRelationManager();
    RelationManager.getRelationManager().deleteTable(REGEX_TABLE);
    relationManager = RelationManager.getRelationManager();
    relationManager.createTable(REGEX_TABLE, "../index/test_tables/" + REGEX_TABLE, TestConstantsRegexSplit.SCHEMA_PEOPLE, LuceneAnalyzerConstants.standardAnalyzerString());
    DataWriter regexDataWriter = relationManager.getTableDataWriter(REGEX_TABLE);
    regexDataWriter.open();
    for (Tuple tuple : TestConstantsRegexSplit.constructSamplePeopleTuples()) {
        regexDataWriter.insertTuple(tuple);
    }
    regexDataWriter.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();
}
Also used : Tuple(edu.uci.ics.textdb.api.tuple.Tuple) RelationManager(edu.uci.ics.textdb.storage.RelationManager) DataWriter(edu.uci.ics.textdb.storage.DataWriter) BeforeClass(org.junit.BeforeClass)

Example 10 with RelationManager

use of edu.uci.ics.textdb.storage.RelationManager in project textdb by TextDB.

the class SamplerTest method setUp.

@BeforeClass
public static void setUp() throws TextDBException {
    RelationManager relationManager = RelationManager.getRelationManager();
    // Create the people table and write tuples
    RelationManager.getRelationManager().deleteTable(SAMPLER_TABLE);
    relationManager.createTable(SAMPLER_TABLE, "../index/test_tables/" + SAMPLER_TABLE, TestConstants.SCHEMA_PEOPLE, LuceneAnalyzerConstants.standardAnalyzerString());
    DataWriter dataWriter = relationManager.getTableDataWriter(SAMPLER_TABLE);
    dataWriter.open();
    indexSize = 0;
    for (Tuple tuple : TestConstants.getSamplePeopleTuples()) {
        dataWriter.insertTuple(tuple);
        indexSize++;
    }
    dataWriter.close();
}
Also used : Tuple(edu.uci.ics.textdb.api.tuple.Tuple) RelationManager(edu.uci.ics.textdb.storage.RelationManager) DataWriter(edu.uci.ics.textdb.storage.DataWriter) BeforeClass(org.junit.BeforeClass)

Aggregations

RelationManager (edu.uci.ics.textdb.storage.RelationManager)35 Tuple (edu.uci.ics.textdb.api.tuple.Tuple)19 DataWriter (edu.uci.ics.textdb.storage.DataWriter)18 BeforeClass (org.junit.BeforeClass)8 ArrayList (java.util.ArrayList)5 AfterClass (org.junit.AfterClass)5 ScanBasedSourceOperator (edu.uci.ics.textdb.exp.source.scan.ScanBasedSourceOperator)2 ScanSourcePredicate (edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate)2 File (java.io.File)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StorageException (edu.uci.ics.textdb.api.exception.StorageException)1 IntegerField (edu.uci.ics.textdb.api.field.IntegerField)1 StringField (edu.uci.ics.textdb.api.field.StringField)1 TextField (edu.uci.ics.textdb.api.field.TextField)1 DictionaryPredicate (edu.uci.ics.textdb.exp.dictionarymatcher.DictionaryPredicate)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 Scanner (java.util.Scanner)1