Search in sources :

Example 6 with TextQLParser

use of edu.uci.ics.textdb.textql.languageparser.TextQLParser in project textdb by TextDB.

the class TextQLParserTest method testCreateViewStatement.

/**
     * Test the createViewStatement method of the parser.
     * It should parse a create view statement and return the expected CreateViewStatement object.
     * @throws ParseException if an unexpected ParseException is thrown
     */
@Test
public void testCreateViewStatement() throws ParseException {
    String createViewStatement00 = " CREATE VIEW v0 AS SELECT * FROM a ";
    ProjectPredicate createViewStatementSelectP00 = new ProjectAllFieldsPredicate();
    Statement createViewStatementSelect00 = new SelectStatement("_sid0", createViewStatementSelectP00, null, "a", null, null);
    Statement createViewStatementParameters00 = new CreateViewStatement("v0", createViewStatementSelect00);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement00))).createViewStatement(), createViewStatementParameters00);
    String createViewStatement01 = " CREATE VIEW v1 AS SELECT f8, fa, fc, df, ff FROM j LIMIT 1 OFFSET 8 ";
    ProjectPredicate createViewStatementSelectP01 = new ProjectSomeFieldsPredicate(Arrays.asList("f8", "fa", "fc", "df", "ff"));
    Statement createViewStatementSelect01 = new SelectStatement("_sid0", createViewStatementSelectP01, null, "j", 1, 8);
    Statement createViewStatementParameters01 = new CreateViewStatement("v1", createViewStatementSelect01);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement01))).createViewStatement(), createViewStatementParameters01);
    String createViewStatement02 = " CREATE VIEW v2 AS SELECT e, KEYWORDMATCH([g4,g5], \"key0\") FROM o ";
    ProjectPredicate createViewStatementSelectP02 = new ProjectSomeFieldsPredicate(Arrays.asList("e"));
    ExtractPredicate createViewStatementExtract02 = new KeywordExtractPredicate(Arrays.asList("g4", "g5"), "key0", null);
    Statement createViewStatementSelect02 = new SelectStatement("_sid0", createViewStatementSelectP02, createViewStatementExtract02, "o", null, null);
    Statement createViewStatementParameters02 = new CreateViewStatement("v2", createViewStatementSelect02);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement02))).createViewStatement(), createViewStatementParameters02);
    String createViewStatement03 = " CREATE VIEW v2 AS SELECT KEYWORDMATCH([g4,g5], \"key0\", substring) FROM o ";
    ExtractPredicate createViewStatementExtract03 = new KeywordExtractPredicate(Arrays.asList("g4", "g5"), "key0", "substring");
    Statement createViewStatementSelect03 = new SelectStatement("_sid0", null, createViewStatementExtract03, "o", null, null);
    Statement createViewStatementParameters03 = new CreateViewStatement("v2", createViewStatementSelect03);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement03))).createViewStatement(), createViewStatementParameters03);
    String createViewStatement04 = " CREATE VIEW v3 AS CREATE VIEW v4 AS SELECT * FROM a ";
    assertException(() -> (new TextQLParser(string2InputStream(createViewStatement04))).createViewStatement(), ParseException.class);
    String createViewStatement05 = " CREATE VIEW v0 AS ";
    assertException(() -> (new TextQLParser(string2InputStream(createViewStatement05))).createViewStatement(), ParseException.class);
    String createViewStatement06 = " CREATE VIEW v0 ";
    assertException(() -> (new TextQLParser(string2InputStream(createViewStatement06))).createViewStatement(), ParseException.class);
    String createViewStatement08 = " CREATE v0 AS SELECT * FROM a ";
    assertException(() -> (new TextQLParser(string2InputStream(createViewStatement08))).createViewStatement(), ParseException.class);
    String createViewStatement09 = " VIEW v0 AS SELECT * FROM a ";
    assertException(() -> (new TextQLParser(string2InputStream(createViewStatement09))).createViewStatement(), ParseException.class);
}
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) 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) ProjectAllFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate) ProjectSomeFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectSomeFieldsPredicate) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) TextQLParser(edu.uci.ics.textdb.textql.languageparser.TextQLParser) Test(org.junit.Test)

Example 7 with TextQLParser

use of edu.uci.ics.textdb.textql.languageparser.TextQLParser in project textdb by TextDB.

the class TextQLParserTest method testNumberLiteralToInteger.

/**
     * Test the numberLiteralToInteger method  of the parser.
     * It should parse a NUMBER_LITERAL from the input and return it as an integer.
     * @throws ParseException if an unexpected ParseException is thrown
     */
