While trying to search for the answer - I've found out that the ANTLR seems to be the standard/reference implementation for the generic task of implementing the Query Language.
And it seems that everyone facing the task is doing same - learning what ANTLR is, how to configure it, how to use it and then building their own implementation of the QL.
Isn't there a free/open example or a reference implementation of a basic/common Query Language (like the one used in Hibernate or Cassandra, which are actually using ANTLR behind the scenes) or the "where" part of a regular SQL? I DO believe it's a very common task for many projects and it's a shame if everyone is re-implementing it from scratch (implying the ANTLR learning-curve).
For example here: Implementing free form query language in Java the accepted answer says:
The problem is that there is no such thing as a generic query language. Each one is different, and yours is no exception
I would disagree with the above statement, since SQL, Cassandra's QL and HibernateQL share more than 90% of similarities, so there is a common part between those - the one I'm looking for with a hope to not-re-implement-the-wheel...
Any level of comprehensiveness between following examples would be fine:
Level 1:
- "x=1"
- "x=2"
- "x=3"
Query/Filter: "x>1", expected result: 2 and 3
Level 2:
- "x=1 and y=1"
- "x=2 and y=2"
- "x=3 and y=3"
Query/Filter: "x>1 and y<3", expected result: 2
Level 3:
- "x=1 and y=1"
- "x=2 and y=2"
- "x=3 and y=3"
Query/Filter: "x>1 and (y<2 or y>3)", expected result: 2
...
Level N:
- "x=1 and y=1"
- "x=2 and y=2"
- "x=3 and y='3|4|5'"
Query/Filter: "(x>2 or x in ('z',1)) and (y in (1,2) or (y like '%3%' and y like '%5%'))" Expected result: 1 and 3
Question: is there an existing (ANTLR based or not) Java solution (extensible or not) which is usable (as a framework or as example to build/expand) as a Query/Filter engine for above-like examples?
P.S. did some "homework" here, but none seems to answer my particular topic... maybe it's just too much to expect in 2019 :)