Jump to content

Research in programming Wikidata/Tennis

From Wikiversity

Author: Ukpere Williams

This chapter is dedicated to tennis(Q847) Wikidata object analysis. Using SPARQL queries executed on Wikidata objects of tennis type, several tasks were fulfilled. These include the Introduction to Tennis using Wikidata , a list of tennis players, list of tennis competitions and players whom have participated, a list of most successful tennis players and players with the highest amount of trophies and awards .

Introduction to Tennis using Wikidata

[edit | edit source]

Let's get a list of all tennis competitions using SPARQL Queries.We make use of a property instance of (P31) with a type or value of tennis tournaments (Q13219666). This query has no limits and is made to list out tournaments with & without references. If we run this query without the condition (FILTER NOT EXISTS { ?item  wdt:P585  [] }) ,it makes a list of all the years tennis competitions were played and it then produces a result of 44,577 events , but the main idea of our task is to list tennis competitions around the Globe and not the years those tennis competitions were played. So we make use of the condition (FILTER NOT EXISTS { ?item  wdt:P585  [] }) where P585 is the time these events took place and we then remove this filter in other to list only tennis competitions.Lets take a look at the SPARQL code below;

# List tournaments around the world
SELECT DISTINCT ?item ?itemLabel 
WHERE { ?item  wdt:P31?/wdt:P279?  wd:Q13219666 .  
    FILTER NOT EXISTS { ?item  wdt:P585  [] } # Filter out objects without point in time 
    SERVICE wikibase:label { bd:serviceParam  wikibase:language  "en" } 
}

Above is a SPARQL query which gets a list of all tournaments and lawn tennis games that are played all around the world. It lists 5410 results SPARQL-query.

Tennis Players

[edit | edit source]

Female

[edit | edit source]

When it comes to females tennis ,there is no tennis without Serena, and no Serena without tennis. Serena Williams has undoubtedly made an impact on tennis as one of the strongest and most dominant women to ever play the sport. Since the late 1990s, Serena and Venus have dominated the women's tennis world. They have captured 14 Grand Slam Doubles championships overall. Serena now holds the record for the most Grand Slam singles titles by a tennis player in the Open Era, whether a man or a woman, with 23 titles, including the 2017 Australian Open. Serena's skills have undoubtedly stood the test of time and opposition. She has won the 2017 Australian Open, and she has won Grand Slam tournaments over an 18-year span beginning in 1999. Serena reached four Grand Slam finals before quitting tennis after the 2022 US Open, having missed most of 2017 due to pregnancy. However, she was unable to tie Margaret Court's record of 24 titles. I think Serena can now legitimately be called the greatest female tennis player of all time. Her 23-10 record in Grand Slam finals and her high level of play over a very long career make the argument convincing. No offense intended to Steffi, Martina, or Margaret, but Serena has earned the title of greatest of all time.


Let's make use of SPARQL Query to get a list of female players all around the world. We make use of two conditions. The first condition has a property of occupation (P106) and a type tennis player (Q10833314),while the second has a property of sex or gender (P21) and a matching data type female (Q6581072).

# List tournaments around the world
SELECT DISTINCT ?item ?itemLabel 
WHERE {
    ?item  wdt:P106  wd:Q10833314 ;# occupation is tennis player
           wdt:P21 wd:Q6581072. # sex is female
    SERVICE wikibase:label { bd:serviceParam  wikibase:language  "en" } 
}

This query generates 5409 results SPARQL-query.

We will make use of SPARQL to Rank the number of awards received by the Top ten Female tennis players using a Bar chart.In this query there are two properties occupation (P106) and P21 (sex or gender) with a matching data type or value of tennis player (Q10833314) and female (Q6581072) respectively.We then make use of ?num_awards to also list the number of awards received along side the item label.We notice that the results are scattered and need to be arranged . We make use of the statement ORDER BY DESC(?num_awards),we also use the limit of 10 to limit the number of results listed because we only want to show the top ten female tennis players with the highest number of awards.

# List to get female players with the highest awards
SELECT DISTINCT ?item ?itemLabel ?num_awards WHERE { 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }  
{     SELECT DISTINCT ?item (COUNT(?statement2) AS ?num_awards) WHERE { 
?item p:P106/(ps:P106/(wdt:P279*)) wd:Q10833314. # Occupation is tennis player 
?item p:P21/(ps:P21/(wdt:P279*)) wd:Q6581072. # Sex or gender is Female
?item p:P166 ?statement2.     }   
GROUP BY ?item     ORDER BY DESC (?num_awards)   
LIMIT 10   } }  # Only ten players will be listed
ORDER BY DESC (?num_awards) # Arrange in order of highest awards
Fig 1: Bar chart of female players ranked according to awards received

Above it is clear that Serena has the highest career awards followed by Steffi.The above was made using SPARQL bar chart and the image above is a screenshot of the results.

SPARQL-query.

There is no doubt of his glory in the sporting tennis world and his many victories.He is loved by many and he has been voted as the Greatest of all time Male players. Djokovic, who is 35 years old and in the latter stages of his career, can undoubtedly win more Grand Slam championships. Rafael Nadal, who has 22 Grand Slam titles, is the only player ahead of him with 21. It's also difficult to consider Djokovic anything less than the greatest of all time when he spent a record 373 weeks at the top of the rankings. It was evident that Novak Djokovic was the best player in the world in 2021 after his dominant start to the season, which included victories at the Australian Open, French Open, and Wimbledon. By defeating Rafael Nadal in the 2021 French Open semifinals, he made it abundantly clear that he is capable of defeating Rafa on his preferred surface. In the 2021 Wimbledon Championship, Djokovic was dominant, dropping just two sets en route to defeating Matteo Berrettini of Italy in four sets. Despite the tennis world's eager anticipation, Djokovic was unable to complete the calendar Grand Slam by winning all four majors in 2021.

In the US Open final of 2021, Djokovic lost to Daniil Medvedev in straight sets, which indicates that either he is losing ground to younger competitors or that they have arrived. Djokovic has experienced turmoil in 2022. Due to his immunization status, Novak was unable to compete in Australia. He was also defeated by Rafa in the quarterfinals of Paris. However, Novak bounced back to win Wimbledon with ease. Due to a Rafa injury, the ideal final with Rafa was not to be. Due to his vaccination history, Djokovic was also forced to withdraw from the 2022 US Open.Novak Djokovic currently holds the title of greatest of all time thanks to his track record of multiple Major victories on all surfaces and his advantage in head-to-head matches against both Federer and Nadal.

Let's make use of SPARQL Query to get a list of male players all around the world. We make use of two conditions. The first condition has a property of occupation(P106) and a type tennis player (Q10833314), while the second has a property of sex or gender (P21) and a matching data type male (Q6581097)

# List tournaments around the world
SELECT DISTINCT ?item ?itemLabel 
WHERE {
    ?item  wdt:P106  wd:Q10833314 ;# occupation is tennis player
           wdt:P21 wd:Q6581097. # sex is male
    SERVICE wikibase:label { bd:serviceParam  wikibase:language  "en" } 
}

This query produces 6954 results SPARQL-query.

We will make use of SPARQL to Rank the number of awards received by the Top ten male tennis players using a Bar chart.In this query there are two properties occupation (P106) and P21 (sex or gender) with a matching data type or value of tennis player (Q10833314) respectively. We then make use of ?num_awards to also list the number of awards received along side the item label. We notice that the results are scattered and need to be arranged . We make use of the statement ORDER BY DESC(?num_awards),we also use the limit of 10 to limit the number of results listed because we only want to show the top ten male tennis players with the highest number of awards.

# List to get male players with the highest awards
SELECT DISTINCT ?item ?itemLabel ?num_awards WHERE { 
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }  
{     SELECT DISTINCT ?item (COUNT(?statement2) AS ?num_awards) WHERE { 
?item p:P106/(ps:P106/(wdt:P279*)) wd:Q10833314.  # Occupation is tennis player 
?item p:P21/(ps:P21/(wdt:P279*)) wd:Q6581097. # Sex or gender is Female
?item p:P166 ?statement2.     }   
GROUP BY ?item     ORDER BY DESC (?num_awards)   
LIMIT 10   } }  # Only ten players will be listed
ORDER BY DESC (?num_awards) # Arrange in order of highest awards
Fig 2 : Bar chart used in ranking male tennis players according to the number of awards they have won


