query-06c96f7034a0092d2f4608cd667be1c0
“celebrities” SELECT DISTINCT ?lastNameLabel WHERE { # Identify celebrities by their occupation ?celebrity wdt:P106 ?occupation; wdt:P734 ?lastName.
# Filter for notable occupations VALUES ?occupation { wd:Q33999 # actor wd:Q639669 # musician wd:Q483501 # artist wd:Q36180 # writer wd:Q82955 # politician wd:Q2066131 # athlete wd:Q211236 # celebrity }
# Get labels for readability SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 1000
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# “celebrities”
SELECT DISTINCT ?lastNameLabel
WHERE {
# Identify celebrities by their occupation
?celebrity wdt:P106 ?occupation;
wdt:P734 ?lastName.
# Filter for notable occupations
VALUES ?occupation {
wd:Q33999 # actor
wd:Q639669 # musician
wd:Q483501 # artist
wd:Q36180 # writer
wd:Q82955 # politician
wd:Q2066131 # athlete
wd:Q211236 # celebrity
}
# Get labels for readability
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 1000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?celebrity")
v3("?lastName")
v4("?occupation")
c4(["bd:serviceParam"]):::iri
c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P106"--> v4
v1 --"wdt:P734"--> v3
bind0[/VALUES ?occupation/]
bind0-->v4
bind00(["wd:Q33999"])
bind00 --> bind0
bind01(["wd:Q639669"])
bind01 --> bind0
bind02(["wd:Q483501"])
bind02 --> bind0
bind03(["wd:Q36180"])
bind03 --> bind0
bind04(["wd:Q82955"])
bind04 --> bind0
bind05(["wd:Q2066131"])
bind05 --> bind0
bind06(["wd:Q211236"])
bind06 --> bind0
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end