sparql-examples

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

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

001

rq turtle/ttl

List of the 100 most cited retracted articles.

Use at

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

SELECT ?work ?workLabel (COUNT(DISTINCT ?citation) AS ?count) WHERE {
  { ?work wdt:P31 wd:Q45182324 . } UNION
  { ?work wdt:P793 wd:Q7316896 . } UNION
  { ?work wdt:P5824 [] . }
  ?work wdt:P1433 / wdt:P123 ?publisher .
  ?work rdfs:label ?workLabel . FILTER (LANG(?workLabel) = "en") .
  ?citation wdt:P2860 ?work .
} GROUP BY ?work ?workLabel
  ORDER BY DESC(?count) LIMIT 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?citation"):::projected 
  v6("?count")
  v4("?publisher")
  v3("?work"):::projected 
  v2("?workLabel"):::projected 
  a1((" "))
  a2((" "))
  c5(["wd:Q7316896"]):::iri 
  c3(["wd:Q45182324"]):::iri 
  f0[["?workLabel = 'en'"]]
  f0 --> v2
  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;
      v3 --"wdt:P5824"-->  a1
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v3 --"wdt:P793"-->  c5
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v3 --"wdt:P31"-->  c3
  end
  union0r <== or ==> union0l
  end
  v3 --"wdt:P1433"-->  a2
  a2 --"wdt:P123"-->  v4
  v3 --"rdfs:label"-->  v2
  v5 --"wdt:P2860"-->  v3
  bind2[/"count(?citation)"/]
  v5 --o bind2
  bind2 --as--o v6