@Test
public void testNumberLiteralToInteger() throws ParseException {
    Assert.assertEquals((new TextQLParser(string2InputStream(" 0 "))).numberLiteralToInteger(), 0);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 12 "))).numberLiteralToInteger(), 12);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 34566 "))).numberLiteralToInteger(), 34566);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -0 "))).numberLiteralToInteger(), 0);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -12 "))).numberLiteralToInteger(), -12);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -34566 "))).numberLiteralToInteger(), -34566);
    assertException(() -> (new TextQLParser(string2InputStream(" 78.90 "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" 123. "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" .456 "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -78.90 "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -123. "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -.456 "))).numberLiteralToInteger(), NumberFormatException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -e "))).numberLiteralToInteger(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -e 21"))).numberLiteralToInteger(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" +4 "))).numberLiteralToInteger(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a 22 "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a45 "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" A45 "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" FROM45 "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" \"4\" "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" /4/ "))).numberLiteralToInteger(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" /4 "))).numberLiteralToInteger(), TokenMgrError.class);
}
Also used : TextQLParser(edu.uci.ics.textdb.textql.languageparser.TextQLParser) Test(org.junit.Test)

Example 8 with TextQLParser

use of edu.uci.ics.textdb.textql.languageparser.TextQLParser in project textdb by TextDB.

the class TextQLParserTest method testStatement.

/**
     * Test the statement method of the parser.
     * It should parse a statement and return the expected Statement object.
     * @throws ParseException if an unexpected ParseException is thrown
     */
@Test
public void testStatement() throws ParseException {
    String SelectStatement00 = "SELECT * FROM a;";
    ProjectPredicate SelectStatementSelect00 = new ProjectAllFieldsPredicate();
    Statement SelectStatementParameters00 = new SelectStatement("_sid0", SelectStatementSelect00, null, "a", null, null);
    Assert.assertEquals((new TextQLParser(string2InputStream(SelectStatement00))).statement(), SelectStatementParameters00);
    String SelectStatement06 = "SELECT f8, fa, fc, df, ff FROM j;";
    ProjectPredicate SelectStatementSelect06 = new ProjectSomeFieldsPredicate(Arrays.asList("f8", "fa", "fc", "df", "ff"));
    Statement SelectStatementParameters06 = new SelectStatement("_sid0", SelectStatementSelect06, null, "j", null, null);
    Assert.assertEquals((new TextQLParser(string2InputStream(SelectStatement06))).statement(), SelectStatementParameters06);
    String SelectStatement13 = "SELECT h, i, j, KEYWORDMATCH([h6,h7,k8,k9], \"key5\") FROM q;";
    ProjectPredicate SelectStatementSelect13 = new ProjectSomeFieldsPredicate(Arrays.asList("h", "i", "j"));
    ExtractPredicate SelectStatementExtract13 = new KeywordExtractPredicate(Arrays.asList("h6", "h7", "k8", "k9"), "key5", null);
    Statement SelectStatementParameters13 = new SelectStatement("_sid0", SelectStatementSelect13, SelectStatementExtract13, "q", null, null);
    Assert.assertEquals((new TextQLParser(string2InputStream(SelectStatement13))).statement(), SelectStatementParameters13);
    String SelectStatement14 = "SELECT KEYWORDMATCH([i6,j7,l8,m9], \"key5\") FROM q;";
    ExtractPredicate SelectStatementExtract14 = new KeywordExtractPredicate(Arrays.asList("i6", "j7", "l8", "m9"), "key5", null);
    Statement SelectStatementParameters14 = new SelectStatement("_sid0", null, SelectStatementExtract14, "q", null, null);
    Assert.assertEquals((new TextQLParser(string2InputStream(SelectStatement14))).statement(), SelectStatementParameters14);
    String SelectStatement21 = "SELECT KEYWORDMATCH([h3,i2,j1,k0], \"key\\\"/\") FROM m LIMIT 4 OFFSET 25 ;";
    ExtractPredicate SelectStatementExtract21 = new KeywordExtractPredicate(Arrays.asList("h3", "i2", "j1", "k0"), "key\"/", null);
    Statement SelectStatementParameters21 = new SelectStatement("_sid0", null, SelectStatementExtract21, "m", 4, 25);
    Assert.assertEquals((new TextQLParser(string2InputStream(SelectStatement21))).statement(), SelectStatementParameters21);
    String createViewStatement00 = " CREATE VIEW v0 AS SELECT * FROM a; ";
    ProjectPredicate createViewStatementSelectP00 = new ProjectAllFieldsPredicate();
    Statement createViewStatementSelect00 = new SelectStatement("_sid0", createViewStatementSelectP00, null, "a", null, null);
    Statement createViewStatementParameters00 = new CreateViewStatement("v0", createViewStatementSelect00);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement00))).statement(), createViewStatementParameters00);
    String createViewStatement01 = " CREATE VIEW v1 AS SELECT f8, fa, fc, df, ff FROM j LIMIT 1 OFFSET 8; ";
    ProjectPredicate createViewStatementSelectP01 = new ProjectSomeFieldsPredicate(Arrays.asList("f8", "fa", "fc", "df", "ff"));
    Statement createViewStatementSelect01 = new SelectStatement("_sid0", createViewStatementSelectP01, null, "j", 1, 8);
    Statement createViewStatementParameters01 = new CreateViewStatement("v1", createViewStatementSelect01);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement01))).statement(), createViewStatementParameters01);
    String createViewStatement02 = " CREATE VIEW v2 AS SELECT e, KEYWORDMATCH([g4,g5], \"key0\") FROM o ;";
    ProjectPredicate createViewStatementSelectP02 = new ProjectSomeFieldsPredicate(Arrays.asList("e"));
    ExtractPredicate createViewStatementExtract02 = new KeywordExtractPredicate(Arrays.asList("g4", "g5"), "key0", null);
    Statement createViewStatementSelect02 = new SelectStatement("_sid0", createViewStatementSelectP02, createViewStatementExtract02, "o", null, null);
    Statement createViewStatementParameters02 = new CreateViewStatement("v2", createViewStatementSelect02);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement02))).statement(), createViewStatementParameters02);
    String createViewStatement03 = " CREATE VIEW v2 AS SELECT KEYWORDMATCH([g4,g5], \"key0\", substring) FROM o ;";
    ExtractPredicate createViewStatementExtract03 = new KeywordExtractPredicate(Arrays.asList("g4", "g5"), "key0", "substring");
    Statement createViewStatementSelect03 = new SelectStatement("_sid0", null, createViewStatementExtract03, "o", null, null);
    Statement createViewStatementParameters03 = new CreateViewStatement("v2", createViewStatementSelect03);
    Assert.assertEquals((new TextQLParser(string2InputStream(createViewStatement03))).statement(), createViewStatementParameters03);
}
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) 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) ProjectAllFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate) ProjectSomeFieldsPredicate(edu.uci.ics.textdb.textql.statements.predicates.ProjectSomeFieldsPredicate) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) TextQLParser(edu.uci.ics.textdb.textql.languageparser.TextQLParser) Test(org.junit.Test)

