sparqlQuery = QueryParser.getInstance().parse(sparqlQueryString);
} catch (ParseException e) {
log.error("ParseException for SPARQL Query in findRepresentation");
log.error("FieldQuery: "+query);
log.error("SPARQL Query: "+sparqlQueryString);
throw new YardException("Unable to parse SPARQL query generated for the parse FieldQuery",e);
}
Object resultObject = tcManager.executeSparqlQuery(sparqlQuery, graph);
final MGraph resultGraph;
if(resultObject instanceof MGraph){
resultGraph = (MGraph)resultObject;
} else if(resultObject instanceof Graph){
resultGraph = new IndexedMGraph();
resultGraph.addAll((Graph)resultObject);
} else {
log.error("Unable to create "+MGraph.class+" instance for query reults of type "+resultObject.getClass()+" (this indicates that the used SPARQL Query was not of type CONSTRUCT)");
log.error("FieldQuery: "+query);
log.error("SPARQL Query: "+sparqlQueryString);
throw new YardException("Unable to process results of Query");
}
return new RdfQueryResultList(query, resultGraph);
}