class RdfEngine implements Engine {

    @Override
    public Set<Group> getGroups() {
        Set<Group> groups = new HashSet<>();
        try (RepositoryConnection conn = repository.getConnection()) {
            GraphQuery query = conn.prepareGraphQuery(GET_GROUPS_QUERY);
            Model groupsModel = QueryResults.asModel(query.evaluate(), mf);
            groups.addAll(groupFactory.getAllExisting(groupsModel));
        }
        return groups;
    }

}