Hello,
I'd like to invite You to see my new open-source library SBQL4J.
It's a query language which provides capabilities similar to Microsoft LINQ for .net technology.
Project home Any comments are welcome.
Interesting; I was wondering how long it would take for someone to take a stab at this with the OpenJDK.
Emil Wcislo
Greenhorn
Joined: Mar 19, 2010
Posts: 4
posted
0
David Newton wrote:Interesting; I was wondering how long it would take for someone to take a stab at this with the OpenJDK.
The OpenJDK Compiler is well-written, so the code was quite readable for me, but Java code parser is written "by hand". No grammar compiler (like Java Cup) were used to write it. So it taked me one day or two to add new clause (queries are surrounded by #{ } ) to parser.
This message was edited 1 time. Last update was at by Emil Wcislo
I didn't get what it is.
A DSL for dealing with DB, a DSL for filtering collections? code generator?
Sorry but I didn't get it.
I'm sleepy, maybe this is why :p
Emil Wcislo
Greenhorn
Joined: Mar 19, 2010
Posts: 4
posted
0
SBQL4J is an extension to Java language to provide query language for processing Java objects.
Not only filtering is possible, but also more sophisticated operators are build-in, like aggregating and joining.
Available operators:
- arythmetic: +, -. *, /, %, == , != , >, <, >=, <=, OR, AND, NOT, INSTANCEOF
- aggregating: SUM, COUNT, AVG, MIN, MAX
- set operators: UNION, INTERSECT, UNIQUE, MINUS, IN, ',' (comma - cartesian product)
- quantifiers: ALL, ANY
- non-algerbraic operators . (dot - projection) , WHERE, JOIN, ORDER BY, CLOSE BY (transitive closure - sth like CONNECT BY in Oracle)
Also invoking Java methods and constructors is possible inside queries.
SBQL4J follow software engineering principles such as orthogonality, modularity, minimality, universality, typing safety, and clean, precise semantics.
It integrates tightly with Java which means:
- Java variables can be used in queries directly (no special syntax like setParameterX is required).
- Queries returns Java objects.
- Java methods and constructors can be invoked inside queries.
- Query language is type-safe - queries are checked in compile time.
- Queries can be translated to pure Java code (with no reflection usage) so execution is very fast.
SBQL4J gives Java developers full power of SBQL language (http://sbql.pl/overview/). Multiply nested and complicated queries are well-supported, which can't be written in any other query language (including LINQ).
This message was edited 1 time. Last update was at by Emil Wcislo