query-922eb2bf31d95b338a79a8aaba727120

rq turtle/ttl

Query for all instruments played by people affiliated with a particular organization, and the number of those people who play each instrument working correctly for this query. I've looked through a lot of examples and am still not getting it right. I would be very grateful if someone who knows SPARQL better than I do would look at this query and tell me what I'm doing wrong and how to fix it:COUNTHi, I am struggling to get

Use at

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 distinct ?instrument ?instrumentLabel ?count 
WHERE {?student wdt:P1303 ?instrument; 
           wdt:P1416 wd:Q98035717;
           wdt:P69 wd:Q219563.
  {
    SELECT (COUNT(?student) AS ?count)
    WHERE
    {
      ?student wdt:P1303 ?instrument; 
           wdt:P1416 wd:Q98035717;
           wdt:P69 wd:Q219563.
   }
  }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?count"):::projected v2("?instrument"):::projected v1("?student") c5(["wd:Q219563"]):::iri c7(["bd:serviceParam"]):::iri c9(["en"]):::literal c3(["wd:Q98035717"]):::iri v1 --"wdt:P1303"--> v2 v1 --"wdt:P1416"--> c3 v1 --"wdt:P69"--> c5 v1 --"wdt:P1303"--> v2 v1 --"wdt:P1416"--> c3 v1 --"wdt:P69"--> c5 bind1[/"count(?student)"/] v1 --o bind1 bind1 --as--o v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end