The above was made using SPARQL bar chart and the image above is a screenshot of the results SPARQL-query

Competitions

[edit | edit source]

In the first section (about tennis), we made use of a SPARQL query to make a list of all the Tennis tournaments and competitions around the world. In this section we will talk about the 5 most popular competitions around the world.

Wimbledon Championship

[edit | edit source]

The Wimbledon Championships is considered by the majority of tennis players to be the world's best tennis event. Wimbledon attracts a lot of attention because it is one of the four Grand Slam competitions, and for good reason. Since 1877 (1884 for women), the tournament has been held at the All-England Club in London on a grass field, with the exception of the World Wars (1915–1918, 1940–1945), and the COVID–19 Pandemic (2020). All of the best players in the world participate in this tournament when they are healthy, and for many of them, winning the competition is their greatest dream.

Let use SPARQL query to list past winners of the Wimbledon Championship. In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of Wimbledon Championship (Q41520) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well. This Query produces 1162 results.

# List to get winners of the wimbledon champuionship
SELECT ?year ?winnerLabel ?nationalityLabel ?sexLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q41520 ; # Instance of wimbledon championship               
       wdt:P585 ?year ; # Date won
       wdt:P1346 ?winner. # winner
        ?winner wdt:P27 ?nationality ; # Nationality of winner
        wdt:P21 ?sex . # Sex or gender of player
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # arrange in the other of the year

SPARQL-query

US Open

[edit | edit source]

The United States Open is ranked number two on this list and is the second of the four Grand Slams. Since its founding as the US National Championships in 1881 (1887 for women), it has been held annually. In 1968, it changed its name to the US Open. Before settling in the New York City borough of Queens in 1968, the competition was held at numerous locations across the country for many years. Since 1978, the competition has taken place on hard courts. However, it has historically been played on both grass (1881–1974) and clay (1975–1977).

Let use SPARQL query to list past winners of the US Open. In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of US Open (Q123577) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well. This Query produces 697 results .

# List to get winners of the US open 
SELECT ?year ?winnerLabel ?nationalityLabel ?sexLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q123577 ; # Instance of US open              
       wdt:P585 ?year ; # Date won
       wdt:P1346 ?winner. # winner
        ?winner wdt:P27 ?nationality ; # Nationality of winner
        wdt:P21 ?sex . # Sex or gender of player
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # arrange in the other of the year

SPARQL-query


Australian Open

[edit | edit source]

The Australian Open ranks third on this list of Grand Slam competitions. The inaugural competition took place in 1905, and a women's tournament was added in 1922. The competition took a break during the World Wars, just like Wimbledon. Early on, the top players didn't always go to Australia, but that has changed as jet travel has become more popular. Prior to the 1988 tournament's permanent relocation to Melbourne, Sydney, Brisbane, Melbourne, and Adelaide alternated as hosts. Prior to switching to hard courts in 1988, the Australian Open was held on grass from 1905 to 1987.

Let use SPARQL query to list past winners of the Australian Open. In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of Australian Open (Q60874) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well.This Query produces 870 results.

# List to get winners of the Australian open 
SELECT ?year ?winnerLabel ?nationalityLabel ?sexLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q60874 ; # Instance of Australian open              
       wdt:P585 ?year ; # Date won
       wdt:P1346 ?winner. # winner
        ?winner wdt:P27 ?nationality ; # Nationality of winner
        wdt:P21 ?sex . # Sex or gender of player
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # arrange in the other of the year

SPARQL-query


French Open

[edit | edit source]

The French Open, the final Grand Slam competition on this list, is ranked fourth. The French Championships hosted the first men's competition in 1891, and the women's event followed in 1897. The French Open, which is currently a clay court competition, is held at Stade Roland Garros, where it has been since 1928. The French Open was originally held on sand courts up until 1907, which is unusual in the modern era. The French Open was forced to stop competing during World War II, just like all other international competitions.


Let use SPARQL query to list past winners of the French Open. In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of French Open (Q43605) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well.This Query produces 705 results.

# List to get winners of the French  open 
SELECT ?year ?winnerLabel ?nationalityLabel ?sexLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q43605 ; # Instance of French open              
       wdt:P585 ?year ; # Date won
       wdt:P1346 ?winner. # winner
        ?winner wdt:P27 ?nationality ; # Nationality of winner
        wdt:P21 ?sex . # Sex or gender of player
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # arrange in the other of the year

