A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/dataset_citations.sparql
Dataset aspect: citations
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/Q4203254>
# List of works that is cited by the specified work
SELECT ?citations ?publication_date ?citing_work ?citing_workLabel
WITH {
SELECT (MIN(?date) AS ?publication_date) (COUNT(?citing_citing_work) AS ?citations) ?citing_work
WHERE {
# Find works that cite the queried work
?citing_work wdt:P2860 target: .
OPTIONAL {
?citing_work wdt:P577 ?datetime .
# Simplify the datetime to one with day, month and year only
BIND(xsd:date(?datetime) AS ?date)
}
OPTIONAL { ?citing_citing_work wdt:P2860 ?citing_work }
}
GROUP BY ?citing_work
# Limit the number of results to avoid downloading too much data
ORDER BY DESC(?citations) DESC(?date)
LIMIT 1000
} AS %result
WHERE {
# Label the result
INCLUDE %result
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?citations) DESC(?publication_date)
graph TD