query: SELECT ?item ?title (YEAR(?year) as ?yr) WHERE{ {SELECT ?title (COUNT(DISTINCT(?film)) As ?ct) WHERE { VALUES ?filmtype {wd:Q11424 wd:Q24862 wd:Q20667187 wd:Q226730} ?film wdt:P31 ?filmtype . ?film wdt:P1476 ?title } GROUP BY ?title ORDER BY DESC(?ct) LIMIT 12} VALUES ?filmtype {wd:Q11424 wd:Q24862 wd:Q20667187 wd:Q226730} . ?item wdt:P31 ?filmtype . ?item wdt:P1476 ?title OPTIONAL{?item wdt:P577 ?year} } ORDER BY DESC(?ct) ?title ?year