@Test
    public void shouldGroup() {
        final Map<String,Long> x = (Map) g.sparql(
                "SELECT ?name (COUNT(?name) AS ?name_count)\n" +
                        "WHERE {\n" +
                        "    ?a e:created ?b .\n" +
                        "    ?a v:name ?name .\n" +
                        "}" +
                        "GROUP BY ?name").next();
        assertEquals(new Long(2), x.get("josh"));
        assertEquals(new Long(1), x.get("peter"));
        assertEquals(new Long(1), x.get("marko"));
        assertEquals(3, x.size());
    }
@author Stephen Mallette (http://stephen.genoprime.com)
sparql-gremlin/src/test/java/org/apache/tinkerpop/gremlin/sparql/process/traversal/dsl/sparql/SparqlTraversalSourceTest.java