Skip to content

Instantly share code, notes, and snippets.

@shellac
Created May 25, 2010 15:17
Show Gist options
  • Save shellac/413250 to your computer and use it in GitHub Desktop.
Save shellac/413250 to your computer and use it in GitHub Desktop.
Op op = constraintsToOp(constraints);
// Using count(*) -- lost!
E_Aggregator agg = new E_Aggregator("name", AggCount.get().create());
op = new OpGroupAgg(op, new VarExprList(), Collections.singletonList(agg));
Query q = OpAsQuery.asQuery(op);
Op op = constraintsToOp(constraints);
Query q = OpAsQuery.asQuery(op);
q.setQuerySelectType();
q.setQueryResultStar(false);
E_Aggregator agg = q.allocAggregate(AggCount.get());
q.addResultVar("count", agg);
q.addProjectVars(Arrays.asList(Var.alloc("count")));
QueryExecution qe = qef.get(q);
ResultSet r = qe.execSelect();
int count = r.next().getLiteral("count").getInt();
qe.close();
(join
(graph ?v34
(filter (&& (<= "5"^^<http://www.w3.org/2001/XMLSchema#int> ?v33) (< ?v33 "9"^^<http://www.w3.org/2001/XMLSchema#int>))
(bgp (triple ?s <http://example.com/ns#range> ?v33))))
(graph ?v36
(filter (regex (str ?v35) "^x" "i")
(bgp (triple ?s <http://example.com/ns#label> ?v35)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment