sparql-examples

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

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

004

rq turtle/ttl

List of 100 authors with the most retractions.

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 ?author ?authorLabel (COUNT(DISTINCT ?work) AS ?count) WHERE {
  { ?work wdt:P31 wd:Q45182324 . } UNION
  { ?work wdt:P793 wd:Q7316896 . } UNION
  { ?work wdt:P5824 [] . }
  ?work wdt:P50 ?author .
  ?citation wdt:P2860 ?work .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?author ?authorLabel
  ORDER BY DESC(?count)
  LIMIT 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?author"):::projected 
  v4("?citation")
  v5("?count")
  v2("?work"):::projected 
  a1((" "))
  c9(["bd:serviceParam"]):::iri 
  c4(["wd:Q7316896"]):::iri 
  c2(["wd:Q45182324"]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      v2 --"wdt:P5824"-->  a1
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v2 --"wdt:P793"-->  c4
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v2 --"wdt:P31"-->  c2
  end
  union0r <== or ==> union0l
  end
  v2 --"wdt:P50"-->  v3
  v4 --"wdt:P2860"-->  v2
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
  end
  bind1[/"count(?work)"/]
  v2 --o bind1
  bind1 --as--o v5