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.

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.

[https://query.wikidata.org/#%23%20Graph%20of%20astronauts%20as%20crew%20of%20flights%20of%20different%20countries%0A%23defaultView%3AGraph%0ASELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20%3Frgb%20%3Flink%20%3Fnaut_seed%0AWHERE%0A%7B%20%0A%20%20VALUES%20%3Ftoggle%20%7B%20true%20false%20%7D%0A%20%20%23%20Let%27s%20select%20a%20subset%20of%20astronauts%0A%20%20%7B%0A%20%20%20%20SELECT%20DISTINCT%20%3Fnaut%20WHERE%0A%20%20%20%20%7B%20%0A%20%20%20%20%20%20VALUES%20%3Fnaut_seed%20%7Bwd%3AQ313815%7D.%20%20%23%20Sergei%20Krikalev%0A%20%20%20%20%20%20%3Fs%20wdt%3AP1029%20%3Fnaut_seed%2C%20%3Fnaut%3B%20%20%23%20%3Fnaut_seed%20%26%20%3Fnaut%20are%20member%20of%20a%20same%20crew%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20%3Fs%20%20wdt%3AP31%2Fwdt%3AP279%2a%20wd%3AQ40218%3B%20%23%20spacecraft%20and%20subclasses%0A%20%20%20%20%20%20wdt%3AP31%2Fwdt%3AP279%2a%20wd%3AQ752783%3B%23%20human%20spaceflight%20and%20subclasses%2C%20e.g.%20expedition%20to%20the%20International%20Space%20Station%0A%20%20%20%20%20%20%20%20%20%20wdt%3AP1029%20%3Fnaut%3B%20%20%20%20%20%20%20%20%20%23%20has%20member%20of%20the%20crew%20%3Fnaut%20%20%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7Bbd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%7D%0A%20%20BIND%28IF%28%3Ftoggle%2C%3Fs%2C%3Fnaut%29%20AS%20%3Fitem%29.%0A%20%20BIND%28IF%28%3Ftoggle%2C%3FsLabel%2C%3FnautLabel%29%20AS%20%3FitemLabel%29.%0A%20%20BIND%28IF%28%3Ftoggle%2C%22FFFFFF%22%2C%227FFF00%22%29%20AS%20%3Frgb_source%29.%0A%20%20BIND%28IF%28%3Ftoggle%2C%22%22%2C%3Fs%29%20AS%20%3Flink%29.%0A%20%20%3Fnaut%20wdt%3AP27%20%3Fcountry.%20%23%20astronaut%20is%20citizen%20of%20country%20%0A%20%20%23%20%3Ftoggle%20%3D%20true%20then%20spacecraft%20node%0A%20%20%23%20%3Ftoggle%20%3D%20false%20then%20astronaut%20node%0A%20%20BIND%28%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Soviet%20%26%20Russian%20astronauts%20have%20red%20nodes%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%28%3Fcountry%3Dwd%3AQ15180%20%7C%7C%20%3Fcountry%3Dwd%3AQ159%29%2C%22FF0000%22%2C%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%3Fcountry%3Dwd%3AQ30%2C%22FF00FF%22%2C%20%20%23%20USA%20-%20fuchsia%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%3Fcountry%3Dwd%3AQ183%2C%22C0C0C0%22%2C%20%23%20Germany%20-%20silver%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%3Fcountry%3Dwd%3AQ142%2C%22008080%22%2C%20%23%20France%20-%20teal%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%3Fcountry%3Dwd%3AQ40%2C%22800000%22%2C%20%23%20Austria%20-%20maroon%0A%20%20%20%20IF%28%21%3Ftoggle%20%26%26%20%3Fcountry%3Dwd%3AQ38%2C%2200FFFF%22%2C%20%23%20Italy%20-%20aqua%0A%20%20%20%20%3Frgb_source%29%29%29%29%29%29%0A%20%20%20%20AS%20%3Frgb%29.%0A%7D 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
{Choose how many spacecrafts were launched in the USSR in the 60's, 70's and 80's of the XX century. --+ 60s +-- 70s -+- 80s
 * type=""}
 * 42 | 39 | 16

{Arrange the number of spacecrafts launched by decades in ascending order. +--- 70s -+-- 80s --+- 90s ---+ 00s
 * type=""}
 * 63 | 76 | 115 | 121

{ Write the name of the country where these spaceships were designed.

{ Union of Soviet Socialist Republics | USSR | Soviet Union }
 * type="{}"}

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.