Author: fguillaume
Date: Mon Apr 26 14:47:18 2010
New Revision: 938069
URL: http://svn.apache.org/viewvc?rev=938069&view=rev
Log:
CMIS-195: incorporate Chemistry Query Parser into OpenCMIS
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLLexer.g
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLParser.g
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/CMISQL.testsuite
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml
incubator/chemistry/opencmis/trunk/pom.xml
Modified:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml?rev=938069&r1=938068&r2=938069&view=diff
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml
(original)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml
Mon Apr 26 14:47:18 2010
@@ -31,6 +31,69 @@
<artifactId>chemistry-opencmis-commons-impl</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ <version>3.1.3</version>
+ </dependency>
</dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>target/generated-resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- default phase: process-sources -->
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>antlr</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase> <!-- after
process-sources -->
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <resources>
+ <resource>
+
<directory>target/generated-sources/antlr3</directory>
+ <includes>
+ <!-- don't include lexer tokens, which
are identical -->
+ <include>*Parser.tokens</include>
+ </includes>
+ </resource>
+ </resources>
+
<outputDirectory>target/generated-resources/org/apache/chemistry/opencmis/server/support/query</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>maven-gunit-plugin</artifactId>
+ <executions>
+ <execution>
+ <!-- default phase: test -->
+ <goals>
+ <goal>gunit</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLLexer.g
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLLexer.g?rev=938069&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLLexer.g
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLLexer.g
Mon Apr 26 14:47:18 2010
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ * Stefane Fermigier, Nuxeo
+ * Florent Guillaume, Nuxeo
+ */
+/**
+ * CMISQL lexer.
+ */
+lexer grammar CMISQLLexer;
+
+tokens {
+ TABLE;
+ COL;
+ LIST;
+ FUNC;
+ UN_OP;
+ BIN_OP;
+ BIN_OP_ANY;
+ NOT_IN;
+ NOT_LIKE;
+ IS_NULL;
+ IS_NOT_NULL;
+ ORDER_BY;
+}
+
+...@header {
+/*
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ * Stefane Fermigier, Nuxeo
+ * Florent Guillaume, Nuxeo
+ *
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ */
+package org.apache.chemistry.opencmis.server.support.query;
+}
+
+// ----- Generic SQL -----
+
+SELECT : ('S'|'s')('E'|'e')('L'|'l')('E'|'e')('C'|'c')('T'|'t');
+DISTINCT :
('D'|'d')('I'|'i')('S'|'s')('T'|'t')('I'|'i')('N'|'n')('C'|'c')('T'|'t');
+FROM : ('F'|'f')('R'|'r')('O'|'o')('M'|'m');
+AS : ('A'|'a')('S'|'s');
+JOIN : ('J'|'j')('O'|'o')('I'|'i')('N'|'n');
+INNER : ('I'|'i')('N'|'n')('N'|'n')('E'|'e')('R'|'r');
+OUTER : ('O'|'o')('U'|'u')('T'|'t')('E'|'e')('R'|'r');
+LEFT : ('L'|'l')('E'|'e')('F'|'f')('T'|'t');
+RIGHT : ('R'|'r')('I'|'i')('G'|'g')('H'|'h')('T'|'t');
+ON : ('O'|'o')('N'|'n');
+WHERE : ('W'|'w')('H'|'h')('E'|'e')('R'|'r')('E'|'e');
+ORDER : ('O'|'o')('R'|'r')('D'|'d')('E'|'e')('R'|'r');
+BY : ('B'|'b')('Y'|'y');
+ASC : ('A'|'a')('S'|'s')('C'|'c');
+DESC : ('D'|'d')('E'|'e')('S'|'s')('C'|'c');
+
+// ----- Operators -----
+
+IS : ('I'|'i')('S'|'s');
+NULL : ('N'|'n')('U'|'u')('L'|'l')('L'|'l');
+AND : ('A'|'a')('N'|'n')('D'|'d');
+OR : ('O'|'o')('R'|'r');
+NOT : ('N'|'n')('O'|'o')('T'|'t');
+IN : ('I'|'i')('N'|'n');
+LIKE : ('L'|'l')('I'|'i')('K'|'k')('E'|'e');
+ANY : ('A'|'a')('N'|'n')('Y'|'y');
+CONTAINS :
('C'|'c')('O'|'o')('N'|'n')('T'|'t')('A'|'a')('I'|'i')('N'|'n')('S'|'s');
+SCORE : ('S'|'s')('C'|'c')('O'|'o')('R'|'r')('E'|'e');
+IN_FOLDER :
('I'|'i')('N'|'n')'_'('F'|'f')('O'|'o')('L'|'l')('D'|'d')('E'|'e')('R'|'r');
+IN_TREE : ('I'|'i')('N'|'n')'_'('T'|'t')('R'|'r')('E'|'e')('E'|'e');
+TIMESTAMP : 'TIMESTAMP'|'timestamp';
+
+STAR : '*';
+LPAR : '(';
+RPAR : ')';
+COMMA : ',';
+DOT : '.';
+EQ : '=';
+NEQ : '<>';
+LT : '<';
+GT : '>';
+LTEQ : '<=';
+GTEQ : '>=';
+
+// ----- Literals -----
+
+BOOL_LIT : 'TRUE' | 'true' | 'FALSE' | 'false';
+
+fragment Sign : ('+'|'-')?;
+fragment Digits : ('0'..'9')+;
+fragment ExactNumLit : Digits DOT Digits | Digits DOT | DOT Digits | Digits;
+fragment ApproxNumLit : ExactNumLit ('e'|'E') Sign Digits;
+NUM_LIT : Sign (ExactNumLit | ApproxNumLit);
+
+STRING_LIT : '\'' (~'\''|'\'\'')* '\'';
+
+WS : ( ' ' | '\t' | '\r'? '\n' )+ { $channel=HIDDEN; };
+
+TIME_LIT : TIMESTAMP WS STRING_LIT;
+
+ID :
+ ('a'..'z'|'A'..'Z'|'_')
+ ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|':')*
+ ;
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLParser.g
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLParser.g?rev=938069&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLParser.g
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CMISQLParser.g
Mon Apr 26 14:47:18 2010
@@ -0,0 +1,274 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ * Stefane Fermigier, Nuxeo
+ * Florent Guillaume, Nuxeo
+ */
+/**
+ * CMISQL parser.
+ */
+parser grammar CMISQLParser;
+
+options {
+ tokenVocab = CMISQLLexer;
+ output = AST;
+}
+
+...@header {
+/*
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ * Stefane Fermigier, Nuxeo
+ * Florent Guillaume, Nuxeo
+ *
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ */
+package org.apache.chemistry.opencmis.server.support.query;
+}
+
+...@members {
+ public String errorMessage;
+
+ @Override
+ public void displayRecognitionError(String[] tokenNames,
+ RecognitionException e) {
+ if (errorMessage == null) {
+ String hdr = getErrorHeader(e);
+ String msg = getErrorMessage(e, tokenNames);
+ errorMessage = hdr + " " + msg;
+ }
+ }
+}
+
+query: SELECT^ DISTINCT? select_list from_clause where_clause?
order_by_clause?;
+
+select_list
+ : STAR
+ | select_sublist ( COMMA select_sublist )*
+ -> ^(LIST select_sublist+)
+ ;
+
+select_sublist
+ : value_expression ( AS!? column_name )?
+ | qualifier DOT STAR
+ //| multi_valued_column_reference
+ ;
+
+value_expression:
+ column_reference
+ | string_value_function
+ | numeric_value_function
+ ;
+
+column_reference:
+ ( qualifier DOT )? column_name
+ -> ^(COL qualifier? column_name)
+ ;
+
+multi_valued_column_reference:
+ ( qualifier DOT )? multi_valued_column_name
+ -> ^(COL qualifier? multi_valued_column_name)
+ ;
+
+string_value_function:
+ ID LPAR column_reference RPAR
+ -> ^(FUNC ID column_reference)
+ ;
+
+numeric_value_function:
+ f=SCORE LPAR RPAR -> ^(FUNC $f);
+
+qualifier:
+ table_name
+ //| correlation_name
+ ;
+
+from_clause: FROM^ table_reference;
+
+table_reference:
+ one_table table_join*
+ ;
+
+table_join:
+ join_kind one_table join_specification?
+ -> ^(JOIN join_kind one_table join_specification?)
+ ;
+
+one_table:
+ LPAR! table_reference RPAR!
+ | table_name
+ -> ^(TABLE table_name)
+ | table_name AS? correlation_name
+ -> ^(TABLE table_name correlation_name)
+ ;
+
+join_kind:
+ JOIN
+ -> INNER
+ | INNER JOIN
+ -> INNER
+ | LEFT OUTER? JOIN
+ -> LEFT
+ | RIGHT OUTER? JOIN
+ -> RIGHT
+ ;
+
+join_specification:
+ ON^ column_reference EQ column_reference
+ ;
+
+where_clause: WHERE^ search_condition;
+
+search_condition:
+ boolean_term ( OR boolean_term )*;
+
+boolean_term:
+ boolean_factor ( AND boolean_factor )*;
+
+boolean_factor:
+ NOT? boolean_test;
+
+boolean_test:
+ predicate
+ | LPAR search_condition RPAR
+ ;
+
+predicate:
+ comparison_predicate
+ | in_predicate
+ | like_predicate
+ | null_predicate
+ | quantified_comparison_predicate
+ | quantified_in_predicate
+ | text_search_predicate
+ | folder_predicate
+ ;
+
+comparison_predicate:
+ value_expression comp_op literal
+ -> ^(BIN_OP comp_op value_expression literal)
+ ;
+
+comp_op:
+ EQ | NEQ | LT | GT | LTEQ | GTEQ;
+
+literal:
+ NUM_LIT
+ | STRING_LIT
+ | TIME_LIT
+ | BOOL_LIT
+ ;
+
+in_predicate:
+ column_reference IN LPAR in_value_list RPAR
+ -> ^(BIN_OP IN column_reference in_value_list)
+ | column_reference NOT IN LPAR in_value_list RPAR
+ -> ^(BIN_OP NOT_IN column_reference in_value_list)
+ ;
+
+in_value_list:
+ literal ( COMMA literal )*
+ -> ^(LIST literal+)
+ ;
+
+like_predicate:
+ column_reference LIKE STRING_LIT
+ -> ^(BIN_OP LIKE column_reference STRING_LIT)
+ | column_reference NOT LIKE STRING_LIT
+ -> ^(BIN_OP NOT_LIKE column_reference STRING_LIT)
+ ;
+
+null_predicate:
+ // second alternative commented out to remove left recursion for now.
+ //( column_reference | multi_valued_column_reference ) 'IS' 'NOT'? 'NULL';
+ column_reference IS
+ ( NOT NULL -> ^(UN_OP IS_NOT_NULL column_reference)
+ | NULL -> ^(UN_OP IS_NULL column_reference)
+ )
+ ;
+
+quantified_comparison_predicate:
+ literal comp_op ANY multi_valued_column_reference
+ -> ^(BIN_OP_ANY comp_op literal multi_valued_column_reference)
+ ;
+
+quantified_in_predicate:
+ ANY multi_valued_column_reference
+ ( NOT IN LPAR in_value_list RPAR
+ -> ^(BIN_OP_ANY NOT_IN in_value_list multi_valued_column_reference)
+ | IN LPAR in_value_list RPAR
+ -> ^(BIN_OP_ANY IN in_value_list multi_valued_column_reference)
+ )
+ ;
+
+text_search_predicate:
+ CONTAINS LPAR (qualifier COMMA)? text_search_expression RPAR
+ -> ^(FUNC CONTAINS qualifier? text_search_expression)
+ ;
+
+folder_predicate:
+ ( f=IN_FOLDER | f=IN_TREE ) LPAR (qualifier COMMA)? folder_id RPAR
+ -> ^(FUNC $f qualifier? folder_id)
+ ;
+
+order_by_clause:
+ ORDER BY sort_specification ( COMMA sort_specification )*
+ -> ^(ORDER_BY sort_specification+)
+ ;
+
+sort_specification:
+ column_reference -> column_reference ASC
+ | column_reference ( ASC | DESC )
+ ;
+
+correlation_name:
+ ID;
+
+table_name:
+ ID;
+
+column_name:
+ ID;
+
+multi_valued_column_name:
+ ID;
+
+folder_id:
+ STRING_LIT;
+
+text_search_expression:
+ STRING_LIT;
Added:
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/CMISQL.testsuite
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/CMISQL.testsuite?rev=938069&view=auto
==============================================================================
---
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/CMISQL.testsuite
(added)
+++
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/gunit/org/apache/chemistry/opencmis/server/support/query/CMISQL.testsuite
Mon Apr 26 14:47:18 2010
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ * Stefane Fermigier, Nuxeo
+ * Florent Guillaume, Nuxeo
+ */
+gunit CMISQL;
+
+...@header{
+package org.apache.chemistry.opencmis.server.support.query;
+}
+
+// ----- Lexer tests -----
+
+ID:
+"a" OK
+"!" FAIL
+"toto" OK
+"toto123" OK
+"toto123_" OK
+"_foo" OK
+"foo:bar" OK
+"123" FAIL
+"123abc" FAIL
+
+NUM_LIT:
+"123" OK
+"0" OK
+"-0" OK
+"1" OK
+"-1" OK
+"-123" OK
+"0123" OK
+"-0123" OK
+"123abc" FAIL
+"123E" FAIL
+"123.456" OK
+"+123.456" OK
+"-123.456" OK
+".456" OK
+"+.456" OK
+"-.456" OK
+"123." OK
+"+123." OK
+"-123." OK
+"+123.456E78" OK
+"-123.456E-78" OK
+".456E78" OK
+"+123.E+78" OK
+
+STRING_LIT:
+"'abc'" OK
+"'a''bc'" OK
+"'abc" FAIL
+"abc'" FAIL
+"'ab'c'" FAIL
+
+BOOL_LIT:
+"TRUE" OK
+"true" OK
+"FALSE" OK
+"false" OK
+
+TIME_LIT:
+"TIMESTAMP '2010-01-01Z01:01:01.000Z'" OK
+"timestamp '123'" OK
+"TIMESTAMP 123" FAIL
+
+// ----- Parser tests -----
+
+literal:
+"123" OK
+"-123" OK
+"0" OK
+"0123" OK
+"abc123" OK
+"123abc" FAIL
+"'abc'" OK
+"123.345E78" OK
+
+order_by_clause:
+"ORDER BY foo" -> (ORDER_BY (COL foo) ASC)
+"ORDER BY foo ASC" -> (ORDER_BY (COL foo) ASC)
+"ORDER BY foo DESC" -> (ORDER_BY (COL foo) DESC)
+"ORDER BY t.foo, bar DESC" -> (ORDER_BY (COL t foo) ASC (COL bar) DESC)
+
+column_reference:
+"foo" -> (COL foo)
+"bar.foo" -> (COL bar foo)
+
+from_clause:
+"FROM foo JOIN bar ON x = y" -> (FROM (TABLE foo) (JOIN INNER (TABLE bar) (ON
(COL x) = (COL y))))
+
+table_join:
+"LEFT OUTER JOIN foo ON x = y" -> (JOIN LEFT (TABLE foo) (ON (COL x) = (COL
y)))
+"INNER JOIN foo" -> (JOIN INNER (TABLE foo))
+
+one_table:
+"foo" -> (TABLE foo)
+"foo bar" -> (TABLE foo bar)
+"foo AS bar" -> (TABLE foo bar)
+"(foo)" -> (TABLE foo)
+
+in_predicate:
+"foo IN ( 'a', 'b', 'c')" -> (BIN_OP IN (COL foo) (LIST 'a' 'b' 'c'))
+"foo NOT IN ( 1, 2, 3)" -> (BIN_OP NOT_IN (COL foo) (LIST 1 2 3))
+
+quantified_in_predicate:
+"ANY foo IN ('a', 1)" -> (BIN_OP_ANY IN (LIST 'a' 1) (COL foo))
+
+comparison_predicate:
+"foo = 1" -> (BIN_OP = (COL foo) 1)
+"foo <> 1" -> (BIN_OP <> (COL foo) 1)
+
+predicate:
+"foo = 1" -> (BIN_OP = (COL foo) 1)
+"foo IN ('bar')" -> (BIN_OP IN (COL foo) (LIST 'bar'))
+"foo IS NULL" -> (UN_OP IS_NULL (COL foo))
+"foo IS NOT NULL" -> (UN_OP IS_NOT_NULL (COL foo))
+"1 = ANY foo" -> (BIN_OP_ANY = 1 (COL foo))
+"LOWER(foo) = 'bar'" -> (BIN_OP = (FUNC LOWER (COL foo)) 'bar')
+"quux(foo) = 'bar'" -> (BIN_OP = (FUNC quux (COL foo)) 'bar')
+
+folder_predicate:
+"IN_FOLDER(foo,'ID123')" -> (FUNC IN_FOLDER foo 'ID123')
+"IN_FOLDER('ID123')" -> (FUNC IN_FOLDER 'ID123')
+"IN_TREE(foo,'ID123')" -> (FUNC IN_TREE foo 'ID123')
+"IN_TREE('ID123')" -> (FUNC IN_TREE 'ID123')
+
+text_search_predicate:
+"CONTAINS('foo')" -> (FUNC CONTAINS 'foo')
+"CONTAINS(bar, 'foo')" -> (FUNC CONTAINS bar 'foo')
+
+where_clause:
+"WHERE foo = 1" -> (WHERE (BIN_OP = (COL foo) 1))
+"WHERE a = 1 AND b <> 2 OR c >= 3 AND NOT d <= 4" -> (WHERE (BIN_OP = (COL a)
1) AND (BIN_OP <> (COL b) 2) OR (BIN_OP >= (COL c) 3) AND NOT (BIN_OP <= (COL
d) 4))
+
+query:
+"SELECT * FROM Document" -> (SELECT * (FROM (TABLE Document)))
+"SELECT a, b, c FROM Document" -> (SELECT (LIST (COL a) (COL b) (COL c)) (FROM
(TABLE Document)))
+"SELECT a, b FROM Document ORDER BY a, b" -> (SELECT (LIST (COL a) (COL b))
(FROM (TABLE Document)) (ORDER_BY (COL a) ASC (COL b) ASC))
+"SELECT DISTINCT a, b, c FROM Document" -> (SELECT DISTINCT (LIST (COL a) (COL
b) (COL c)) (FROM (TABLE Document)))
+
+
+// Examples from the specs.
+
+<<
+SELECT TITLE, AUTHORS, DATE
+FROM WHITE_PAPER
+WHERE ( IN_TREE('ID00093854763') ) AND ( 'SMITH' = ANY AUTHORS )
+>> -> (SELECT (LIST (COL TITLE) (COL AUTHORS) (COL DATE)) (FROM (TABLE
WHITE_PAPER)) (WHERE ( (FUNC IN_TREE 'ID00093854763') ) AND ( (BIN_OP_ANY =
'SMITH' (COL AUTHORS)) )))
+
+<<
+SELECT OBJECT_ID, SCORE() AS X, DESTINATION, DEPARTURE_DATES
+FROM TRAVEL_BROCHURE
+WHERE ( CONTAINS('CARIBBEAN CENTRAL AMERICA CRUISE TOUR') ) AND
+ ( '2010-1-1' < ANY DEPARTURE_DATES )
+ORDER BY X DESC
+>> OK
+
+<<
+SELECT *
+FROM CAR_REVIEW
+WHERE ( LOWER(MAKE) = 'buick' ) OR
+ ( ANY FEATURES IN ('NAVIGATION SYSTEM', 'SATELLITE RADIO', 'MP3' ) )
+>> OK
+
+<<
+SELECT Y.CLAIM_NUM, X.PROPERTY_ADDRESS, Y.DAMAGE_ESTIMATES
+FROM POLICY AS X JOIN CLAIMS AS Y ON X.POLICY_NUM = Y.POLICY_NUM
+WHERE ( 100000 <= ANY Y.DAMAGE_ESTIMATES ) AND ( Y.CAUSE NOT LIKE '%Katrina%' )
+>> OK
Modified: incubator/chemistry/opencmis/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/pom.xml?rev=938069&r1=938068&r2=938069&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/pom.xml (original)
+++ incubator/chemistry/opencmis/trunk/pom.xml Mon Apr 26 14:47:18 2010
@@ -171,6 +171,20 @@
</properties>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <version>3.1.3-1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>maven-gunit-plugin</artifactId>
+ <version>3.1.3</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<inherited>true</inherited>