Research in programming Wikidata/Spacecraft and stations

From Wikiversity
Jump to navigation Jump to search

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

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

# List of spacecraft (Q40218) and space station (Q25956)
SELECT  ?s ?sLabel ?typeLabel
  VALUES ?type {wd:Q40218 wd:Q25956}
  ?s wdt:P31 ?type.               # Selecting the type of object
  SERVICE wikibase:label {bd:serviceParam wikibase:language"en"}

SPARQL-request, 145 objects (2021).

Depth of object development[edit | edit source]

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

Let us find ships and stations designed in USSR or Russia, using the query.

# List of Russian and USSR spacecrafts and stations
SELECT  ?spacecraft  ?spacecraftLabel 
  {?spacecraft wdt:P31 wd:Q40218.} UNION   #spacecraft
  {?spacecraft wdt:P31 wd:Q25956.} # and space station
  # Soviet Union and Russia
  VALUES ?ruCountries {wd:Q15180 wd:Q159}
  ?spacecraft wdt:P17 ?ruCountries. # related to Russia
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}

SPARQL-request returns 3 spacecrafts in 2017, and 25 in 2021.

Analyzing the completeness of Wikidata[edit | edit source]

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

In Russia and the USSR[edit | edit source]

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.

# The number of spacecraft launches in Russia every 5 years
SELECT (STR(?lapse) AS ?lapse_str) (COUNT(?item) AS ?quantity)
WHERE {                                  # spacecraft belongs to
        {?item wdt:P17 wd:Q15180}               # country = USSR
  UNION {?item wdt:P17 wd:Q159}               # country = Russia
  UNION {?item wdt:P495 wd:Q159}    # country of origin = Russia
  UNION {?item wdt:P495 wd:Q15180}.  # country of origin =  USSR
  ?item wdt:P619 ?launch. # date of spacecraft launch
  BIND( YEAR(?launch) AS ?year) 
  BIND(FLOOR(?year/5)*5 AS ?lapse) # count for each 5 years
GROUP BY ?lapse
ORDER BY ?lapse # Order 1970, 1975, 1980, ...

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.

Visualization of the number of spacecraft launches in the USSR and Russia every 5 years

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

The Query draws Figure of spacecraft launches in the World by year and country.

# Diagram of spacecraft launches by year and country
SELECT ?year (COUNT(?obj) AS ?count) ?country ?countryLabel
  ?obj wdt:P17 ?country. # spacecraft belongs to country 
  ?obj wdt:P619 ?launch. # date of spacecraft launch
  BIND(STR(YEAR(?launch)) AS ?year)
SERVICE wikibase:label {bd:serviceParam wikibase:language"en"}
GROUP BY ?year ?country ?countryLabel

SPARQL-request, 328 results in 2021.

Visualization of the number of spacecraft launches by year and country 2021 01.svg

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

Query builds a graph with vertices corresponding ``spaceships`` and ``astronaut``, colored by country.

# Graph of astronauts as crew of flights of different countries
SELECT DISTINCT ?item ?itemLabel ?rgb ?link ?naut_seed
  VALUES ?toggle { true false }
  # Let's select a subset of astronauts
      VALUES ?naut_seed {wd:Q313815}.  # Sergei Krikalev
      ?s wdt:P1029 ?naut_seed, ?naut;  
    }       # ?naut seed and ?naut are member of a same crew
  ?s  wdt:P31/wdt:P279* wd:Q40218; # spacecraft
      wdt:P31/wdt:P279* wd:Q752783;# human spaceflight
          wdt:P1029 ?naut;  # has member of the crew ?naut    
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}
  BIND(IF(?toggle,?s,?naut) AS ?item).
  BIND(IF(?toggle,?sLabel,?nautLabel) AS ?itemLabel).
  BIND(IF(?toggle,"FFFFFF","7FFF00") AS ?rgb_source).
  BIND(IF(?toggle,"",?s) AS ?link).
  ?naut wdt:P27 ?country. # astronaut is citizen of country 
  # ?toggle = true then spacecraft node
  # ?toggle = false then astronaut node
  BIND(     # Soviet and Russian astronauts have red nodes
    IF(!?toggle && (?country=wd:Q15180||?country=wd:Q159),"FF0000",
    IF(!?toggle && ?country=wd:Q30,"FF00FF",  # USA - fuchsia
    IF(!?toggle && ?country=wd:Q183,"C0C0C0", # Germany - silver
    IF(!?toggle && ?country=wd:Q142,"008080", # France - teal
    IF(!?toggle && ?country=wd:Q40,"800000", # Austria - maroon
    IF(!?toggle && ?country=wd:Q38,"00FFFF", # Italy - aqua
    AS ?rgb).

SPARQL-request, result contained 68 objects in 2022.

The graph with the vertices of the type ``spaceships`` and ``astronauts`` with coloring by country. Red corresponds to the USSR and Russia, fuchsia - the USA, silver - Germany, teal - France, maroon - Australia, and aqua - Italy.

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

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

1 Choose how many spacecrafts were launched in the USSR in the 60's, 70's and 80's of the XX century.

42 39 16

2 Arrange the number of spacecrafts launched by decades in ascending order.

63 76 115 121

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

Soyuz 19 Soyuz-T Soviet lunar lander drawing

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

Images of spacecrafts.

Acknowledgements[edit | edit source]

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.

References[edit | edit source]

Links[edit | edit source]

  • "All ships" (in Russian). 1998.
  • SavinovED. "All Spacecraft". ProWD. Retrieved 2021-09-24.
  • Joseph, A. and Angelo, Jr. (2009). The facts on file space and astronomy handbook. Facts on file. 
  • Glushko, V. P. (1985). Encyclopedia Cosmonautica. Soviet Encyclopedia.