For my application I want to get the names and the geographic coordinates of most of settlements in Israel (Tel Aviv, Haife etc.).
My idea is to get it from DBpedia (querying the English pages is enough for me).
I tried this query:
SELECT distinct ?subject AS ?mainSubject ?o1 AS ?name ?o2 AS ?point ?o3 AS ?country
WHERE {?subject ?property <http://dbpedia.org/ontology/PopulatedPlace>.
?subject <http://xmlns.com/foaf/0.1/name> ?o1.
?subject <http://www.georss.org/georss/point> ?o2.
?subject <http://dbpedia.org/ontology/country> ?o3.
filter (contains(str(?o3),"Israel")) }
but I get only a few results.
For example I don't get :
Any ideas for better query?
Thanks.
You cannot get the results you want because they do not have georss information that you request. You can do it by OPTIONAL clause.
SELECT distinct ?subject AS ?mainSubject ?o1 AS ?name ?o2 AS ?point ?o3 AS ?country WHERE {
?subject ?property <http://dbpedia.org/ontology/PopulatedPlace>.
?subject <http://xmlns.com/foaf/0.1/name> ?o1.
OPTIONAL{?subject <http://www.georss.org/georss/point> ?o2.}
?subject <http://dbpedia.org/ontology/country> ?o3.
filter (contains(str(?o3),"Israel")) }
On the other hand, instead of FILTER you can directly put the resource of Israel:
SELECT distinct ?subject AS ?mainSubject ?o1 AS ?name ?o2 AS ?point WHERE {
?subject ?property <http://dbpedia.org/ontology/PopulatedPlace>.
?subject <http://xmlns.com/foaf/0.1/name ?o1.
OPTIONAL{?subject <http://www.georss.org/georss/point> ?o2.}
?subject <http://dbpedia.org/ontology/country> <http://dbpedia.org/resource/Israel>. }