SPARQL-query


ATP/WTA Tour

[edit | edit source]

The ATP/WTA Tour Finals are the most fascinating tennis events in the world ,following the four Grand Slams. The WTA started hosting their event in 1971, two years after the ATP started holding theirs. Both sports are played on courts with hard surfaces. For both tours, the top eight players in the standings at the end of the year are eligible to compete in the tournament. The top four players then advance to the semifinals after playing a round-robin-style event. Since their inception, the men's and women's competitions have each been held in a number of locations worldwide.

Let use SPARQL query to list past winners of the ATP Tour . In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of ATP Tour(Q270907) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well.This Query produces 113 results.

# Query to list winners of ATP finals 
SELECT ?year ?winnerLabel ?nationalityLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q270907;  # Instance of ATP finals     
              wdt:P585 ?year ; # point in time
              wdt:P1346 ?winner . # winner
             ?winner wdt:P27 ?nationality ; # Nationality of tennis players who won
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # Order by the year

SPARQL-query


Female

[edit | edit source]

Let use SPARQL query to list past winners of the WTP Tour . In this query we will make use of three conditions. The first condition has a property of Part of (P361) and a matching value of WTP Tour(Q220347) and the second condition has a property of point in time (P585) without a matching type and the the third property winner (P1346) has no data type as well.This Query produces 147 results.

# Query to list winners of WTA finals 
SELECT ?year ?winnerLabel ?nationalityLabel
      WHERE {   ?event wdt:P361/wdt:P31 wd:Q220347;  # Instance of WTA finals     
              wdt:P585 ?year ; # point in time
              wdt:P1346 ?winner . # winner
             ?winner wdt:P27 ?nationality ; # Nationality of tennis players who won
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 
ORDER BY DESC(?year) # Order by the year

SPARQL-query

Techniques

[edit | edit source]

Learning Tennis Techniques

[edit | edit source]

Developing a strong foundation in the fundamentals of tennis is crucial when learning the game. Students must fully grasp the fundamentals of tennis footwork, body positioning, and stroke mechanics before moving on to more advanced strokes. To avoid having incorrect moves ingrained in your muscle memory, it is crucial to learn the right moves and techniques the first time. It is much more difficult to undo incorrect technique and start over than it is to get it right the first time.


Below we will use the SPARQL Query to list out Tennis techniques which would be useful to enjoy the sport. In the query we make use of a two condition. The first condition has a property type instance of (P31) with a matching property type of sports technique (Q61996437) and the second condition has a property type of sports (P641) and a matching value of tennis (Q847). This query with the help of Wikidata Query service produces 71 results of various techniques and skills used in tennis.

# Query to get list Tennis techniques
SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P31 ?statement0. 
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q61996437. # Instance of sports techniques
      ?item p:P641 ?statement1.
      ?statement1 (ps:P641/(wdt:P279*)) wd:Q847. # sports is tennis  
    }
  }
}

SPARQL-query


Dominant Player Hand

[edit | edit source]

We will try to use Wikidata to provide the total number of tennis players who are right handed, left handed or use both their hands.

Properties and Data types

[edit | edit source]

occupation (P106)

Tennis Player (Q10833314

Playing Hand (P741)

Left Handed (Q789447)

Right Handed (Q3039938)

# List to get players Dominant hand 
SELECT *  WITH {  SELECT DISTINCT ?s { ?s p:P106/ps:P106/wdt:P279* wd:Q10833314   # occupation is tennis player
     } 
}AS %results {
  {SELECT (count(?s) as ?left)  {    INCLUDE %results.  
                      ?s p:P741/ps:P741 wd:Q789447.   # players that are left handed
                        FILTER NOT EXISTS {?s p:P741/ps:P741 wd:Q3039938.
            } 
      }
 }  
           {SELECT (count(?s) as ?right) {  INCLUDE %results.
                      ?s p:P741/ps:P741 wd:Q3039938.   # players that are right handed
                          FILTER NOT EXISTS {?s p:P741/ps:P741 wd:Q789447.
           }    
      }
 }  
          {SELECT (count(?s) as ?both) {    INCLUDE %results.  
                      ?s p:P741/ps:P741 wd:Q789447, wd:Q3039938.  # players that use both hands                                             
            }
       } 
}

Using FIGMA I created a Ven diagram to represent the information gotten from Wikidata ;

Fig 3 : Ven diagram showing Dominant hands of Tennis players

SPARQL-query

We discovered that Wikidata has limited data about the dominant hands of tennis players. To confirm this discovery I made a Query to list all Tennis players and it produced 12,523 results meanwhile total of all elements in the ven diagram and SPARQL Query above is 2,334 results. It means that Wikidata doesn't have sufficient data about 10,189 tennis players.

# List of tennis players
SELECT DISTINCT ?item ?itemLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE {
      ?item p:P106 ?statement0. 
      ?statement0 (ps:P106/(wdt:P279*)) wd:Q10833314. # occupation is a tennis player
    }
    
  }
}

