sparql-examples

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

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

003

rq turtle/ttl

List of publishers with the most retractions.

Use at

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT
  (COUNT(DISTINCT ?work) AS ?works)
  ?publisher ?publisherLabel
WHERE {
  ?work wdt:P31 wd:Q45182324 ;
        wdt:P1433 ?venue .
  ?venue wdt:P123 ?publisher .
  ?publisher rdfs:label ?publisherLabel . FILTER (LANG(?publisherLabel) = "en") .
} GROUP BY ?publisher ?publisherLabel
  ORDER BY DESC(?works)
  LIMIT 200
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?publisher"):::projected 
  v2("?publisherLabel"):::projected 
  v4("?venue")
  v3("?work"):::projected 
  v6("?works")
  c3(["wd:Q45182324"]):::iri 
  f0[["?publisherLabel = 'en'"]]
  f0 --> v2
  v3 --"wdt:P31"-->  c3
  v3 --"wdt:P1433"-->  v4
  v4 --"wdt:P123"-->  v5
  v5 --"rdfs:label"-->  v2
  bind2[/"count(?work)"/]
  v3 --o bind2
  bind2 --as--o v6