class RdfEngine implements Engine {

    @Override
    public Set<Role> getUserRoles(String username) {
        Optional<User> userOptional = retrieveUser(username);
        if (!userOptional.isPresent()) {
            throw new IllegalArgumentException("User with that id does not exist");
        }
        Set<Role> roles = new HashSet<>();
        try (RepositoryConnection conn = repository.getConnection()) {
            GraphQuery query = conn.prepareGraphQuery(GET_USER_ROLES_QUERY);
            query.setBinding(USER_BINDING, userOptional.get().getResource());
            Model rolesModel = QueryResults.asModel(query.evaluate(), mf);
            roles.addAll(roleFactory.getAllExisting(rolesModel));
            return roles;
        }
    }

}