Search in sources :

Example 11 with ProjectPredicate

use of edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate in project textdb by TextDB.

the class SelectStatementTest method testSelectStatementBeansBuilder04.

/**
     * Test the correctness of the generated beans by a SelectStatement with a
     * ProjectAllFieldsPredicate and a KeywordExtractPredicate.
     * Get a graph by calling getInternalPredicateBases() and getInternalLinkBeans()
     * methods and check if the generated path form the node getInputNodeID() to 
     * the node getOutputNodeID() is correct. Also check whether getInputViews()
     * is returning the correct dependencies.  
     */
@Test
public void testSelectStatementBeansBuilder04() {
    ProjectPredicate projectPredicate = new ProjectAllFieldsPredicate();
    ExtractPredicate extractPredicate = new KeywordExtractPredicate(Arrays.asList("f1"), "keyword", KeywordMatchingType.CONJUNCTION_INDEXBASED.toString());
    SelectStatement selectStatement = new SelectStatement("id", projectPredicate, extractPredicate, "source", null, null);
    List<PredicateBase> expectedGeneratedBeans = Arrays.asList(new KeywordPredicate("keyword", Arrays.asList("f1"), null, KeywordMatchingType.CONJUNCTION_INDEXBASED, "id_e"));
    List<String> dependencies = Arrays.asList("source");
    Assert.assertEquals(selectStatement.getInputViews(), dependencies);
    StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
Also used : SelectStatement(edu.uci.ics.textdb.textql.statements.SelectStatement) ProjectPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate) PredicateBase(edu.uci.ics.textdb.exp.common.PredicateBase) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) ExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.ExtractPredicate) ProjectAllFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) KeywordPredicate(edu.uci.ics.textdb.exp.keywordmatcher.KeywordPredicate) Test(org.junit.Test)

Example 12 with ProjectPredicate

use of edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate in project textdb by TextDB.

the class CreateViewStatementTest method testCreateViewStatementBeansBuilder01.

/**
     * Test the correctness of the generated beans by a CreateViewStatement with
     * a SelectExtractStatement as sub-statement with a
     * SelectSomeFieldsPredicate and a KeywordExtractPredicate.
     * Get a graph by calling getInternalOperatorBeans() and getInternalLinkBeans()
     * methods and check if the generated path form the node getInputNodeID() to 
     * the node getOutputNodeID() is correct. Also check whether getInputViews()
     * is returning the correct dependencies.  
     */
@Test
public void testCreateViewStatementBeansBuilder01() {
    ProjectPredicate projectPredicate = new ProjectSomeFieldsPredicate(Arrays.asList("x", "y"));
    ExtractPredicate extractPredicate = new KeywordExtractPredicate(Arrays.asList("a", "b"), "zzz", KeywordMatchingType.SUBSTRING_SCANBASED.toString());
    Statement subStatement = new SelectStatement("id", projectPredicate, extractPredicate, "from", null, null);
    CreateViewStatement createViewStatement = new CreateViewStatement("idx", subStatement);
    List<PredicateBase> expectedGeneratedBeans = Collections.emptyList();
    List<String> dependencies = Arrays.asList(subStatement.getId());
    Assert.assertEquals(createViewStatement.getInputViews(), dependencies);
    StatementTestUtils.assertGeneratedBeans(createViewStatement, expectedGeneratedBeans);
}
Also used : SelectStatement(edu.uci.ics.textdb.textql.statements.SelectStatement) ProjectPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate) CreateViewStatement(edu.uci.ics.textdb.textql.statements.CreateViewStatement) PredicateBase(edu.uci.ics.textdb.exp.common.PredicateBase) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) ExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.ExtractPredicate) Statement(edu.uci.ics.textdb.textql.statements.Statement) CreateViewStatement(edu.uci.ics.textdb.textql.statements.CreateViewStatement) SelectStatement(edu.uci.ics.textdb.textql.statements.SelectStatement) ProjectSomeFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectSomeFieldsPredicate) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) Test(org.junit.Test)

Example 13 with ProjectPredicate

use of edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate in project textdb by TextDB.

the class SelectStatementTest method testSelectStatementBeansBuilder01.

/**
     * Test the correctness of the generated beans by a SelectStatement with a
     * ProjectAllFieldsPredicate.
     * Get a graph by calling getInternalPredicateBases() and getInternalLinkBeans()
     * methods and check if the generated path form the node getInputNodeID() to 
     * the node getOutputNodeID() is correct. Also check whether getInputViews()
     * is returning the correct dependencies.  
     */
@Test
public void testSelectStatementBeansBuilder01() {
    ProjectPredicate projectPredicate = new ProjectAllFieldsPredicate();
    SelectStatement selectStatement = new SelectStatement("id", projectPredicate, null, "Table", null, null);
    List<PredicateBase> expectedGeneratedBeans = Collections.emptyList();
    List<String> dependencies = Arrays.asList("Table");
    Assert.assertEquals(selectStatement.getInputViews(), dependencies);
    StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
Also used : SelectStatement(edu.uci.ics.textdb.textql.statements.SelectStatement) ProjectPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate) PredicateBase(edu.uci.ics.textdb.exp.common.PredicateBase) ProjectAllFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate) Test(org.junit.Test)

Aggregations

SelectStatement (edu.uci.ics.textdb.textql.statements.SelectStatement)13 ProjectPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate)13 Test (org.junit.Test)13 ExtractPredicate (edu.uci.ics.textdb.textql.statements.predicates.ExtractPredicate)11 KeywordExtractPredicate (edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate)11 ProjectSomeFieldsPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectSomeFieldsPredicate)11 ProjectAllFieldsPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate)10 CreateViewStatement (edu.uci.ics.textdb.textql.statements.CreateViewStatement)7 Statement (edu.uci.ics.textdb.textql.statements.Statement)7 PredicateBase (edu.uci.ics.textdb.exp.common.PredicateBase)5 TextQLParser (edu.uci.ics.textdb.textql.languageparser.TextQLParser)4 KeywordPredicate (edu.uci.ics.textdb.exp.keywordmatcher.KeywordPredicate)2 ProjectionPredicate (edu.uci.ics.textdb.exp.projection.ProjectionPredicate)2 ParseException (edu.uci.ics.textdb.textql.languageparser.ParseException)1 TokenMgrError (edu.uci.ics.textdb.textql.languageparser.TokenMgrError)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 PipedInputStream (java.io.PipedInputStream)1 PipedOutputStream (java.io.PipedOutputStream)1 PrintStream (java.io.PrintStream)1