Search in sources :

Example 6 with KeywordPredicate

use of edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate in project textdb by TextDB.

the class KeywordExtractPredicateTest method testGeneratePredicateBase01.

/**
 * Test the generatePredicateBase method.
 * Build a KeywordExtractPredicate, invoke the generatePredicateBase and
 * check whether a KeywordMatcherBean with the right attributes is returned.
 * A list with one field is used as the list of fields to perform the match.
 */
@Test
public void testGeneratePredicateBase01() {
    String operatorId = "operator";
    List<String> matchingFields = Arrays.asList("fieldOne");
    String keywords = "keyword(s)";
    String matchingType = KeywordMatchingType.PHRASE_INDEXBASED.toString();
    KeywordExtractPredicate keywordExtractPredicate = new KeywordExtractPredicate(matchingFields, keywords, matchingType);
    PredicateBase computedProjectionBean = keywordExtractPredicate.generateOperatorBean(operatorId);
    PredicateBase expectedProjectionBean = new KeywordPredicate(keywords, matchingFields, null, KeywordMatchingType.fromName(matchingType), operatorId);
    expectedProjectionBean.setID(operatorId);
    Assert.assertEquals(expectedProjectionBean, computedProjectionBean);
}
Also used : PredicateBase(edu.uci.ics.texera.dataflow.common.PredicateBase) KeywordPredicate(edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate) Test(org.junit.Test)

Example 7 with KeywordPredicate

use of edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate in project textdb by TextDB.

the class KeywordExtractPredicate method generateOperatorBean.

/**
 * Return this operator converted to a { @code KeywordMatcherBean }.
 * @param extractionOperatorId The ID of the OperatorBean to be created.
 * @return this operator converted to a KeywordMatcherBean.
 */
@Override
public KeywordPredicate generateOperatorBean(String extractionOperatorId) {
    KeywordPredicate keywordPredicate = new KeywordPredicate(this.keywords, this.matchingFields, null, KeywordMatchingType.fromName(this.matchingType), extractionOperatorId);
    keywordPredicate.setID(extractionOperatorId);
    return keywordPredicate;
}
Also used : KeywordPredicate(edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate)

Example 8 with KeywordPredicate

use of edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate in project textdb by TextDB.

the class PredicateBaseTest method testKeyword.

@Test
public void testKeyword() throws Exception {
    KeywordPredicate keywordPredicate = new KeywordPredicate("keyword", attributeNames, "standard", KeywordMatchingType.CONJUNCTION_INDEXBASED, "keywordResults");
    testPredicate(keywordPredicate);
    KeywordSourcePredicate keywordSourcePredicate = new KeywordSourcePredicate("keyword", attributeNames, "standard", KeywordMatchingType.CONJUNCTION_INDEXBASED, "tableName", "keywordSourceResults");
    testPredicate(keywordSourcePredicate);
}
Also used : KeywordSourcePredicate(edu.uci.ics.texera.dataflow.keywordmatcher.KeywordSourcePredicate) KeywordPredicate(edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate) Test(org.junit.Test)

Aggregations

KeywordPredicate (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate)8 Test (org.junit.Test)7 PredicateBase (edu.uci.ics.texera.dataflow.common.PredicateBase)6 SelectStatement (edu.uci.ics.texera.textql.statements.SelectStatement)3 ExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.ExtractPredicate)3 KeywordExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.KeywordExtractPredicate)3 ProjectPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectPredicate)2 KeywordSourcePredicate (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordSourcePredicate)1 ProjectionPredicate (edu.uci.ics.texera.dataflow.projection.ProjectionPredicate)1 ProjectAllFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectAllFieldsPredicate)1 ProjectSomeFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectSomeFieldsPredicate)1