Skip to content

Instantly share code, notes, and snippets.

@egonw
Created August 23, 2025 20:10
Show Gist options
  • Save egonw/b514de293f0f38e9727fbada781d413e to your computer and use it in GitHub Desktop.
Save egonw/b514de293f0f38e9727fbada781d413e to your computer and use it in GitHub Desktop.
# tool: scholia
#sparql_endpoint = https://query-scholarly.wikidata.org/sparql
#sparql_endpoint_name= WDQS main
#sparql_editurl = https://query-scholarly.wikidata.org/#
#sparql_embedurl = https://query-scholarly.wikidata.org/embed.html#
#defaultView:BarChart
PREFIX target: <http://www.wikidata.org/entity/Q28264479>
SELECT
(STR(?year_) AS ?year)
(SUM(?count_) AS ?count)
?intentionLabel
WHERE {
{
SELECT
?year_
?intention ?intentionLabel
(COUNT(DISTINCT ?citing_work) AS ?count_)
WHERE {
?citing_work p:P2860 ?citationStatement .
?citationStatement pq:P3712 ?intention ;
ps:P2860 target: .
SERVICE wdsubgraph:wikidata_main {
?intention wdt:P31 wd:Q96471816 .
BIND (
COALESCE(
IF(?intention = wd:Q105624924, "negative", # critiques the cited work
IF(?intention = wd:Q117121923, "negative", # disputes
IF(?intention = wd:Q107710355, "negative", # refutes
IF(?intention = wd:Q117121932, "negative", # ridicules
IF(?intention = wd:Q117121919, "positive", # credits
IF(?intention = wd:Q117121934, "positive", # uses conclusions from the cited work
IF(?intention = wd:Q111736347, "positive", # cites as evidence
"neutral")
)
)
)
)
)
)
) AS ?intentionLabel
)
}
# Year of citation
?citing_work wdt:P577 ?date .
BIND(YEAR(?date) AS ?year_)
BIND(xsd:date(?date) AS ?pubDate_)
}
GROUP BY ?year_ ?intention ?intentionLabel
}
}
GROUP BY ?year_ ?intention ?intentionLabel
ORDER BY DESC(?year_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment