sparql-examples

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

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

220

rq turtle/ttl

Venue aspect: outgoing

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q6294930>

SELECT ?intention ?intentionLabel (CONCAT("/cito/", SUBSTR(STR(?intention), 32)) AS ?intentionUrl)
(COUNT(DISTINCT ?citingArticle) AS ?count) WHERE {
  VALUES ?JOURNAL { target: }
  ?citingArticle p:P2860 ?citationStatement ;
                 wdt:P1433 ?JOURNAL .
  ?citationStatement pq:P3712 ?intention ;
                     ps:P2860 ?citedArticle .
  ?intention wdt:P31 wd:Q96471816 ;
             wdt:P2888 ?cito .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?cito ?intention ?intentionLabel
  ORDER BY DESC(?count)

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?JOURNAL")
  v4("?citationStatement")
  v6("?citedArticle")
  v3("?citingArticle"):::projected 
  v7("?cito")
  v9("?count")
  v5("?intention"):::projected 
  v8("?intentionUrl")
  c6([http://wikidata.org/entity/Q96471816]):::iri 
  c9([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  bind0[/VALUES ?JOURNAL/]
  bind0-->v2
  bind00(["wd:Q6294930"])
  bind00 --> bind0
  v3 --"p:P2860"-->  v4
  v3 --"p:direct/P1433"-->  v2
  v4 --"p:qualifier/P3712"-->  v5
  v4 --"p:statement/P2860"-->  v6
  v5 --"p:direct/P31"-->  c6
  v5 --"p:direct/P2888"-->  v7
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
  end
  bind2[/"concat('/cito/',substring(str(?intention),'32^^xsd:integer'))"/]
  v5 --o bind2
  bind2 --as--o v8
  bind3[/"count(?citingArticle)"/]
  v3 --o bind3
  bind3 --as--o v9