Gender-related questions: Difference between revisions

From MtM
(Created page with "Back to the overview of all query topics: back")
 
No edit summary
 
Line 1: Line 1:
Back to the overview of all query topics: [[SPARQL-Queries|back]]
Back to the overview of all query topics: [[SPARQL-Queries|back]]
== Bar chart showing the number of female, male and non-binary real persons involved in a production ==
<syntaxhighlight lang="sparql" line="1">
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
#defaultView:BarChart
SELECT ?genderLabel (COUNT(?person) AS ?count) WHERE {
  ?person wdt:P3 wd:Q241.                        # Person is a real person
  ?person wdt:P17 ?gender.                      # Person has a gender
  ?production ?function ?person.                # Production is connected to the person via a function
  ?production wdt:P3 wd:Q309.                    # Production is a theatre production
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".      # Adds readable labels
  }
}
GROUP BY ?genderLabel
ORDER BY ?genderLabel
</syntaxhighlight>Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%0A%0A%23defaultView%3ABarChart%0ASELECT%20%3FgenderLabel%20%28COUNT%28%3Fperson%29%20AS%20%3Fcount%29%20WHERE%20%7B%0A%20%20%3Fperson%20wdt%3AP3%20wd%3AQ241.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20is%20a%20real%20person%0A%20%20%3Fperson%20wdt%3AP17%20%3Fgender.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20a%20gender%0A%20%20%3Fproduction%20%3Ffunction%20%3Fperson.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%20is%20connected%20to%20the%20person%20via%20a%20function%0A%20%20%3Fproduction%20wdt%3AP3%20wd%3AQ309.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%20is%20a%20theatre%20production%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%20%20%20%20%20%23%20Adds%20readable%20labels%0A%20%20%7D%0A%7D%0AGROUP%20BY%20%3FgenderLabel%0AORDER%20BY%20%3FgenderLabel%0A Test SPARQL query]
== Directors and their gender ==
<syntaxhighlight lang="sparql" line="1">
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?production ?productionLabel ?directorLabel ?genderLabel WHERE {
    ?production wdt:P3 wd:Q309.            # Production
    ?production wdt:P15 ?director.          # Production has a director
    ?director wdt:P17 ?gender.              # Director has a gender
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en".
    }
}
</syntaxhighlight>Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%0A%0ASELECT%20%3Fproduction%20%3FproductionLabel%20%3FdirectorLabel%20%3FgenderLabel%20WHERE%20%7B%0A%20%20%20%20%3Fproduction%20wdt%3AP3%20wd%3AQ309.%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%0A%20%20%20%20%3Fproduction%20wdt%3AP15%20%3Fdirector.%20%20%20%20%20%20%20%20%20%20%23%20Production%20has%20a%20director%0A%20%20%20%20%3Fdirector%20wdt%3AP17%20%3Fgender.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Director%20has%20a%20gender%0A%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%20%20%7D%0A%7D%0A Test SPARQL query]
== Which productions were directed by male/female/non-binary directors? ==
<syntaxhighlight lang="sparql" line="1">
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?production ?productionLabel ?directorLabel WHERE {
    ?production wdt:P3 wd:Q309.
    ?production wdt:P15 ?director.    # Production has a director
    ?director wdt:P17 wd:Q9.          # Gender: male (Q9)
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en".
    }
}
</syntaxhighlight>In line 6: Leave wd:Q9 for '''male directors''', insert wd:Q10 for '''female directors''', or insert wd:Q11 for '''non-binary directors'''.
Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%0A%0ASELECT%20%3Fproduction%20%3FproductionLabel%20%3FdirectorLabel%20WHERE%20%7B%0A%20%20%20%20%3Fproduction%20wdt%3AP3%20wd%3AQ309.%0A%20%20%20%20%3Fproduction%20wdt%3AP15%20%3Fdirector.%20%20%20%20%20%23%20Production%20has%20a%20director%0A%20%20%20%20%3Fdirector%20wdt%3AP17%20wd%3AQ9.%20%20%20%20%20%20%20%20%20%20%20%23%20Gender%3A%20male%20%28Q9%29%0A%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%20%20%7D%0A%7D%0A Test SPARQL query]
== Which productions cast/did not cast the roles as specified in the literary source material with regard to gender? Which roles are involved? ==
<syntaxhighlight lang="sparql" line="1">
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?production ?productionLabel ?roleLabel ?roleGenderLabel ?characterLabel ?characterGenderLabel WHERE {
  ?production wdt:P3 wd:Q309.
  ?production wdt:P25 ?role.              # Production has roles
  ?role wdt:P17 ?roleGender.              # Role gender
  ?role wdt:P87 ?character.              # Role based on literary character
  ?character wdt:P17 ?characterGender.    # Literary character gender
  FILTER (?roleGender != ?characterGender)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".
  }
}
ORDER BY ?production
</syntaxhighlight>In line 10: To display '''which roles match the gender of the character from the literary source''', '''remove''' the exclamation mark: (?genderRole = ?genderCharacter). To display which roles from the production and characters from the literary source have '''different genders''': (?genderRole != ?genderCharacter).
Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%0A%0ASELECT%20%3Fproduction%20%3FproductionLabel%20%3FroleLabel%20%3FroleGenderLabel%20%3FcharacterLabel%20%3FcharacterGenderLabel%20WHERE%20%7B%0A%20%20%3Fproduction%20wdt%3AP3%20wd%3AQ309.%0A%20%20%3Fproduction%20wdt%3AP25%20%3Frole.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%20has%20roles%0A%20%20%3Frole%20wdt%3AP17%20%3FroleGender.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Role%20gender%0A%20%20%3Frole%20wdt%3AP87%20%3Fcharacter.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Role%20based%20on%20literary%20character%0A%20%20%3Fcharacter%20wdt%3AP17%20%3FcharacterGender.%20%20%20%20%23%20Literary%20character%20gender%0A%0A%20%20FILTER%20%28%3FroleGender%20%21%3D%20%3FcharacterGender%29%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%7D%0A%7D%0AORDER%20BY%20%3Fproduction%0A Test SPARQL query]
== In which productions was character X (any character) cast as female/male/non-binary? ==
<syntaxhighlight lang="sparql" line="1">
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?production ?productionLabel ?role ?roleLabel WHERE {
  ?production wdt:P25 ?role.
  ?role wdt:P87 wd:Q45.      # Based on character Chairman
  ?role wdt:P17 wd:Q10.      # Gender: female
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".
  }
}
</syntaxhighlight>In line 7: '''wd:Q10 for female cast''', '''wd:Q9 for male cast''', '''wd:Q11 for non-binary cast'''
In line 6: To '''change''' the '''character''' on which the role is based:
* wd:Q45 for the character of the Presiding Judge
* wd:Q27 for the defendant
* wd:Q30 for the court reporter
* wd:Q31 for Lauterbach
* wd:Q35 for Meiser
* wd:Q38 for the defence counsel
* wd:Q42 for the prosecutor
* wd:Q47 for the court officer
Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%0A%0ASELECT%20%3Fproduction%20%3FproductionLabel%20%3Frole%20%3FroleLabel%20WHERE%20%7B%0A%20%20%3Fproduction%20wdt%3AP25%20%3Frole.%0A%20%20%3Frole%20wdt%3AP87%20wd%3AQ45.%20%20%20%20%20%20%20%23%20Based%20on%20character%20Chairman%0A%20%20%3Frole%20wdt%3AP17%20wd%3AQ10.%20%20%20%20%20%20%20%23%20Gender%3A%20female%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%7D%0A%7D%0A Test SPARQL query]

