Is it possible to query data from a Model
without writing sqarql-queries? Adding properties to resources or resources to models can be done easily, but I haven't found out yet, if there is a more efficient way to query data from a Model
than using code the one below:
String sparql = "SELECT ?thing ?str WHERE { " +
"?thing a <" + THING + "> . " +
"?thing <" + HAS_STRING + "> ?str . " +
"FILTER (?str = \"" + s + "\") . }";
Query qry = QueryFactory.create(sparql);
QueryExecution qe = QueryExecutionFactory.create(qry, getModel());
ResultSet rs = qe.execSelect();
while(rs.hasNext())
{
QuerySolution sol = rs.nextSolution();
RDFNode str = sol.get("str");
RDFNode thing = sol.get("thing");
...
}
qe.close();