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

Lists journals that have CiTO citation intentions defined and returns the number of citation statements as well as the number of citing 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#>
PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>

SELECT ?journal ?journalLabel (CONCAT("/venue/", SUBSTR(STR(?journal), 32), "#cito") AS ?journalUrl)
(COUNT(DISTINCT ?citationStatement) AS ?citations) 
(COUNT(DISTINCT ?citingArticle) AS ?articles) WHERE {
  ?citingArticle p:P2860 ?citationStatement ;
                 wdt:P1433 ?journal .
  ?citationStatement pq:P3712 ?intention ;
                     ps:P2860 ?citedArticle .
  ?intention wdt:P31 wd:Q96471816 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?journal ?journalLabel
  ORDER BY DESC(?citations)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v8("?articles")
  v3("?citationStatement"):::projected 
  v8("?citations")
  v6("?citedArticle")
  v2("?citingArticle"):::projected 
  v5("?intention")
  v4("?journal"):::projected 
  v7("?journalUrl")
  c6(["wd:Q96471816"]):::iri 
  c8(["bd:serviceParam"]):::iri 
  c10(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  v2 --"p:P2860"-->  v3
  v2 --"wdt:P1433"-->  v4
  v3 --"p:qualifier/P3712"-->  v5
  v3 --"p:statement/P2860"-->  v6
  v5 --"wdt:P31"-->  c6
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c8 --"wikibase:language"-->  c10
  end
  bind2[/"concat('/venue/',substring(str(?journal),'32^^xsd:integer'),'#cito')"/]
  v4 --o bind2
  bind2 --as--o v7
  bind3[/"count(?citationStatement)"/]
  v3 --o bind3
  bind3 --as--o v8
  bind4[/"count(?citingArticle)"/]
  v2 --o bind4
  bind4 --as--o v8