Search in sources :

Example 11 with RelationManager

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

the class NlpEntityTest method deleteData.

// table is cleared after each test case
@After
public void deleteData() throws TexeraException {
    RelationManager relationManager = RelationManager.getInstance();
    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();
}
Also used : RelationManager(edu.uci.ics.texera.storage.RelationManager) DataWriter(edu.uci.ics.texera.storage.DataWriter) After(org.junit.After)

Example 12 with RelationManager

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

the class ProjectionOperatorTest method cleanUp.

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

Example 13 with RelationManager

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

the class RegexMatcherTestHelper 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 corporation table and write tuples
    relationManager.createTable(CORP_TABLE, TestUtils.getDefaultTestIndex().resolve(CORP_TABLE), RegexTestConstantsCorp.SCHEMA_CORP, LuceneAnalyzerConstants.nGramAnalyzerString(3));
    DataWriter corpDataWriter = relationManager.getTableDataWriter(CORP_TABLE);
    corpDataWriter.open();
    for (Tuple tuple : RegexTestConstantsCorp.getSampleCorpTuples()) {
        corpDataWriter.insertTuple(tuple);
    }
    corpDataWriter.close();
    // create the staff table
    relationManager.createTable(STAFF_TABLE, TestUtils.getDefaultTestIndex().resolve(STAFF_TABLE), RegexTestConstantStaff.SCHEMA_STAFF, LuceneAnalyzerConstants.nGramAnalyzerString(3));
    DataWriter staffDataWriter = relationManager.getTableDataWriter(STAFF_TABLE);
    staffDataWriter.open();
    for (Tuple tuple : RegexTestConstantStaff.getSampleStaffTuples()) {
        staffDataWriter.insertTuple(tuple);
    }
    staffDataWriter.close();
    // create the text table
    relationManager.createTable(TEXT_TABLE, TestUtils.getDefaultTestIndex().resolve(TEXT_TABLE), RegexTestConstantsText.SCHEMA_TEXT, LuceneAnalyzerConstants.nGramAnalyzerString(3));
    DataWriter textDataWriter = relationManager.getTableDataWriter(TEXT_TABLE);
    textDataWriter.open();
    for (Tuple tuple : RegexTestConstantsText.getSampleTextTuples()) {
        textDataWriter.insertTuple(tuple);
    }
    textDataWriter.close();
}
Also used : Tuple(edu.uci.ics.texera.api.tuple.Tuple) RelationManager(edu.uci.ics.texera.storage.RelationManager) DataWriter(edu.uci.ics.texera.storage.DataWriter)

Example 14 with RelationManager

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

the class RegexMatcherTestHelper method deleteTestTables.

public static void deleteTestTables() throws TexeraException {
    RelationManager relationManager = RelationManager.getInstance();
    relationManager.deleteTable(PEOPLE_TABLE);
    relationManager.deleteTable(CORP_TABLE);
    relationManager.deleteTable(STAFF_TABLE);
    relationManager.deleteTable(TEXT_TABLE);
}
Also used : RelationManager(edu.uci.ics.texera.storage.RelationManager)

Example 15 with RelationManager

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

the class ScanBasedSourceOperatorTest method setUp.

@BeforeClass
public static void setUp() 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();
}
Also used : Tuple(edu.uci.ics.texera.api.tuple.Tuple) RelationManager(edu.uci.ics.texera.storage.RelationManager) DataWriter(edu.uci.ics.texera.storage.DataWriter) BeforeClass(org.junit.BeforeClass)

Aggregations

RelationManager (edu.uci.ics.texera.storage.RelationManager)35 Tuple (edu.uci.ics.texera.api.tuple.Tuple)19 DataWriter (edu.uci.ics.texera.storage.DataWriter)18 BeforeClass (org.junit.BeforeClass)8 ArrayList (java.util.ArrayList)5 AfterClass (org.junit.AfterClass)5 ScanBasedSourceOperator (edu.uci.ics.texera.dataflow.source.scan.ScanBasedSourceOperator)2 ScanSourcePredicate (edu.uci.ics.texera.dataflow.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.texera.api.exception.StorageException)1 IntegerField (edu.uci.ics.texera.api.field.IntegerField)1 StringField (edu.uci.ics.texera.api.field.StringField)1 TextField (edu.uci.ics.texera.api.field.TextField)1 DictionaryPredicate (edu.uci.ics.texera.dataflow.dictionarymatcher.DictionaryPredicate)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 Scanner (java.util.Scanner)1