Given the announcement and press given elsewhere to Microsoft's LINQ technology, JoSQL seems to be an extension for Java that provides the same sort of ability of querying collections, albeit as an extension that's accessed via normal Java idioms rather than as a form of SQL embedded directly into the program text.
To compare, here's a LINQ example from TSS.net:
using System;Using JoSQL, the example is slightly longer, because of the need for the use of a Collection rather than an array, and because Java SE 5 was used. It also looks a little less elegant at first because the "SQL" isn't embedded into the program text directly:
using System.Query;
using System.Collections.Generic;
class App
{
static void Main() {
String[] names = {"Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
IEnumerable<string> expr = from s in names
where s.Length == 5
orderby s
select s.ToUpper();
foreach (string item in expr)
{
Console.WriteLine(item);
}
}
}
package com.theserverside.josql;One other consideration is that the examples aren't quite the same: the query from LINQ returns an upper-case version of the name, whereas JoSQL is unable to apply such a method to the selection (yet).
import java.util.*;
import org.josql.*;
public class App {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws QueryParseException, QueryExecutionException {
List<String> names=new ArrayList<String>();
String[] n={"Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
Collections.addAll(names, n);
Query q=new Query();
q.parse("select * from java.lang.String where length=5");
List<String> results=(List<String>)q.execute(names).getResults();
for(String name:results) {
System.out.println(name);
}
}
}
While at version 1.0, the release notes specify that the version numbers increment by 0.1 every release; the "1.0" isn't significant.