query-896f5ca095e0056404356af7f0cd21ca
Grouping by only one variableIs there any way / workaround to group a sparql query by only one variable from the SELECT statement? I have the following query and want to group it by ?player only:
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#>
SELECT ?number ?playerLabel ?birthday ?nationalityLabel
WHERE
{
wd:Q21011427 wdt:P527 ?player .
OPTIONAL { ?player wdt:P569 ?birthday }.
OPTIONAL { ?player wdt:P27 ?nationality }.
OPTIONAL { ?player wdt:P1618 ?number }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "de" .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?birthday"):::projected
v3("?nationality")
v4("?number"):::projected
v1("?player")
c9(["de"]):::literal
c7(["bd:serviceParam"]):::iri
c1(["wd:Q21011427"]):::iri
c1 --"wdt:P527"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P569".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P27".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P1618".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end