results = executeSparqlFieldQuery(con,query, limit, true);
//parse the results and generate the Representations
//create an own valueFactors so that all the data of the query results
//are added to the same Sesame Model
Model model = new TreeModel();
RdfValueFactory valueFactory = new RdfValueFactory(model, sesameFactory);
List<Representation> representations = limit > 0 ? new ArrayList<Representation>(limit)
: new ArrayList<Representation>();
Map<String,URI> bindings = new HashMap<String,URI>(query.getFieldVariableMappings().size());
for(Entry<String,String> mapping : query.getFieldVariableMappings().entrySet()){
bindings.put(mapping.getValue(), sesameFactory.createURI(mapping.getKey()));
}
while(results.hasNext()){
BindingSet result = results.next();
Value value = result.getValue(query.getRootVariableName());
if(value instanceof URI){
URI subject = (URI) value;
//link the result with the query result
model.add(queryRoot, queryResult, subject);
//now copy over the other selected data
for(String binding : result.getBindingNames()){
URI property = bindings.get(binding);
if(property != null){
model.add(subject, property, result.getValue(binding));
} //else no mapping for the query.getRootVariableName()
}
//create a representation and add it to the results
representations.add(valueFactory.createRdfRepresentation(subject));
} //ignore non URI results
}
con.commit();
return new SesameQueryResultList(model, query, representations);
} catch (RepositoryException e) {