# Research in programming Wikidata/Spacecraft and stations

The chapter is devoted to research of spaceships and stations based on Wikidata. Using SPARQL queries, a list of Russian ships and stations is constructed, a timeline of the launching of ships in our country and in the world for the period from 1960 to 2021 is drawn. An evaluation of the completeness of Wikidata was performed, showing, that many of the items have the wrong value of the property instance of (P31). In the course of the work, it was found that the current performance of Russian astronautics in terms of the number of spacecraft launches in recent years matches that of the USSR fifty years ago.

## List of space ships and stations

Let's build a query to output a list of all spaceships and stations. We need the objects spacestation (Q40218), spacecraft (Q25956) and the relation instance of (P31).
SPARQL-request, 145 objects (2021).

## Depth of object development

As of 2021 on Wikidata Apollo 8 is the most complete and elaborate spacecraft, which has 30 properties. At the same time, only one property each has ships such as: Europa Astrobiology Lander, Project Orbiter, LRK, EarthForce One, Soyuz GVK, CubeSat for Solar Particles. To find this information, a query built with the ProWD service was used. The same service showed that the number of properties of space objects is uneven, most are less than 30% filled.
Note the difficult fate of the object EarthForce One. This object was automatically created in Wikidata by a bot in 2013, because there was an English Wikipedia article. According to the EarthForce One English Wikipedia, the article was removed due to a lack of reliable sources proving the significance of the site. And the object has been left as an unremarkable item on Wikidata. Think of a query that would output a list of similar Wikidata items, that does not match any Wikipedia article.

## List of Soviet and Russian spaceships and stations

Let us find ships and stations designed in USSR or Russia, using the query.
SPARQL-request returns 3 spacecrafts in 2017, and 25 in 2021.

## Analyzing the completeness of Wikidata

Let us analyze the degree of filling in Wikidata in the field of Soviet and Russian spaceships and stations. By Query ``List of space ships and stations`` 145 results were obtained for all ships and stations, by Query ``List of Soviet and Russian spaceships and stations`` about Soviet and Russian objects - only 25. Information about Soviet and Russian objects in 2021 has become several times more compared to 2017, when on Query ``List of Soviet and Russian spaceships and stations`` only 3 objects were returned. As of 2021, the Buran.ru website in the section about the spaceships of the USSR and Russia contains information about 36 ships. According to the Soviet encyclopedia ``Cosmonautics``, there are 51 launches of spaceships from 1957 to 1984 in Soviet Union and 43 in same years in the United States. This means that less than half of the Soviet spaceships are represented in Wikidata. There are 10 Soviet and Russian launches of space stations, 126 NASA shuttle launches from 1981 to 2008 and 31 international launch vehicles in the American directory of space and astronomy.

## Time schedules of space exploration in Russia and the USSR and in the world
### In Russia and the USSR

The following script constructs the bar graph with the schedule of launching spacecraft in Russia and the USSR from 1960 to 2021. Earlier, in queries to get any lists, we used the ``instance of (P31)`` property. The next query without this property, with using the relation ``spaceship launch date (P619)`` on line 10 for traversing and counting such objects that have been launched into space.
SPARQL-request, 14 five-year range in 2021.
The logical operator UNION on lines 5-8 in query allows you to combine Soviet and Russian spacecraft launches. If in the Query instead of the variable ?lapse - ?year remained (lines 3 and 12), then we would get in Figure the number of launches each year. Thanks to the rounding function FLOOR and grouping, ?item objects that have launches are grouped over a five-year period, and into the variable ?quantity the number of these objects is recorded, calculated using the COUNT function. On line 14 of the query, objects launched into space are grouped by the command GROUP BY ?lapse. The fact that the grouping goes exactly according to five-year range, and not, for example, six-year-olds, is defined on line 12, where the ?year divided by 5, rounded, and multiplied by 5. The BarChart command in Query is used to present the results as a bar chart.
It can be seen from the graph that the most active period of space exploration in Russia and the USSR was in the 1970-1999 years. The horizontal axis in Figure is answered by the variable ?lapse_str. If you don't convert the number ?lapse into a text variable ?lapse_str (Converting a number into text in the third line of the query STR(?lapse) AS ?lapse_str)) then the X axis has a range from 0 to 2200, instead of the required range from 1960 to 2025, and the results are indicated by points with coordinates (five years, number of launches), and the graph becomes unreadable. The Figure shows, that the most active period of Russian cosmonautics development was in 1970-1995.

### In the World

The Query draws Figure of spacecraft launches in the World by year and country.
SPARQL-request, 328 results in 2021.
The schedule of spacecraft launches worldwide by year and country]{Visualization of the number of spacecraft launches by year and country. Figure shows that the most spacecraft launched by India and the United States(only they launched more than 10 annual launches) in 2017-2018. Worldwide launches peaked in 2018 (59 launches). According to Wikidata, Russian cosmonautics ranks average in the number of launches, its numbers for 2016-2019 are similar to those of the USSR in the 1970s and 1980s and about 3-5 launches per year.

## Astronauts in international flights

Query builds a graph with vertices corresponding ``spaceships`` and ``astronaut``, colored by country.
SPARQL-request, result contained 68 objects in 2022.
For the Query to work, you must specify the starting point - an astronaut who has participated in the international spaceflight. The starting point is set at line 11 of the Query and written to the ?naut_seed variable. Next, at line 12, we search for astronauts who have flown with the one we specified earlier. Lines 15-17 load data about spacecraft, flights and astronauts. Boolean variable ?toggle has value ?true if the found object is a spacecraft or ?false if the found object is an astronaut. The selected object (spacecraft or astronaut) is written to the ?item variable in line 19. In line 20 the name of the object is written to the variable ?itemLabel, in line 21 the data for the coloring of ships is written to the variable ?rgb_source. If a ship is selected, then nothing is written to the variable ?link in line 22. If an astronaut is selected, then his ship is written to the variable ?link. On the graph this variable will correspond to the arc from the astronaut to the ship. Line 23 loads the astronaut's citizenship data, and lines 26-34 assign a color to the vertices of the astronauts in the graph, depending on their citizenship.

## Future work

* Construct a list of ships that reached or will go to Mars.
* Calculate the proportion of ships (draw a graph by decade) which were sent sent to Mars in relation to the number of ships sent to Moon.
* Count the number of successful space launches vis-a-vis failure.

## Exercises

SPARQL-request with answers: Answer to the first 2 questions.
Images of spacecrafts.

## Acknowledgements

The authors are grateful to Evgenia Ivanovna Sokolova, the Head of the Foreign Languages Department at PetrSU, for the help in translating the article into the English language.