Example 9 with TextQLParser

use of edu.uci.ics.textdb.textql.languageparser.TextQLParser in project textdb by TextDB.

the class TextQLParserTest method testNumberLiteralToDouble.

/**
     * Test the numberLiteralToDouble method of the parser.
     * It should parse a NUMBER_LITERAL from the input and return it as a double.
     * @throws ParseException if an unexpected ParseException is thrown
     */
@Test
public void testNumberLiteralToDouble() throws ParseException {
    Assert.assertEquals((new TextQLParser(string2InputStream(" 0 "))).numberLiteralToDouble(), 0.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 12 "))).numberLiteralToDouble(), 12.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 34566 "))).numberLiteralToDouble(), 34566.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 78.90 "))).numberLiteralToDouble(), 78.90);
    Assert.assertEquals((new TextQLParser(string2InputStream(" 123. "))).numberLiteralToDouble(), 123.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" .456 "))).numberLiteralToDouble(), .456);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -0 "))).numberLiteralToDouble(), -0.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -12 "))).numberLiteralToDouble(), -12.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -34566 "))).numberLiteralToDouble(), -34566.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -78.90 "))).numberLiteralToDouble(), -78.90);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -123. "))).numberLiteralToDouble(), -123.);
    Assert.assertEquals((new TextQLParser(string2InputStream(" -.456 "))).numberLiteralToDouble(), -.456);
    assertException(() -> (new TextQLParser(string2InputStream(" -e "))).numberLiteralToDouble(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" -e 21"))).numberLiteralToDouble(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" +4 "))).numberLiteralToDouble(), TokenMgrError.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a 22 "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" a45 "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" A45 "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" FROM45 "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" \"4\" "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" /4/ "))).numberLiteralToDouble(), ParseException.class);
    assertException(() -> (new TextQLParser(string2InputStream(" /4 "))).numberLiteralToDouble(), TokenMgrError.class);
}
Also used : TextQLParser(edu.uci.ics.textdb.textql.languageparser.TextQLParser) Test(org.junit.Test)

Example 10 with TextQLParser

use of edu.uci.ics.textdb.textql.languageparser.TextQLParser in project textdb by TextDB.

the class TextQLParserTest method testExtractKeywordMatchPredicate.

/**
     * Test the extractKeywordMatchPredicate method of the parser.
     * It should parse an extract keyword predicate and return the expected KeywordExtractPredicate object.
     * @throws ParseException if an unexpected ParseException is thrown
     */
