Research in programming Wikidata/National park

From Wikiversity
Jump to navigation Jump to search

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"[edit | edit source]

Let's build a list of all national parks.

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

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[edit | edit source]

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.

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

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


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 (2017)


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 (2017), 1519 records (2022).

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 (2017)


Squares of the parks[edit | edit source]

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.

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

SPARQL-query

As a result of executing this script, we got 586 parks. According to previous data, there are 2251 parks in the world [1]. 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'.

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

SPARQL-query

As a result of executing this script, we got 7 parks. There are 65 parks in Russia [2]. 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:

#List of national parks with property 'closure date' 
SELECT ?park ?parkLabel ?date
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  ?park wdt:P576 ?date #display date
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}

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:


#defaultView:BarChart
#diagram of the growth of the area of parks by country by year.
SELECT DISTINCT (SAMPLE(?year) AS ?year) (MAX(?area) AS ?maxArea)  (SAMPLE(?countryLabel) AS ?countryLabel)
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  BIND(str(YEAR(?inception)) AS ?year) #definition of year
  ?park wdt:P571 ?inception. #definition of inception
  ?park wdt:P17 ?country. #park belongs to country 
  # Get the area of the park (Use the psn: prefix to normalize the values to a common unit of area)
  ?park p:P2046/psn:P2046/wikibase:quantityAmount ?area.
  ?country rdfs:label ?countryLabel.
  FILTER((LANG(?countryLabel)) = "en") #filter in parkLabel = en
  FILTER EXISTS { ?park wdt:P2046 [] } #if property area is filled
  FILTER(?year != "1") #except the mistakes
}
GROUP BY ?area ?country
ORDER BY DESC(?maxArea)

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:

Figure 4: Diagram of the growth of the area of national parks by country by year (2022)


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:

#List of Norway National parks (view maximum area)
SELECT DISTINCT (SAMPLE(?park) AS ?park) (SAMPLE(?parkLabel) AS ?parkLabel) (MAX(?area) AS ?maxArea) (SAMPLE(?year) AS ?year) 
WHERE
{
  ?park wdt:P31 wd:Q46169. #instance of national park
  ?park wdt:P571 ?inception. #definition of inception
  BIND(str(YEAR(?inception)) AS ?year) #definition of year
  ?park wdt:P17 wd:Q20. #view only Norway parks
  ?park p:P2046/psn:P2046/wikibase:quantityAmount ?area.
  ?park rdfs:label ?parkLabel.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
  FILTER EXISTS { ?park wdt:P2046 [] } #if property area is filled
}
GROUP BY ?park
ORDER BY DESC(?maxArea)

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[edit | edit source]

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.

#defaultView:Map
#Map of national parks that have location filled in
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"}
}

SPARQL-query, 1405 records (2017), 2396 records (2021).

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 (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).

#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 (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" [1] 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" [2].

Wikitravel shows the result in 40 national parks in Russia (2010).

The site [3] 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. [4] The site nationalgeographic.com describes the 50 national parks. [5]

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[edit | edit source]

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.

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

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.

#List of national parks with filled property 'location' 
#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 "ru,en"}
}

SPARQL-query, 1417 records (2017), 2359 records (2022).

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

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


Future work[edit | edit source]

  • 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[edit | edit source]

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 Russia No
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:

1 2 3 4
Japan
Australia
India
Indonesia


SPARQL-queries with answers:

References[edit | edit source]

  1. Kusyj 2007.
  2. Dzhandzhugazova 2019.
  3. dic.academic 2015.
  4. worldatlas.com 2017.
  5. National Geographic News 2017.

Sources[edit | edit source]

  • Dzhandzhugazova E. A. (2019). Development of ecological tourism on the territory of national parks of Russia. Russian regions: a look into the future. https://cyberleninka.ru/article/n/razvitie-ekologicheskogo-turizma-na-territorii-natsionalnyh-parkov-rossii. 
  • I. A. Kusyi (2007) Around the World: Russian National Parks: The Volga Region and the North Caucasus Guidebook Around the World. ISBN 5-98652-110-2

Links[edit | edit source]