This site provides SPARQL endpoint for obtaining statistics.
SPARQL is a RDF query language. GeoSPARQL, a SPARQL extension is a geospatial RDF query language.
In the SPARQL endpoint, statistical data is obtained by querying SPARQL or GeoSPARQL.
Usage for obtaining statistics using SPARQL endpoint is explained below. RDF schema is here.
- How to get statistics using SPARQL
- How to get geospatial data using GeoSPARQL
How to get statistics using SPARQL
The statistical LOD site provides sample queries. Using the query to obtain the population of Japanese in Shinjuku-ward, method for obtaining data is explained below.
Query to get the population of Shinjuku-ward
Line 2 is a SELECT phrase that specifies target data.
Line 3 through 10 describes search conditions. Search conditions are represented by triples (subject-predicate-object).
(A) is a triple that includes a target data variable.
The subject is cell ID. This is a query for obtaining population. As the cell ID is unknown, subject is also variable. Variables of cell ID and population is ?s and ?o respectively. While the SPARQL query searches both cell ID and population, because SELECT phrase of Line 2 specifies population (?o) as target data, only population data is returned as query result.
Line 5 and after set values of dimensions as objects and narrow search result.
(B) specifies area of search target. To specify the area Shinjuku-ward, two triples are used. Two triples are represented by one line using property pass "/". It is possible to describe two triples respectively as follows.
(C) narrows search result more.
Plural search conditions mean AND conditions in the above syntax. OR conditions are described using "UNION". An example of query using "UNION" is as shown below. The query is to obtain population of Shinjuku-ward by male population plus female population.
How to get geospatial data using GeoSPARQL
The statistical LOD privides small area and grid square data. As small areas and grid suares define polygon attributes, longitude and latitude specifies the small area and grid code.
Using the query to obtain the small area including the point at east longitude 139.48 and north latitude 35.92, method for obtaining data using GeoSPARQL is explained below.
Query to get the small area including the point at east longitude 139.48 and north latitude 35.92.
(A) narrows polygons by latitude and longitude.
In line 4, small area code is subject. Line 4 gets the URI which defines the polygon.
In line 7, URI gotten in line 4 is subject. Line 7 gets the polygon of the small area.
Line 8 narrows polygon in which the spot specified by longitude and latitude is located.
(B) obtains the name of the region.
Line 5 and 6 get the name of the small area and the municipality name respectively.