I am querying for integer result using a SPARQL Query:
String qString =
"SELECT (COUNT(?S) AS ?C) "+
"WHERE "+
"{ "+
"?S <"+p1+"> ?O ."+
"?S <"+p2+"> ?O ."+
"} ";
Query q = QueryFactory.create(PREFIX+qString);
QueryExecution qExecution = QueryExecutionFactory.sparqlService(ENDPOINT, q);
ResultSet qResults = qExecution.execSelect();
if(qResults.hasNext()){
QuerySolution thisRow = qResults.next();
int C = thisRow.get("C").toString();
}
Problem is that the get() function would return only string outputs using toString(). I need an int output. How do I go about doing that?