# Research in programming Wikidata/Subjects of Russia

This article is devoted to the study of the most important properties of the object "The Subjects of Russia". Using the implementation of SPARQL-queries, data about the number of instances of the "Oblast of Russia", about the number of all currently existing subjects of the Russian Federation (oblast of Russia, republics, federal city of Russia, the region, autonomous okrug, autonomous regions, former administrative-territorial units) were received, the graph of neighboring subjects of the Russian Federation and countries was constructed, and the map with the population of certain subjects of the Russian Federation was drawn. Moreover, it was considered the task about fullness of property "shares border with". Also, fields with properties in the Wikidata were replenished. Reader will get acquainted with computer treatment of Wikidata and visualization of information about Russian districts.

## List of oblast of Russia

* Item: Oblast of Russia (Q835714)
* Property: instances of (P31)
Let's create a list of all oblasts of Russia.
> SPARQL запрос, 48 results on 2017, 46 results on 2021.
👍> The most complete and elaborate oblast of Russia on the Wikidata are: Moskow oblas, Tumen oblast, Kursk oblast
👎> Almost empty and uninformative oblast of Russia turned out to be: Chita oblast, Kostroma oblast, Orenburg oblast.

## Subjects of Russian Federation

Let’s build a list of all the subjects of Russia. Let us select the following objects in Wikidata: republics, territories, regions, cities of federal significance, autonomous regions and autonomous districts
Used:
* item oblast of Russia(Q835714).
* item republic of Russia(Q41162).
* item federal city of Russia(Q183342).
* item krai of Russia(Q831740).
* item autonomus oblast of Russia(Q309166).
* item autonomus okrug of Russia(Q184122).
* item former administrative-territorial entity(Q19953632).
* property instance of (P31)
SPARQL запрос, 85 results on 2017, 86 results on 2021.
To build the script 13.2 and to verify the results obtained, the following information is needed:
* According to the Constitution of the Russian Federation, Russia consists of 85 subjects — republics, territories, regions, cities of federal significance, autonomous regions, autonomous districts.
* This task does not take into account subjects that are not currently part of the Russian Federation (for example, Chita region (Q182902)), because they are not instances of objects «Oblast of Russia» (Q835714), «Republic of Russia» (Q41162), «Federal city of Russia» (Q183342), «Krai of Russia» (Q831740), «Autonomus oblast of Russia» (Q309166), «Autonomus okrug of Russia» (Q184122), and belong to the object «Former administrative-territorial unit» (Q19953632). (We get 86 objects after executing a SPARQL query).
* According to category data «Federal subjects of Russia» of the English Wikipedia, there are also 85 subjects of the Russian Federation.

## Neighboring subjects

Let`s create the graph of neighboring subjects of Russian Federation with property "shares border with".
Used:
* item oblast of Russia(Q835714).
* item republic of Russia(Q41162).
* item federal city of Russia(Q183342).
* item krai of Russia(Q831740).
* item autonomus oblast of Russia(Q309166).
* item autonomus okrug of Russia(Q184122).
* item former administrative-territorial entity(Q19953632).
* property instance of (P31).
* property share border with (P47).
SPARQL query, 467 results on 2017, 482 results on 2021.
Using the BIND command (lines 31–35) in query, we write the value to a variable, provided that the variable responsible for subjects of a certain type is non-empty. For example, in lines 31–32, a color is written to the variable ?rgb, provided that ?oblast is not empty. At the same time, if the variable ?rgb already contains a value, then we leave it to exclude color mashing. The number of records received is formed by adding the number of neighboring territories for all subjects of Russia. The result of the script is a graph displaying neighboring subjects. Moreover, different types of subjects have vertices of different colors, for example, the republics are green, and the edges are blue. A part of the graph is shown in figure.
Let’s build a map on which the subjects of Russia bordering with foreign countries are indicated in color. The darker color indicates subjects with a larger number of border countries, the lighter — with a smaller number of border countries. (SPARQL query)
The result of the query is shown in the figure.
Let’s build a map on which foreign countries bordering on the subjects of Russia are indicated in color. The darker color indicates the countries with a larger number of border subjects of Russia, the lighter — with a smaller number of border subjects of Russia (SPARQL query).
The result of the query is shown in the figure.

### Fullness of Wikidata

Let’s build a list of subjects of Russia with an empty property shares border with (P47) (borders with), that is, we will try to find such subjects that do not share border with anyone.
Used:
* item oblast of Russia(Q835714).
* item republic of Russia(Q41162).
* item federal city of Russia(Q183342).
* item krai of Russia(Q831740).
* item autonomus oblast of Russia(Q309166).
* item autonomus okrug of Russia(Q184122).
* item former administrative-territorial entity(Q19953632).
* property instance of (P31).
* property share border with (P47).
SPARQL-запрос, zero results on 2017, 1 results on 2021.
Using the FILTER command (line 16), we exclude objects that are not located on the territory of Russia. Then, using MINUS (line 20), we select objects whose property «shares border with» (P47) is not filled. Thus, the «shares border with» (P47) property is filled on Wikidata for all subjects of Russia.

## Population

Let’s mark the subjects of the Russian Federation on the map, dividing them into six groups by population. Subjects belonging to the same group will be displayed on the map in the same color. For the query we need the properties «coordinates» (P625) and «population» (P1082).
* Subjects with a population less than 500,000 are painted in blue
* Subjects with a population more than 500,000, but less than 1,000,000 are painted in orange
* Subjects with a population more than 1,000,000, but less than 3,000,000 are painted in green
* Subjects with a population more than 3,000,000, but less than 8,000,000 are painted in red
* Subjects with a population more than 8,000,000, but less than 10,000,000 are painted in white
* Subjects with a population more than 10,000,000 are painted in purple
SPARQL query version 2017 85 results on 2017.
SPARQL query version 2021 86 results on 2021.
The result of the script is represented in the figure below.

## Future work

* Arrange all subjects of Russian Federation by order of decreasing the number of territories which they border. On the basis of the data obtained, write your own opinion why some subjects have more neighbors, but others have less.
* Find the subjects of Russian Federation which border with foreign countries. Mark these subjects on the map.
* Group all subjects of Russian Federation according to the time zones they are located. Determine the total population for each group and then build a bubble diagram.
* Count the number of subjects of the Russian Federation in federal districts. Output the result, for example, in bubble chart.
* Make a histogram of the population of the subjects of the Russian Federation.
* Create a graph of water bodies (seas, lakes or rivers) for the subjects of the Russian Federation.

## Test

Keys (SPARQL queries):
* borders and date of occurrence of the subjects,
* subjects, which are in Russian Federation.
* falgs of the subjects.