public static void main(String[] args) {
String shortQuery = Q.prefix("books", "http://example.org/books/")
.prefix("rdf", "http://example.org/rdf")
.select("?book ?authorName", new where() {
{
$("?book books:author ?author");
$("?author books:authorName ?authorName");
}
}).get();
System.out.println(shortQuery);
String longQuery = Q
.base("http://example.org/someWorldOntology#")
.prefix("rdf",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
.prefix("owl", "http://www.w3.org/2002/07/owl#")
.selectDistinct("?bookTitle ?authorName ?totalAmountOfBooks")
.from("http://example.org/books/fantasy")
.fromNamed("http://example.org/people", new where() {
{
select("SUM(?book) as ?totalAmountOfBooks",
new where() {
{
$(new group() {
{
$("?book rdf:type <Book>");
}