Latest revision as of 20:51, 3 December 2025

Back to the overview of all query topics: back

Bar chart showing the number of female, male and non-binary real persons involved in a production

PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>

#defaultView:BarChart
SELECT ?genderLabel (COUNT(?person) AS ?count) WHERE {
  ?person wdt:P3 wd:Q241.                        # Person is a real person
  ?person wdt:P17 ?gender.                       # Person has a gender
  ?production ?function ?person.                 # Production is connected to the person via a function
  ?production wdt:P3 wd:Q309.                    # Production is a theatre production

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".      # Adds readable labels
  }
}
GROUP BY ?genderLabel
ORDER BY ?genderLabel

Click here: Test SPARQL query

Directors and their gender

PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>

SELECT ?production ?productionLabel ?directorLabel ?genderLabel WHERE {
    ?production wdt:P3 wd:Q309.             # Production
    ?production wdt:P15 ?director.          # Production has a director
    ?director wdt:P17 ?gender.              # Director has a gender

    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en".
    }
}

Click here: Test SPARQL query

Which productions were directed by male/female/non-binary directors?

PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>

SELECT ?production ?productionLabel ?directorLabel WHERE {
    ?production wdt:P3 wd:Q309.
    ?production wdt:P15 ?director.     # Production has a director
    ?director wdt:P17 wd:Q9.           # Gender: male (Q9)

    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en".
    }
}

In line 6: Leave wd:Q9 for male directors, insert wd:Q10 for female directors, or insert wd:Q11 for non-binary directors.

Click here: Test SPARQL query

Which productions cast/did not cast the roles as specified in the literary source material with regard to gender? Which roles are involved?

PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>

SELECT ?production ?productionLabel ?roleLabel ?roleGenderLabel ?characterLabel ?characterGenderLabel WHERE {
  ?production wdt:P3 wd:Q309.
  ?production wdt:P25 ?role.              # Production has roles
  ?role wdt:P17 ?roleGender.              # Role gender
  ?role wdt:P87 ?character.               # Role based on literary character
  ?character wdt:P17 ?characterGender.    # Literary character gender

  FILTER (?roleGender != ?characterGender)

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".
  }
}
ORDER BY ?production

In line 10: To display which roles match the gender of the character from the literary source, remove the exclamation mark: (?genderRole = ?genderCharacter). To display which roles from the production and characters from the literary source have different genders: (?genderRole != ?genderCharacter).

Click here: Test SPARQL query

In which productions was character X (any character) cast as female/male/non-binary?

PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>

SELECT ?production ?productionLabel ?role ?roleLabel WHERE {
  ?production wdt:P25 ?role.
  ?role wdt:P87 wd:Q45.       # Based on character Chairman
  ?role wdt:P17 wd:Q10.       # Gender: female

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en".
  }
}

In line 7: wd:Q10 for female cast, wd:Q9 for male cast, wd:Q11 for non-binary cast

In line 6: To change the character on which the role is based:

  • wd:Q45 for the character of the Presiding Judge
  • wd:Q27 for the defendant
  • wd:Q30 for the court reporter
  • wd:Q31 for Lauterbach
  • wd:Q35 for Meiser
  • wd:Q38 for the defence counsel
  • wd:Q42 for the prosecutor
  • wd:Q47 for the court officer

Click here: Test SPARQL query