This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LINQ-like extension for Java - SBQL4J

 
Emil Wcislo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Best Regards,
Emil

 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And Welcome to Javaranch!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting; I was wondering how long it would take for someone to take a stab at this with the OpenJDK.
 
Emil Wcislo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you please explain to me what is LINQ/SBQL4J?
A DSL for doing DB queries?
How it differs from -for example- HQL?
Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the project page? The difference is clear.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Emil Wcislo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've updated project webpage. I hope it's more clearly now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic