Wiki source code of AQL Parser
Last modified by superadmin on 2026/10/14 18:44
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
2.1 | 1 | AQL (Atlassian Query Language) is the family of query language to which CQL (Confluence Query Language) and JQL (Jira Query Language) belong. |
| |
1.1 | 2 | |
| 3 | Our AQL Parser module parses this syntax and lets you implement languages of this family. Our [[CQL Query module does this>>doc:documentation.extensions.dev.cql.query.WebHome]]. | ||
| |
2.1 | 4 | |
| 5 | For a description of how this module was designed, please see [[xwiki:documentation.extensions.dev.cql.aql-parser.design.WebHome]]. | ||
| 6 | |||
| 7 | = Basic usage = | ||
| 8 | |||
| |
3.1 | 9 | This module is intended to be used with the [[Query>>doc:documentation.extensions.dev.cql.query.WebHome]] module. However, if you indeed want to deal with the Abstract Syntax Tree produced by the AQL parser, here's how to parse an AQL statement: |
| |
2.1 | 10 | |
![]() |
3.3 | 11 | {{code language="java"}} |
| |
2.1 | 12 | import java.io.IOException; |
| 13 | |||
| 14 | import javax.inject.Inject; | ||
| 15 | import javax.inject.Singleton; | ||
| 16 | |||
| 17 | import org.xwiki.component.annotation.Component; | ||
| 18 | import org.xwiki.contrib.cql.aqlparser.AQLParser; | ||
| 19 | import org.xwiki.contrib.cql.aqlparser.ast.AQLStatement; | ||
| 20 | import org.xwiki.contrib.cql.aqlparser.exceptions.ParserException; | ||
| 21 | |||
| 22 | @Component (roles = DefaultScratch.class) | ||
| 23 | @Singleton | ||
| 24 | class DefaultScratch | ||
| 25 | { | ||
| 26 | public void example() throws ParserException, IOException | ||
| 27 | { | ||
| 28 | AQLStatement cql = AQLParser.parse( "title = 'Main'"); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | {{/code}} | ||
| 32 | |||
| 33 | See the [[list of nodes that can be produced by the parser>>https://github.com/xwiki-contrib/cql/tree/master/aqlparser/src/main/java/org/xwiki/contrib/cql/aqlparser/ast]]. | ||
| 34 |