Properties and Data types

[edit | edit source]

occupation (P106)

Tennis Player (Q10833314)


SPARQL-query


Fig 4 : Bar chart to show the ratio of missing information on Wikidata

Players and Their Net worth

[edit | edit source]

There are many talented tennis players in the world. The skill of swinging the racket has been honed by these players over many years. These accomplished athletes have ascended to the pinnacles of sport and amassed enormous wealth in the process. Who is the highest-paid tennis player in the present?

We will try to make use of Wikidata to create a query which lists out Tennis players and their networths. In the query we use three property types of occupation (P106), nationality (P27) and net worth (P2218) and one data type of tennis player (Q10833314) for the first property occupation (P106). It turns out that Wikidata doesn't have the net worth of most tennis players and the net worth of Roger Federer provided by Wikidata is not updated or recent, and it only prints out 6 results.

# List of tennis players and their net worth
SELECT DISTINCT ?item ?itemLabel ?networths ?nationality ?nationalityLabel WHERE { # Order of list 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item ?networths ?nationality WHERE {
      ?item (p:P106/ps:P106/(wdt:P279*)) wd:Q10833314; # occupation is tennis player
        (p:P27/ps:P27) ?nationality; # nationality
        (p:P2218/(psv:P2218/wikibase:quantityAmount)) ?networths. # player net worth
    }
    ORDER BY DESC (?networths) # arrange list in order of highest net worth
  }
}
ORDER BY DESC (?networths)

SPARQL-Query

Due to the lack of sufficient Data from the Wikidata Query , we will create a table ranking top 10 players by their net worth and nationality using Wikidata properties and types;

NO. Tennis players Nationality Net worth
1 Ion Tiriac Romania $1.2 Billion
2 Roger Federer Switzerland $550 Million
3 Serena Williams USA $250 Million
4 Novak Djokovic Serbia $220 Million
5 Rafael Nadal Spain $220 Million
6 Maria Sharapova Russia $180 Million
7 Andre Agassi USA $175 Million
8 Pete Sampras USA $150 Million
9 Andy Murray United Kingdom $110 Million
10 John McEnroe USA $100 Million

In the table above we have successfully created a table with Wikidata properties and types of tennis players and their nationalities. In order to create this table above, the source was used.[1]

Tests

[edit | edit source]

1 Who is the best female tennis player? 1) Steffi Graf 2) Chris Evert 3) Althea Gibson 4) Serena Williams

2 Who is the best male tennis player?

Nikolai Ozerov
Rafael Nadal
Novak Djokovic
Bjorn Borg

3 Which of these players are retired?

Ion Tiriac
Alcaraz Carlos
Daniil Medvedev
Iga Swiatek

4 Which of these male tennis player has the highest net worth?

Roger Federer
Ion Tiriac
Rafael Nadal
Daniil Medvedev

5 Which of these is used to play tennis  ?



Future work

[edit | edit source]

1) Find 10 tennis Legends who are already retired

2) Write individual wiki pages for these legends using Wikidata

3) Using Wikidata to make list of awards received by these legends

4) Use Wikidata to show the countries of these legends

5) Use Wikidata to show which tournaments these legends participated in

References

[edit | edit source]
  1. "Top 20 richest tennis players in the world and their net worth". Sports Brief. Jackline Wangare. 2022.
  • "Tennis". Britannica. The Editors of Encyclopaedia Britannica. 2022.