query-b2c9310401889f3a36c1276045b63791
Or if you want to count the number of nationalities you mays use something like , thanks. Only problem seems to be the number as I have multiple numbers for players with multiple nationalities. I tried to fix this by using STRBEFORE and remove the part after the first comma, but that deletes the numbers of the players with only one nationality ...:JuraLooks good,
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT (STRBEFORE(GROUP_CONCAT(?number; separator=", "),",") as ?numbers) ?playerLabel ?birthday (GROUP_CONCAT(?nationalityLabel; separator=", ") as ?nationalities)
WHERE
{
wd:Q21011427 wdt:P527 ?player .
OPTIONAL { ?player wdt:P569 ?birthday }.
OPTIONAL { ?player wdt:P1618 ?number }
OPTIONAL { ?player wdt:P27 ?nationality .
?nationality rdfs:label ?nationalityLabel FILTER(lang(?nationalityLabel)="de")
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "de" .
}
}
GROUP BY ?player ?playerLabel ?birthday
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?_anon_42b5416610844a34809f33a099ae9de162126"):::projected
v3("?birthday"):::projected
v8("?nationalities")
v5("?nationality")
v1("?nationalityLabel"):::projected
v4("?number")
v7("?numbers")
v2("?player")
c1(["de"]):::literal
c9(["bd:serviceParam"]):::iri
c2(["wd:Q21011427"]):::iri
c2 --"wdt:P527"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P569".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1618".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P27".-> v5
v5 --"rdfs:label"--> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c1
end
bind2[/"?number"/]
v4 --o bind2
bind2 --as--o v6
bind3[/"substring-before(,',')"/]
null --o bind3
bind3 --as--o v7
bind4[/"?nationalityLabel"/]
v1 --o bind4
bind4 --as--o v8