On 19/01/12 21:26, Paolo Castagna wrote:
Andy Seaborne wrote:
There is already a DBpedia example so we have included a
service-specific examples before. DBpedia is used by students and in
student projects so we do get a stream of questions about using it,
especially as it can be peculiar in its timeout behaviour.
Not very useful, but it shows users that you can specify query parameters
in the SERVICE<IRI>:
String queryString =
"SELECT * WHERE { " +
" SERVICE<http://dbpedia-live.openlinksw.com/sparql?timeout=10000>
{ " +
" SELECT DISTINCT ?company where {?company
a<http://dbpedia.org/ontology/Company>} LIMIT 20" +
" }" +
"}" ;
Query query = QueryFactory.create(queryString) ;
QueryExecution qexec = QueryExecutionFactory.create(query,
ModelFactory.createDefaultModel()) ;
try {
ResultSet rs = qexec.execSelect() ;
ResultSetFormatter.out(System.out, rs, query) ;
} finally {
qexec.close() ;
}
Maybe something like this is better (and it should not increase the number
of questions.
I do not know if the DBPedia service supports other query parameters that
could make the example more useful/interesting.
Paolo
Good use of DBpedia.
I think it's good to illustrate this with a use of setting the param via
the context (so the timeout is not in the query itself and can be
adjusted more easily). We can use such example code to test the
proposed patch.
Andy