Search in sources :

Example 31 with RelationManager

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

the class MedlineIndexWriter method writeMedlineIndex.

public static void writeMedlineIndex(Path medlineFilepath, String tableName) throws IOException, StorageException, ParseException {
    RelationManager relationManager = RelationManager.getRelationManager();
    DataWriter dataWriter = relationManager.getTableDataWriter(tableName);
    dataWriter.open();
    BufferedReader reader = Files.newBufferedReader(medlineFilepath);
    String line;
    while ((line = reader.readLine()) != null) {
        try {
            dataWriter.insertTuple(recordToTuple(line));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    reader.close();
    dataWriter.close();
}
Also used : BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) StorageException(edu.uci.ics.textdb.api.exception.StorageException) ParseException(java.text.ParseException) RelationManager(edu.uci.ics.textdb.storage.RelationManager) DataWriter(edu.uci.ics.textdb.storage.DataWriter)

Example 32 with RelationManager

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

the class ScanBasedSourceOperatorTest method cleanUp.

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

Example 33 with RelationManager

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

the class OneToNBroadcastConnectorTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    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();
}
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 34 with RelationManager

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

the class OneToNBroadcastConnectorTest method cleanUp.

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

Example 35 with RelationManager

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

the class ComparableMatcherTest method setUp.

@BeforeClass
public static void setUp() 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();
}
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