如何根据收入创建维基数据 SPARQL 查询 return 前 10 名美国公司及其董事?

How do I create a Wikidata SPARQL query to return the top 10 US companies and their directors based on revenue?

这是我正在使用的查询:

SELECT DISTINCT ?item ?itemLabel ?rev ?date (group_concat(distinct ?directorLabel ; separator = ", ") as ?directors)
WHERE { 
  ?item wdt:P31/wdt:P279* wd:Q4830453 ;
        wdt:P17 wd:Q30 .
  ?item p:P2139 ?revSt .
  ?revSt pq:P585 ?date.
  FILTER (   YEAR(?date) = 2020 ).
  ?revSt ps:P2139 ?rev .
  ?item p:P3320 ?relationship.
  ?relationship ps:P3320 ?director.
  #Filter Director by no end date
  FILTER NOT EXISTS {?relationship pq:P582 ?end.}
  #Group directors
  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
    ?director rdfs:label ?directorLabel .
    ?item rdfs:label ?itemLabel .
  }
 }
GROUP BY ?item ?itemLabel
ORDER BY DESC(?rev) 
LIMIT 10

这个查询是一个错误的聚合,如果我向 GROUP BY 子句添加更多变量它会超时。最后,我也想汇总所有董事的 wdt id。

SELECT DISTINCT 
?item ?itemLabel ?rev ?date 
(group_concat(distinct ?directorLabel ; separator = ", ") as ?directors) 
WHERE {    
  ?item wdt:P31/wdt:P279* wd:Q4830453 ;
        wdt:P17 wd:Q30 .
  ?item p:P2139 ?revSt .   
  ?revSt pq:P585 ?date. 
  hint:Prior hint:rangeSafe "true" .
  FILTER (   YEAR(?date) = 2020 ).   
  ?revSt ps:P2139 ?rev .  
  ?item p:P3320 ?relationship.   
  ?relationship ps:P3320 ?director.   
  FILTER NOT EXISTS {?relationship pq:P582 ?end.}  
  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".   
    ?director rdfs:label ?directorLabel .    
    ?item rdfs:label ?itemLabel .  
   } 
 } 
GROUP BY ?item ?itemLabel ?rev ?date 
ORDER BY DESC(?rev)  
LIMIT 10