sparql-examples

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

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

121

rq turtle/ttl

Pathway aspect: citing articles

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#defaultView:Table

PREFIX target: <http://www.wikidata.org/entity/Q28031254>

SELECT ?citations ?publication_date ?citing_work ?citing_workLabel
WITH {
  SELECT
    (MIN(?date) AS ?publication_date)
    (COUNT(?citing_citing_work) AS ?citations)
    ?citing_work
  WHERE {
    ?citing_work wdt:P2860 target: .
    OPTIONAL {
      ?citing_work wdt:P577 ?datetime .
      BIND(xsd:date(?datetime) AS ?date)
    }
    OPTIONAL { ?citing_citing_work wdt:P2860 ?citing_work }
  }
  GROUP BY ?citing_work
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?citations) DESC(?date)

graph TD