sparql - where to get data about all european cities, villages from? -
i looking data european cities, villages , towns. interested in name, postal codes, telephone area codes, latitude, longitude, population , country belongs to.
1. can extract comprehensive amount of data from?
2. how query data linkedgeodata
to begin with, tried extract data linkedgeodata ( http://linkedgeodata.org/sparql ). however, can't reasonable results. when following query executed, population occassionally appears, other fields left blank.
select * { ?place <http://linkedgeodata.org/ontology/place> . optional { ?place <http://linkedgeodata.org/property/opengeodb:name> ?name . } optional { ?place <http://linkedgeodata.org/ontology/opengeodb:lat> ?lat . } optional { ?place <http://linkedgeodata.org/ontology/opengeodb:lon> ?lon . } optional { ?place <http://linkedgeodata.org/property/opengeodb:postal_codes> ?postal . } optional { ?place <http://linkedgeodata.org/ontology/opengeodb:telephone_area_code> ?tel . } optional { ?place <http://linkedgeodata.org/ontology/population> ?population . } optional { ?place <http://linkedgeodata.org/ontology/opengeodb:is_in_loc_id> ?inlocid . } ?place <http://linkedgeodata.org/property/is_in> ?in. filter ( regex(?in, "europe", "i") ) . }
i noticed properties containing opengeodb
blank, although properties exist. wrong query?
for finding appropriated datasets may have @ dataset catalogue á la the data hub or data q&a boards á la get data.
re. second questions, seems data @ linkedgeodata seems bit sparse, or 1 has utilise other properties and/or classes. however, following query seems deliver @ least results, can see every place in europe can addressed via lgdb:is_in property
prefix lgd:<http://linkedgeodata.org/> prefix lgdo:<http://linkedgeodata.org/ontology/> prefix lgdp:<http://linkedgeodata.org/property/> prefix lgdoogdb: <http://linkedgeodata.org/ontology/opengeodb> prefix lgdpogdb: <http://linkedgeodata.org/property/opengeodb> select * <http://linkedgeodata.org> { ?place lgdo:place . optional { ?place lgdpogdb:name ?name . } optional { ?place lgdoogdb:lat ?lat . } optional { ?place lgdoogdb:lon ?lon . } optional { ?place lgdpogdb:postal_codes ?postal . } optional { ?place lgdoogdb:telephone_area_code ?tel . } optional { ?place lgdo:population ?population . } optional { ?place lgdoogdb:is_in_loc_id ?inlocid . } optional { ?place lgdp:is_in ?in . } } limit 100
with e.g. following query explore dataset's structure bit:
prefix lgdo:<http://linkedgeodata.org/ontology/> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> select * <http://linkedgeodata.org> { ?place lgdo:place . ?place rdfs:label ?label . } limit 100
... , following query returns 100 places in europe:
prefix lgdo:<http://linkedgeodata.org/ontology/> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> select * <http://linkedgeodata.org> { ?place lgdo:place . ?place rdfs:label ?label . ?place <http://linkedgeodata.org/property/is_in%3acontinent> "europe" . filter ( lang(?label) = "" ) } limit 100
please note filter expression filtering out every language specific label has language tag, i.e., plain literals displayed query.
Comments
Post a Comment