Search in sources :

Example 1 with RegexPredicate

use of edu.uci.ics.textdb.exp.regexmatcher.RegexPredicate in project textdb by TextDB.

the class PredicateBaseTest method testRegexMatcher.

@Test
public void testRegexMatcher() throws Exception {
    RegexPredicate regexPredicate = new RegexPredicate("regex", attributeNames, "spanListName");
    testPredicate(regexPredicate);
    RegexSourcePredicate regexSourcePredicate = new RegexSourcePredicate("regex", attributeNames, "tableName", "spanListName");
    testPredicate(regexSourcePredicate);
}
Also used : RegexSourcePredicate(edu.uci.ics.textdb.exp.regexmatcher.RegexSourcePredicate) RegexPredicate(edu.uci.ics.textdb.exp.regexmatcher.RegexPredicate) Test(org.junit.Test)

Example 2 with RegexPredicate

use of edu.uci.ics.textdb.exp.regexmatcher.RegexPredicate in project textdb by TextDB.

the class JoinTestHelper method getRegexMatcher.

public static RegexMatcher getRegexMatcher(String tableName, String query, String attrName) {
    try {
        ScanBasedSourceOperator scanBasedSourceOperator = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
        RegexMatcher regexMatcher = new RegexMatcher(new RegexPredicate(query, Arrays.asList(attrName), SchemaConstants.SPAN_LIST));
        regexMatcher.setInputOperator(scanBasedSourceOperator);
        return regexMatcher;
    } catch (DataFlowException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : RegexPredicate(edu.uci.ics.textdb.exp.regexmatcher.RegexPredicate) DataFlowException(edu.uci.ics.textdb.api.exception.DataFlowException) RegexMatcher(edu.uci.ics.textdb.exp.regexmatcher.RegexMatcher) ScanBasedSourceOperator(edu.uci.ics.textdb.exp.source.scan.ScanBasedSourceOperator) ScanSourcePredicate(edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate)

Aggregations

RegexPredicate (edu.uci.ics.textdb.exp.regexmatcher.RegexPredicate)2 DataFlowException (edu.uci.ics.textdb.api.exception.DataFlowException)1 RegexMatcher (edu.uci.ics.textdb.exp.regexmatcher.RegexMatcher)1 RegexSourcePredicate (edu.uci.ics.textdb.exp.regexmatcher.RegexSourcePredicate)1 ScanBasedSourceOperator (edu.uci.ics.textdb.exp.source.scan.ScanBasedSourceOperator)1 ScanSourcePredicate (edu.uci.ics.textdb.exp.source.scan.ScanSourcePredicate)1 Test (org.junit.Test)1