我尝试从特殊的经度和纬度获取所有 POI。
你能给我一个提示以获得更好的结果吗?我现在在我的结果集中得到了:Germany
和之类的主题。:M-Bahn
这是我的java代码:
public class DBPedia_SparqSql {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
float YOUR_LONG = 13.380834f;
float YOUR_LAT = 52.516388f;
float radius = 0.01f;
String sparqlQueryString1= "PREFIX owl: <http://www.w3.org/2002/07/owl#> "+
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "+
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "+
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+
"PREFIX foaf: <http://xmlns.com/foaf/0.1/> "+
"PREFIX dc: <http://purl.org/dc/elements/1.1/> "+
"PREFIX : <http://dbpedia.org/resource/> "+
"PREFIX dbpedia2: <http://dbpedia.org/property/> "+
"PREFIX dbpedia: <http://dbpedia.org/> "+
"PREFIX skos: <http://www.w3.org/2004/02/skos/core#> "+
"PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> "+
"PREFIX onto: <http://dbpedia.org/ontology/> " +
"PREFIX dcterms: <http://purl.org/dc/terms/> "+
"SELECT DISTINCT ?s ?sub ?long ?lat WHERE {"+
"?s a onto:Place . "+
"?s geo:lat ?lat . "+
"?s geo:long ?long . " +
"?s dcterms:subject ?sub "+
" FILTER ( ?long > "+(YOUR_LONG-radius)+"&& ?long < "+(YOUR_LONG+radius)+" && ?lat > "+(YOUR_LAT-radius)+" && ?lat < "+(YOUR_LAT+radius)+")}"+
"LIMIT 200";
System.out.println(sparqlQueryString1);
Query query = QueryFactory.create(sparqlQueryString1);
QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
ResultSet results = qexec.execSelect();
ResultSetFormatter.out(System.out, results, query);
qexec.close() ;
}
}