sparql-examples

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

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

005

rq turtle/ttl

List of Maastricht University authors 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 DISTINCT ?author ?authorLabel ?orcid (COUNT(DISTINCT ?work) AS ?count) WHERE {
  VALUES ?institute { wd:Q1137652 } # Maastricht University
  { ?work wdt:P31 wd:Q45182324 . } UNION
  { ?work wdt:P793 wd:Q7316896 . } UNION
  { ?work wdt:P5824 [] . }
  ?work wdt:P50 ?author .
  ?author ( wdt:P108 | wdt:P463 | wdt:P1416 ) / wdt:P361* ?institute .
  OPTIONAL { ?author wdt:P496 ?orcid }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?author ?authorLabel ?orcid
  ORDER BY DESC(?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?author"):::projected 
  v6("?count")
  v2("?institute")
  v5("?orcid"):::projected 
  v3("?work"):::projected 
  a1((" "))
  a2((" "))
  c4(["wd:Q7316896"]):::iri 
  c2(["wd:Q45182324"]):::iri 
  c15(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  c13(["bd:serviceParam"]):::iri 
  bind0[/VALUES ?institute/]
  bind0-->v2
  bind00(["wd:Q1137652"])
  bind00 --> bind0
  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"-->  c4
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v3 --"wdt:P31"-->  c2
  end
  union0r <== or ==> union0l
  end
  v3 --"wdt:P50"-->  v4
  subgraph union2[" Union "]
  subgraph union2l[" "]
    style union2l fill:#abf,stroke-dasharray: 3 3;
    subgraph union3[" Union "]
    subgraph union3l[" "]
      style union3l fill:#abf,stroke-dasharray: 3 3;
      v4 --"wdt:P1416"-->  a2
    end
    subgraph union3r[" "]
      style union3r fill:#abf,stroke-dasharray: 3 3;
      v4 --"wdt:P463"-->  a2
    end
    union3r <== or ==> union3l
    end
  end
  subgraph union2r[" "]
    style union2r fill:#abf,stroke-dasharray: 3 3;
    v4 --"wdt:P108"-->  a2
  end
  union2r <== or ==> union2l
  end
  a2 --"wdt:P361"-->  v2
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."wdt:P496".->  v5
  end
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c13 --"wikibase:language"-->  c15
  end
  bind2[/"count(?work)"/]
  v3 --o bind2
  bind2 --as--o v6