sparql-examples

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

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

243

rq turtle/ttl

Work aspect: cited works

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/Q28942417>

# List of works that is cited by the specified work
SELECT ?citations ?publication_date ?cited_work ?cited_workLabel 
WITH {
  SELECT (MIN(?date) AS ?publication_date) (COUNT(DISTINCT ?citing_cited_work) AS ?citations) ?cited_work 
  WHERE {
    target: wdt:P2860 ?cited_work .
    OPTIONAL {
      ?cited_work wdt:P577 ?datetime .
      BIND(xsd:date(?datetime) AS ?date)
    }
    OPTIONAL { ?citing_cited_work wdt:P2860 ?cited_work }
  }
  GROUP BY ?cited_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