query-b18ddc4adb8588dbc1b0fc9740deb3fe
But it did not helped, probably because it takes in account that ?date is distinct. 00:12, 23 December 2016 (UTC)) talk (BunykWhen I try to use group by aggregation, it gives me "Bad aggregate" error. How to write it properly, so I have distinct films with first release date in filmography? -- Oh, I see, I need to group by ?itemLabel, not ?item.
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 ?itemLabel (MAX(?date) AS ?maxdate)
WHERE
{
?item wdt:P161 wd:Q193212 .
?item wdt:P577 ?date .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} GROUP BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?date"):::projected
v1("?item")
v3("?maxdate")
c5(["bd:serviceParam"]):::iri
c2(["wd:Q193212"]):::iri
c7(["en"]):::literal
v1 --"wdt:P161"--> c2
v1 --"wdt:P577"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind1[/"max(?date)"/]
v2 --o bind1
bind1 --as--o v3