# Research in programming Wikidata/National park

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.
* Property: instance of (P31)
* Item: national park (Q46169)
SPARQL-query, 1665 records (2017), 2251 records (2022).
According to ProWD the Fort Stevens is the leader in terms of the number of properties (31 properties) among national parks around the world. Losiny Ostrov National Park contains 14 properties. This is the maximum number of properties for Russian national parks.
👍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 2022). Include in this script, similary, in which countries these parks were created.
SPARQL-query, 612 records (2017), 1042 records (2022).
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.
Let's sort this list so that the years are displayed sequentially (Figure 2).
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.
SPARQL-query, 980 records (2017), 1519 records (2022).
You can see from (Figure 3) that the number of national parks has increased.

### Squares of the parks

We continue to analyze parks in Russia and around the world. But now we will count not quantity, but quality. The measure of quality will be the area of the park. First, let's calculate how many parks in the world do not have the "area" property filled, in absolute numbers and as a percentage.
SPARQL-query
As a result of executing this script, we got 586 parks. According to previous data, there are 2251 parks in the world . It turns out that the property "area" is not filled in 26.03% of parks.
Now let's analyze the national parks of Russia in a similar way. Let's consider how many parks in Russia are with unfilled property 'area'.
SPARQL-query
As a result of executing this script, we got 7 parks. There are 65 parks in Russia . It turns out that the property "area" is not filled in 10.77% of parks in Russia, which is much less in comparison with parks all over the world.
It is interesting to check how many parks in the world have been closed according to Wikidata:
SPARQL-query
Since parks are usually not closed (as a result of executing the script, we found out that the number is small - 7 results), we will assume that once the park has been opened, then the area has been added.
Let's build a diagram of the growth of the area of ​​parks by country by year. On the page of some national parks in Wikidata, not one, but several area values ​​are indicated, for example, as we saw in the results of the intermediate script in the park Ånderdalen National Park: 135 sq. km, 133.996 sq. km and 13,399.62468 hectares. The second and third values ​​are almost equal, but in different units. We see three numbers: 133996246.8, 135000000, 133996000 (numbers have already been converted to km). We can simplify the task for ourselves and take the maximum value out of all possible. That is, an optimistic assumption that the areas of parks are either constant or increasing. Therefore, we used the MAX function: (MAX (? Area) AS? MaxArea) . For the Ånderdalen National Park, the maximum area will be 135,000,000 (or 135 sq. Km). As a result, we get the modified script:
SPARQL-query
On line 11, we used the psn prefix ?park p:P2046/psn:P2046/wikibase:quantityAmount ?area. To normalize the values ​​to a total area. We also cut off erroneous data by year: FILTER(?year != "1") . The maximum value function MAX takes the maximum area value. In the grouping on line 17, the ?park objects are grouped by country and area using the command "GROUP BY ?area ?country". The BarChart display style is used to present the results as a bar chart. The variable ?year corresponds to the horizontal axis on the graph.
A graph of the areas of the world's national parks, starting in the 1593s. is presented in the bar chart below:
In the resulting diagram, we see rectangles of different colors, where each color corresponds to the parks of a certain country, and the height of the rectangle (the ordinate) is the area of ​​the parks of this country described in Wikidata for specific years (located on the abscissa). As you can see from the image (Fig. 4), Norway is leading by a large margin in the column by area (for example, the figure shows the parks of Norway in purple, and in 2006 we see an unusually large rectangle).
To study this point, we will display the list of national parks in Norway in more detail:
SPARQL-query
From the graph we see that, indeed, large parks are located on the territory of Norway (13.36% of the area of all national parks in the world).

### 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.
SPARQL-query, 1405 records (2017), 2396 records (2021).
Let's build a list of national parks, which have geographic coordinates in Russia.
SPARQL-query, 7 records (2017), 6 records (2022).
There are not so many natinal parks in Russia (which were displayed by this script), only six. 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).
SPARQL-query, 44 records (2017), 65 records (2022).
The number of national parks in Russia is constantly changing. The book "Around the World: Russian National Parks: The Volga Region and the North Caucasus Guidebook" speaks about the current 35 national parks of Russia. According to other articles, the data has changed, for example, E. Dzhandzhugazova in her work says that "Currently, there are 47 national parks in the Russian Federation, the number of which is growing every year".
Wikitravel shows the result in 40 national parks in Russia (2010).
The site describes 41 the national park. This number of parks may be due to the fact that the available data was updated quite a long time ago (2015). The site worldatlas.com describes the 46 national parks. The site nationalgeographic.com describes the 50 national parks.
Let's look at the article on Russian Wikipedia. National parks of Russia includes 64 parks. On English Wikipedia, you can find a table containing a list of 59 national parks ( National parks of Russia).
According to our information, it turns out that all national parks are represented in Wikidata.

### Parks without specified geographic coordinates

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 (2017), 82 records (2022).
This script built a list of 82 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 (2017), 2359 records (2022).
After completing the listing, 2359 national parks were displayed on the map. As you can see from the image (Fig. 5), the number of parks taken out has increased. And the country with the largest number of national parks (312) was Australia.

## 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

SPARQL-queries with answers:
* list of all national parks,
* list of Russian national parks,
* list of national parks in USA,
* list of national parks by country in ascending order.