@Test
public void testExtractKeywordMatchPredicate() throws ParseException {
    String keywordMatchPredicate00 = " KEYWORDMATCH(g0, \"key1\") ";
    ExtractPredicate keywordMatchParameters00 = new KeywordExtractPredicate(Arrays.asList("g0"), "key1", null);
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate00))).extractKeywordMatchPredicate(), keywordMatchParameters00);
    String keywordMatchPredicate01 = " KEYWORDMATCH(g1, \"key2\", conjunction) ";
    ExtractPredicate keywordMatchParameters01 = new KeywordExtractPredicate(Arrays.asList("g1"), "key2", "conjunction");
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate01))).extractKeywordMatchPredicate(), keywordMatchParameters01);
    String keywordMatchPredicate02 = " KEYWORDMATCH(g2, \"key3\", phrase) ";
    ExtractPredicate keywordMatchParameters02 = new KeywordExtractPredicate(Arrays.asList("g2"), "key3", "phrase");
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate02))).extractKeywordMatchPredicate(), keywordMatchParameters02);
    String keywordMatchPredicate03 = " KEYWORDMATCH(g3, \"key4\", substring) ";
    ExtractPredicate keywordMatchParameters03 = new KeywordExtractPredicate(Arrays.asList("g3"), "key4", "substring");
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate03))).extractKeywordMatchPredicate(), keywordMatchParameters03);
    String keywordMatchPredicate04 = " KEYWORDMATCH([g4], \"key0\") ";
    ExtractPredicate keywordMatchParameters04 = new KeywordExtractPredicate(Arrays.asList("g4"), "key0", null);
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate04))).extractKeywordMatchPredicate(), keywordMatchParameters04);
    String keywordMatchPredicate05 = " KEYWORDMATCH([g4,g5], \"key0\") ";
    ExtractPredicate keywordMatchParameters05 = new KeywordExtractPredicate(Arrays.asList("g4", "g5"), "key0", null);
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate05))).extractKeywordMatchPredicate(), keywordMatchParameters05);
    String keywordMatchPredicate06 = " KEYWORDMATCH([g6,g7,h8,i9], \"key\") ";
    ExtractPredicate keywordMatchParameters06 = new KeywordExtractPredicate(Arrays.asList("g6", "g7", "h8", "i9"), "key", null);
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate06))).extractKeywordMatchPredicate(), keywordMatchParameters06);
    String keywordMatchPredicate07 = " KEYWORDMATCH([g6,g7,h8,i9], \"key\", substring) ";
    ExtractPredicate keywordMatchParameters07 = new KeywordExtractPredicate(Arrays.asList("g6", "g7", "h8", "i9"), "key", "substring");
    Assert.assertEquals((new TextQLParser(string2InputStream(keywordMatchPredicate07))).extractKeywordMatchPredicate(), keywordMatchParameters07);
    String keywordMatchPredicate08 = " KEYWORDMATCH ([i6,j7,l8,m9, \"key5\") ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate08))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate09 = " KEYWORDMATCH (i6,j7,l8,m9, \"key5\") ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate09))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate10 = " KEYWORDMATCH (i6,j7,l8,m9], \"key5\") ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate10))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate11 = " KEYWORDMATCH ([i6,j7,l8,m9, \"key5\", conjunction) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate11))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate12 = " KEYWORDMATCH (i6,j7,l8,m9, \"key5\", substring) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate12))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate13 = " KEYWORDMATCH ([i6,j7,l8,m9, \"key5\", phrase) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate13))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate14 = " KEYWORDMATCH ([], key5) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate14))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate15 = " KEYWORDMATCH ([a], key5) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate15))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate16 = " KEYWORDMATCH ([a]) ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate16))).extractKeywordMatchPredicate(), ParseException.class);
    String keywordMatchPredicate17 = " KEYWORDMATCH (\"key1\") ";
    assertException(() -> (new TextQLParser(string2InputStream(keywordMatchPredicate17))).extractKeywordMatchPredicate(), ParseException.class);
}
Also used : KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) ExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.ExtractPredicate) KeywordExtractPredicate(edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate) TextQLParser(edu.uci.ics.textdb.textql.languageparser.TextQLParser) Test(org.junit.Test)

Aggregations

TextQLParser (edu.uci.ics.textdb.textql.languageparser.TextQLParser)13 Test (org.junit.Test)13 ExtractPredicate (edu.uci.ics.textdb.textql.statements.predicates.ExtractPredicate)6 KeywordExtractPredicate (edu.uci.ics.textdb.textql.statements.predicates.KeywordExtractPredicate)6 CreateViewStatement (edu.uci.ics.textdb.textql.statements.CreateViewStatement)4 SelectStatement (edu.uci.ics.textdb.textql.statements.SelectStatement)4 Statement (edu.uci.ics.textdb.textql.statements.Statement)4 ProjectAllFieldsPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectAllFieldsPredicate)4 ProjectPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectPredicate)4 ProjectSomeFieldsPredicate (edu.uci.ics.textdb.textql.statements.predicates.ProjectSomeFieldsPredicate)4 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 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1