< Research in programming Wikidata

This article is devoted to the study of the Wikidata objects "National Park". With the help of SPARQL queries, computed on the objects of the "national park" type in the Wikidata, the following tasks were solved: a list of all the existing national parks, a list of national parks, ordered by date of creation, a diagram of parks ordered by quantity for different years and by countries World, as well as a map of all national parks, built on the basis of geographical coordinates.

Instances of the object "National park"

Let's build a list of all national parks.

#added 2017-02
#List of `instances of` "national park" 
SELECT ?park ?parkLabel
WHERE
{
    ?park wdt:P31 wd:Q46169.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

SPARQL-query, 1665 records.

πŸ‘The most complete and elaborated national parks on the Wikidata are: Teide, Þingvellir, Alejandro de Humboldt National Park

πŸ‘ŽAlmost empty and uninformative national parks on the Wikidata are: Pripyshminskiye Bory National Park , Smolny National Park, Khvalynsky National Park

Chart of parks ordered by number in different years and by countries

Let's plot a diagram of the parks ordered by the number of parks created for different years and by countries (from 1900 and to this year 2017). Include in this script, similary, in which countries these parks were created.

#added 2017-03
#defaultView:BarChart
#underscore is for using a variable more than 1 time 
SELECT DISTINCT  (SAMPLE(?year) AS ?year) (COUNT(?year) AS ?count) (SAMPLE(?parkLabel) AS ?parkLabel) WHERE {
  ?object (wdt:P31) wd:Q46169. #instance of national park
  BIND(str(YEAR(?inception)) AS ?year) #definition of year
  ?object wdt:P571 ?inception. #definition of inception
  ?object wdt:P17 ?country. #definition of country
  ?country rdfs:label ?parkLabel.
  FILTER((LANG(?parkLabel)) = "en") #filter in parkLabel = en
}
GROUP BY ?inception ?country #group by inception + country
ORDER BY ?year ?inception #order by year + inception

SPARQL-query, 612 records.

This script displays the number of parks created in certain years, as well as the countries in which they were created (Figure 1). For example, blue column for 2006 year means that 25 national parks have been established in Australia.

Figure 1: The histogram of new national parks ordered by quantity for different years and by countries


Let's sort this list so that the years are displayed sequentially (Figure 2).

Figure 2: The histogram of the number of new national parks in the countries of the world, ordered for years


The lack of the this script that national parks of several countries are not presented at Figure 2. For example, national parks of Norway are absent at this figure, because there is Wikidata object National park of Norway. Thus, the previous SPARQL script should be extended with the following lines.

#defaultView:BarChart
SELECT DISTINCT  (SAMPLE(?year) AS ?year) (COUNT(?year) AS ?count) (SAMPLE(?parkLabel) AS ?parkLabel) WHERE {
  ?object (wdt:P31/wdt:P279*) wd:Q46169. #instance of national park of .. (Russia as example)
  BIND(str(YEAR(?inception)) AS ?year) #definition of year
  ?object wdt:P571 ?inception. #definition of _inception
  ?object wdt:P17 ?country. #definition of _country
  ?country rdfs:label ?parkLabel.
  FILTER((LANG(?parkLabel)) = "en") #filter in parkLabel = en
}
GROUP BY ?inception ?country #group by inception + country
ORDER BY ?year ?inception #order by year + inception

SPARQL-query, 980 records.

You can see from (Figure 3) that the number of national parks has increased.

Figure 3: The histogram of the number of new national parks in the countries of the world, ordered by year and by country


Fullness of Wikidata

There are so many national parks in the world. However, most likely, not all the parks are filled with the field 'geographical coordinates' (en. 'location'). Let's build a list of national parks, which have geographical coordinates.

#List of parks with filled 'location'
#defaultView:Map
SELECT ?park ?parkLabel ?location
WHERE
{
  ?park wdt:P31 wd:Q46169.  
  ?park wdt:P625 ?location
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

SPARQL-query, 1405 records.

Let's build a list of national parks, which have geographic coordinates in Russia.

#List of national parks in Russia
#defaultView:Map
SELECT ?park ?parkLabel ?location
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  ?park wdt:P17 wd:Q159. #country = Russia
  ?park wdt:P625 ?location #display location
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

SPARQL-query, 7 records.

There are not so many natinal parks in Russia (which were displayed by this script), only seven . Although, really, there are six of them, because one park (National park Bikin) was duplicated due to the repeated filling of the 'location' field. In fact, these parks are 'wrong', because they must belong to a subclass of parks of a particular country.

We will build a list of national parks in Russia, using a subclass (national park in Russia).

#List of national parks in Russia
#defaultView:Map
SELECT ?park ?parkLabel ?location
WHERE
{
  ?park wdt:P31 wd:Q1969226. #instance of national park in Russia
  ?park wdt:P625 ?location #display location
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

SPARQL-query, 44 records.

The resulting list consists of 44 parks (Figure 4).


Let's look at the article on Russian Wikipedia. National parks of Russia includes 49 parks.

In the book "Around the World: Russian National Parks: The Volga Region and the North Caucasus Guidebook", it is said (at the time of writing in 2007) about the current 35 national parks in Russia.

The site worldatlas.com describes the 46 national parks. [1]

The site russia.com describes the 46 national parks. [2]

The site nationalgeographic.comdescribes the 50 national parks. [3]

Wikitravel shows the result in 40 national parks in Russia.

On English Wikipedia, you can find the result in 48 national parks (National parks of Russia).

Filling 100 objects

Information on Wikidata says that not all the parks have a 'geographic coordinates' field (en. 'location'). Let's write a script that displays a list of all national parks with an empty 'location' field.

SPARQL-query, 283 records.

#List of national parks with unfilled property 'location' 
SELECT ?park ?parkLabel ?location
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  FILTER NOT EXISTS { ?park wdt:P625 [] } #if property location is unfilled
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

This script built a list of 283 national parks with an empty 'location' field.

Let's write a script that will build a list of all national parks that have a 'location' field.

SPARQL-query, 1417 records.

#List of national parks 
#defaultView:Map
SELECT ?park ?parkLabel ?location
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  ?park wdt:P625 ?location #display location
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

After the execution of this script, 1417 national parks were displayed on the map. It is necessary to fill in the 'location' field to increase the count of displayed parks.

As can be seen from the image (Figure 5), the number of parks become larger, due to the filling of the field. The country with the largest (for example) number of national parks (312) - Australia.

Figure 5: The map of national parks based on 'geographic coordinates' property ('location')


Future work

  • Display on the map all parks in the world that are protected areas (with the "IUCN protected areas category" field)
  • Display 10 countries in which the number of national parks is the largest
  • Build a histogram (Bar chart) of national parks in Russia by the years of creation, calculate which year was the "peak" (the largest number of parks), compare with the parks of some other country

Test

1 This national park was established on February 13, 1986. This park is located in the Irkutsk region.
Select the image of this park.

Π£Ρ‰Π΅Π»ΡŒΠ΅ Донисар.jpg Alaniya
Buzuluksky Bor national park.jpg Buzuluksky Bor
Π”ΠΎΠ»ΠΈΠ½Π° Π ΠΎΠ· (Кисловодск).JPG Kislovodsk National Park
Baikal north.jpg Pribaikalsky National Park

2 Is this park in Russia?

Yes, this park is in RussiaNo
Land of the Leopard National Park
Tikal
Bikin National Park
Blue Mountains

3 It is known that the one of the most picturesque parks are the national parks of the USA. Similary, there are the years of creation of these parks: 1919, 1968, 1971, 2003.
Arrange these parks in order of increasing date of their creation (1st place - the oldest park, 4th place - the newest).

1 place (1919),2 place (1968),3 place (1971),4 place (2003)
Congaree swamp.jpg Congaree
Acadia National Park 02.JPG Acadia
Double-O-Arch Arches National Park 2.jpg Arches
Redwood National Park, fog in the forest.jpg Redwood

4 About what national park this description is for?:
Β«It is located within a typical mountain-taiga region. The relief is mountainous. Within the boundaries of the park there are large units: the Svyatonosky Range, the Barguzin Range, the Chivyrkuisky Isthmus and the Ushkany Islands.Β»

5 Arrange countries in order of increasing number of national parks:

1234
Japan
Australia
India
Indonesia

SPARQL-queries with answers:

References

  1. ↑ worldatlas.com 2017.
  2. ↑ russia.com 2017.
  3. ↑ National Geographic News 2017.
  • NSW Government (2015). "What is National Park?".
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.