model.setNsPrefixes( source.getDefaultModel() );
model.setNsPrefixes( query.getPrefixMapping() );
Set set = new HashSet();
Template template = query.getConstructTemplate();
while( results.hasNext() ) {
Map bNodeMap = new HashMap();
Binding binding = results.nextBinding();
template.subst( set, bNodeMap, binding );
}
for( Iterator iter = set.iterator(); iter.hasNext(); ) {
Triple t = (Triple) iter.next();
Statement stmt = ModelUtils.tripleToStatement( model, t );