People: Difference between revisions
(Created page with "Back to the overview of all query topics: back == Images of the listed persons == <syntaxhighlight lang="sparql" line="1"> PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX mmd: <https://mtm.uni-trier.de/entity/> PREFIX mmdt: <https://mtm.uni-trier.de/prop/direct/> #defaultView:ImageGrid SELECT ?personLabel ?image WHERE { ?person mmdt:P3 mmd:Q241. # Person is a real person ?...") |
No edit summary |
||
| Line 17: | Line 17: | ||
SERVICE wikibase:label { | SERVICE wikibase:label { | ||
bd:serviceParam wikibase:language " | bd:serviceParam wikibase:language "en". # Adds readable labels | ||
} | } | ||
} | } | ||
</syntaxhighlight>Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20mmd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%20%0APREFIX%20mmdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0A%23defaultView%3AImageGrid%0ASELECT%20%3FpersonLabel%20%3Fimage%20WHERE%20%7B%0A%20%20%20%20%3Fperson%20mmdt%3AP3%20mmd%3AQ241.%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%20%20%3Fperson%20mmdt%3AP2%20%3FwikidataEntity.%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20an%20exact%20match%20with%20a%20Wikidata%20item%0A%20%20%0A%20%20%20%20SERVICE%20%3Chttps%3A%2F%2Fquery.wikidata.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3FwikidataEntity%20wdt%3AP18%20%3Fimage.%20%20%20%20%20%20%20%20%20%23%20Wikidata%20item%20has%20an%20image%20via%20P18%0A%20%20%20%20%7D%0A%20%20%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20% | </syntaxhighlight>Click here: [http://mtm.uni-trier.de/query/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20mmd%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fentity%2F%3E%20%0APREFIX%20mmdt%3A%20%3Chttps%3A%2F%2Fmtm.uni-trier.de%2Fprop%2Fdirect%2F%3E%0A%23defaultView%3AImageGrid%0ASELECT%20%3FpersonLabel%20%3Fimage%20WHERE%20%7B%0A%20%20%20%20%3Fperson%20mmdt%3AP3%20mmd%3AQ241.%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%20%20%3Fperson%20mmdt%3AP2%20%3FwikidataEntity.%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20an%20exact%20match%20with%20a%20Wikidata%20item%0A%20%20%0A%20%20%20%20SERVICE%20%3Chttps%3A%2F%2Fquery.wikidata.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3FwikidataEntity%20wdt%3AP18%20%3Fimage.%20%20%20%20%20%20%20%20%20%23%20Wikidata%20item%20has%20an%20image%20via%20P18%0A%20%20%20%20%7D%0A%20%20%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%23%20Adds%20readable%20labels%0A%20%20%20%20%7D%0A%7D%0A Test SPARQL query] | ||
== Map of birthplaces of all real persons in this Wikibase instance == | == Map of birthplaces of all real persons in this Wikibase instance == | ||
| Line 40: | Line 40: | ||
SERVICE wikibase:label { | SERVICE wikibase:label { | ||
bd:serviceParam wikibase:language " | bd:serviceParam wikibase:language "en". # Adds readable labels | ||
} | } | ||
} | } | ||
| Line 63: | Line 63: | ||
SERVICE wikibase:label { | SERVICE wikibase:label { | ||
bd:serviceParam wikibase:language " | bd:serviceParam wikibase:language "en". # Adds readable labels | ||
} | } | ||
} | } | ||
| Line 69: | Line 69: | ||
ORDER BY ?production | ORDER BY ?production | ||
</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%3FproductionLabel%20%3FpersonLabel%20%3FfirstNameLabel%20%3FlastNameLabel%20%3FgenderLabel%20%3FpropLabel%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%23%20Person%20is%20a%20real%20person%0A%20%20OPTIONAL%20%7B%20%20%20%20%20%20%20%20%20%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%20If%20this%20information%20is%20missing%20in%20a%20person%20item%0A%20%20%20%20%3Fperson%20wdt%3AP17%20%3Fgender.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20gender%0A%20%20%20%20%3Fperson%20wdt%3AP27%20%3FfirstName.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20first%20name%0A%20%20%20%20%3Fperson%20wdt%3AP28%20%3FlastName.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20last%20name%0A%20%20%7D%0A%20%20%3Fproduction%20%3Ffunction%20%3Fperson.%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%20is%20linked%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%23%20Production%20is%20a%20production%0A%20%20%3Fprop%20wikibase%3AdirectClaim%20%3Ffunction.%20%20%20%20%20%20%23%20Adds%20readable%20property%20labels%0A%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20% | </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%3FproductionLabel%20%3FpersonLabel%20%3FfirstNameLabel%20%3FlastNameLabel%20%3FgenderLabel%20%3FpropLabel%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%23%20Person%20is%20a%20real%20person%0A%20%20OPTIONAL%20%7B%20%20%20%20%20%20%20%20%20%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%20If%20this%20information%20is%20missing%20in%20a%20person%20item%0A%20%20%20%20%3Fperson%20wdt%3AP17%20%3Fgender.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20gender%0A%20%20%20%20%3Fperson%20wdt%3AP27%20%3FfirstName.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20first%20name%0A%20%20%20%20%3Fperson%20wdt%3AP28%20%3FlastName.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Person%20has%20last%20name%0A%20%20%7D%0A%20%20%3Fproduction%20%3Ffunction%20%3Fperson.%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Production%20is%20linked%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%23%20Production%20is%20a%20production%0A%20%20%3Fprop%20wikibase%3AdirectClaim%20%3Ffunction.%20%20%20%20%20%20%23%20Adds%20readable%20property%20labels%0A%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%23%20Adds%20readable%20labels%0A%20%20%7D%0A%7D%0A%0AORDER%20BY%20%3Fproduction%0A Test SPARQL query] | ||
== Is there a director who oversaw multiple productions? If yes, which ones? == | == Is there a director who oversaw multiple productions? If yes, which ones? == | ||
| Line 89: | Line 89: | ||
SERVICE wikibase:label { | SERVICE wikibase:label { | ||
bd:serviceParam wikibase:language " | bd:serviceParam wikibase:language "en". | ||
} | } | ||
} | } | ||
ORDER BY ?regieLabel ?inszenierungLabel | ORDER BY ?regieLabel ?inszenierungLabel | ||
</syntaxhighlight>Click here: Test SPARQL query | </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%3Fregie%20%3FregieLabel%20%3Finszenierung%20%3FinszenierungLabel%20WHERE%20%7B%0A%20%20%0A%20%20%7B%0A%20%20%20%20SELECT%20%3Fregie%20%28COUNT%28%3Finszenierung%29%20AS%20%3FanzahlInszenierungen%29%20WHERE%20%7B%20%23Query%20for%20number%20of%20productions%0A%20%20%20%20%20%20%3Finszenierung%20wdt%3AP15%20%3Fregie.%20%23Production%20has%20director%0A%20%20%20%20%7D%0A%20%20%20%20GROUP%20BY%20%3Fregie%20%3FregieLabel%20%20%20%20%20%20%20%23Group%20by%20directors%20and%20their%20labels%0A%20%20%20%20HAVING%20%28COUNT%28%3Finszenierung%29%20%3E%201%29%20%23If%20more%20than%20one%20production%20exists%0A%20%20%7D%0A%20%20%0A%20%20%3Finszenierung%20wdt%3AP15%20%3Fregie.%20%20%20%20%20%23Main%20query%2C%20to%20include%20the%20director%E2%80%99s%20productions%20in%20the%20result%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%3FregieLabel%20%3FinszenierungLabel%0A Test SPARQL query] | ||
== Is there an actor who participated in multiple productions? If yes, which ones? == | == Is there an actor who participated in multiple productions? If yes, which ones? == | ||
| Line 112: | Line 112: | ||
SERVICE wikibase:label { #Adds readable labels | SERVICE wikibase:label { #Adds readable labels | ||
bd:serviceParam wikibase:language " | bd:serviceParam wikibase:language "en". | ||
} | } | ||
} | } | ||
| Line 118: | Line 118: | ||
ORDER BY ?darstellerInLabel ?inszenierungLabel | ORDER BY ?darstellerInLabel ?inszenierungLabel | ||
</syntaxhighlight>Click here: Test SPARQL query | </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%3FdarstellerIn%20%3FdarstellerInLabel%20%3Finszenierung%20%3FinszenierungLabel%20WHERE%20%7B%0A%7B%0ASELECT%20%3FdarstellerIn%20%3FdarstellerInLabel%20%28COUNT%28%3Finszenierung%29%20AS%20%3Fcount%29%20WHERE%20%7B%20%23Subquery%20for%20number%20of%20productions%0A%20%20%3Finszenierung%20wdt%3AP14%20%3FdarstellerIn.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23Production%20has%20an%20actor%0A%7D%0AGROUP%20BY%20%3FdarstellerIn%20%3FdarstellerInLabel%0AHAVING%20%28COUNT%28%3Finszenierung%29%20%3E%201%29%0A%7D%0A%3Finszenierung%20wdt%3AP14%20%3FdarstellerIn.%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23Main%20query%2C%20to%20include%20the%20actor%E2%80%99s%20productions%20in%20the%20result%0A%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23Adds%20readable%20labels%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%0A%20%20%7D%0A%7D%0A%0AORDER%20BY%20%3FdarstellerInLabel%20%3FinszenierungLabel%0A Test SPARQL query] | ||
Latest revision as of 20:15, 28 November 2025
Back to the overview of all query topics: back
Images of the listed persons
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX mmd: <https://mtm.uni-trier.de/entity/>
PREFIX mmdt: <https://mtm.uni-trier.de/prop/direct/>
#defaultView:ImageGrid
SELECT ?personLabel ?image WHERE {
?person mmdt:P3 mmd:Q241. # Person is a real person
?person mmdt:P2 ?wikidataEntity. # Person has an exact match with a Wikidata item
SERVICE <https://query.wikidata.org/sparql> {
?wikidataEntity wdt:P18 ?image. # Wikidata item has an image via P18
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en". # Adds readable labels
}
}
Click here: Test SPARQL query
Map of birthplaces of all real persons in this Wikibase instance
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX mmd: <https://mtm.uni-trier.de/entity/>
PREFIX mmdt: <https://mtm.uni-trier.de/prop/direct/>
#defaultView:Map
SELECT ?personLabel ?birthplaceLabel ?coordinates WHERE {
?person mmdt:P3 mmd:Q241. # Person is a real person
?person mmdt:P2 ?wikidataEntity. # Person has an exact match with a Wikidata item
SERVICE <https://query.wikidata.org/sparql> {
?wikidataEntity wdt:P19 ?birthplace. # Wikidata item has a birthplace via P19
?birthplace wdt:P625 ?coordinates. # P625 = coordinates in Wikidata
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en". # Adds readable labels
}
}
Click here: Test SPARQL query
List of all persons with gender and function within the production
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?productionLabel ?personLabel ?firstNameLabel ?lastNameLabel ?genderLabel ?propLabel WHERE {
?person wdt:P3 wd:Q241. # Person is a real person
OPTIONAL { # If this information is missing in a person item
?person wdt:P17 ?gender. # Person has gender
?person wdt:P27 ?firstName. # Person has first name
?person wdt:P28 ?lastName. # Person has last name
}
?production ?function ?person. # Production is linked to the person via a function
?production wdt:P3 wd:Q309. # Production is a production
?prop wikibase:directClaim ?function. # Adds readable property labels
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en". # Adds readable labels
}
}
ORDER BY ?production
Click here: Test SPARQL query
Is there a director who oversaw multiple productions? If yes, which ones?
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?regie ?regieLabel ?inszenierung ?inszenierungLabel WHERE {
{
SELECT ?regie (COUNT(?inszenierung) AS ?anzahlInszenierungen) WHERE { #Query for number of productions
?inszenierung wdt:P15 ?regie. #Production has director
}
GROUP BY ?regie ?regieLabel #Group by directors and their labels
HAVING (COUNT(?inszenierung) > 1) #If more than one production exists
}
?inszenierung wdt:P15 ?regie. #Main query, to include the director’s productions in the result
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
}
}
ORDER BY ?regieLabel ?inszenierungLabel
Click here: Test SPARQL query
Is there an actor who participated in multiple productions? If yes, which ones?
PREFIX wdt: <https://mtm.uni-trier.de/prop/direct/>
PREFIX wd: <https://mtm.uni-trier.de/entity/>
SELECT ?darstellerIn ?darstellerInLabel ?inszenierung ?inszenierungLabel WHERE {
{
SELECT ?darstellerIn ?darstellerInLabel (COUNT(?inszenierung) AS ?count) WHERE { #Subquery for number of productions
?inszenierung wdt:P14 ?darstellerIn. #Production has an actor
}
GROUP BY ?darstellerIn ?darstellerInLabel
HAVING (COUNT(?inszenierung) > 1)
}
?inszenierung wdt:P14 ?darstellerIn. #Main query, to include the actor’s productions in the result
SERVICE wikibase:label { #Adds readable labels
bd:serviceParam wikibase:language "en".
}
}
ORDER BY ?darstellerInLabel ?inszenierungLabel
Click here: Test SPARQL query