sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

009

rq turtle/ttl

Map with organizations with retracted articles.

Use at

PREFIX wd: <http://wikidata.org/entity/>
PREFIX wdt: <http://wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>

SELECT ?organization ?organizationLabel ?geo ?count ?layer
WITH {
  SELECT DISTINCT ?organization ?geo (COUNT(DISTINCT ?work) AS ?count) WHERE {
    ?work wdt:P2860 / wdt:P31 wd:Q45182324 ;
          wdt:P50 ?author .
    ?author ( wdt:P108| wdt:P463 | wdt:P1416 ) / wdt:P361* ?organization . 
    ?organization (wdt:P625 | ((wdt:P276|wdt:P159)/wdt:P625)) ?geo .
  }
  GROUP BY ?organization ?geo ?count
  ORDER BY DESC (?count)
  LIMIT 2000
} AS %organizations
WHERE {
  INCLUDE %organizations
  BIND(IF( (?count < 1), "No results", IF((?count < 2), "1 result", IF((?count < 11), "1 < results ≤ 10", IF((?count < 101), "10 < results ≤ 100", IF((?count < 1001), "100 < results ≤ 1000", IF((?count < 10001), "1000 < results ≤ 10000", "over 10000 results") ) ) ) )) AS ?layer )
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }        
 }
ORDER BY DESC (?count)