sparql-examples

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

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

002

rq turtle/ttl

List of venues (e.g. journals) 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 
  ?works
  ?venue ?venueLabel
  (CONCAT("#venue/", SUBSTR(STR(?venue), 32)) AS ?venueUrl)
  ?venueDescription
WHERE {
  SERVICE <https://query-scholarly.wikidata.org/sparql> {
    {
      SELECT
        (COUNT(?work) AS ?works)
        ?venue
      WHERE {
        ?work wdt:P31 wd:Q45182324 ;
              wdt:P1433 ?venue .
      }
      GROUP BY ?venue
      ORDER BY DESC(?works)
      LIMIT 200
    }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} 
ORDER BY DESC(?works)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?venue"):::projected 
  v4("?venueUrl")
  v2("?work")
  v4("?works"):::projected 
  c6(["bd:serviceParam"]):::iri 
  c3(["wd:Q45182324"]):::iri 
  c8(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  subgraph s1["https://query-scholarly.wikidata.org/sparql"]
    style s1 stroke-width:4px;
    v2 --"wdt:P31"-->  c3
    v2 --"wdt:P1433"-->  v3
    bind1[/"count(?work)"/]
    v2 --o bind1
    bind1 --as--o v4
  end
  subgraph s2["http://wikiba.se/ontology#label"]
    style s2 stroke-width:4px;
    c6 --"wikibase:language"-->  c8
  end
  bind2[/"concat('#venue/',substring(str(?venue),'32^^xsd:integer'))"/]
  v3 --o bind2
  bind2 --as--o v4