query-2b391b07daf15945ead2d9ce594ee1d8
Citations per year
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#defaultView:BarChart
PREFIX target: <http://www.wikidata.org/entity/Q18618629>
SELECT
(STR(?year_) AS ?year)
(SUM(?count_) AS ?count)
?kind
WHERE {
{
VALUES ?year_ { 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 }
BIND(0 AS ?count_)
BIND("_" AS ?kind)
}
UNION
{
SELECT
?year_
(COUNT(DISTINCT ?citing_work) AS ?count_)
?kind
WHERE {
?citing_work wdt:P2860 / wdt:P50 target: .
# Detect self-citations
BIND(IF(EXISTS { ?citing_work wdt:P50 target: } ,
"detected incoming self-citations",
"citations from others or non-detected self-citations") AS ?kind)
# Year of citation
?citing_work wdt:P577 ?date .
BIND(YEAR(?date) AS ?year_)
}
GROUP BY ?year_ ?kind
}
UNION
{
SELECT
?year_
(COUNT(DISTINCT ?cited_work) AS ?count_)
?kind
WHERE {
?work wdt:P50 target: ;
wdt:P2860 ?cited_work .
# Detect self-citations
BIND(IF(EXISTS { ?cited_work wdt:P50 target: },
"detected outgoing self-citations",
"outgoing citations to others or non-detected self-citations") AS ?kind)
# Year of citation
?work wdt:P577 ?date .
BIND(YEAR(?date) AS ?year_)
}
GROUP BY ?year_ ?kind
}
}
GROUP BY ?year_ ?kind
ORDER BY DESC(?year_)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?cited_work")
v4("?citing_work")
v9("?count")
v8("?count_"):::projected
v5("?date")
v8("?kind"):::projected
v6("?work")
v8("?year")
v8("?year_"):::projected
a1((" "))
c3([http://www.wikidata.org/entity/Q18618629]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P50"--> c3
v6 --"wdt:P2860"--> v7
v7 --"wdt:P50"--> c3
bind0[/"if( ,'detected outgoing self-citations','outgoing citations to others or non-detected self-citations')"/]
subgraph bind0e0["Exists Clause"]
e0v1 --"wdt:P50"--> e0c2
e0v1("?cited_work"):::projected
e0c2([http://www.wikidata.org/entity/Q18618629]):::iri
end
bind0--EXISTS--> bind0e0
v7 --o bind0
c2 --o bind0
c3 --o bind0
bind0 --as--o v8
v6 --"wdt:P577"--> v5
bind1[/"year-from-dateTime(?date)"/]
v5 --o bind1
bind1 --as--o v8
bind3[/"count(?cited_work)"/]
v7 --o bind3
bind3 --as--o v8
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P2860"--> a1
a1 --"wdt:P50"--> c3
v4 --"wdt:P50"--> c3
bind4[/"if( ,'detected incoming self-citations','citations from others or non-detected self-citations')"/]
subgraph bind4e1["Exists Clause"]
e1v1 --"wdt:P50"--> e1c2
e1v1("?citing_work"):::projected
e1c2([http://www.wikidata.org/entity/Q18618629]):::iri
end
bind4--EXISTS--> bind4e1
v4 --o bind4
c2 --o bind4
c3 --o bind4
bind4 --as--o v8
v4 --"wdt:P577"--> v5
bind5[/"year-from-dateTime(?date)"/]
v5 --o bind5
bind5 --as--o v8
bind7[/"count(?citing_work)"/]
v4 --o bind7
bind7 --as--o v8
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
bind8[/VALUES ?year_/]
bind8-->v8
bind80(["2004^^xsd:integer"])
bind80 --> bind8
bind81(["2005^^xsd:integer"])
bind81 --> bind8
bind82(["2006^^xsd:integer"])
bind82 --> bind8
bind83(["2007^^xsd:integer"])
bind83 --> bind8
bind84(["2008^^xsd:integer"])
bind84 --> bind8
bind85(["2009^^xsd:integer"])
bind85 --> bind8
bind86(["2010^^xsd:integer"])
bind86 --> bind8
bind87(["2011^^xsd:integer"])
bind87 --> bind8
bind88(["2012^^xsd:integer"])
bind88 --> bind8
bind89(["2013^^xsd:integer"])
bind89 --> bind8
bind810(["2014^^xsd:integer"])
bind810 --> bind8
bind811(["2015^^xsd:integer"])
bind811 --> bind8
bind812(["2016^^xsd:integer"])
bind812 --> bind8
bind813(["2017^^xsd:integer"])
bind813 --> bind8
bind814(["2018^^xsd:integer"])
bind814 --> bind8
bind815(["2019^^xsd:integer"])
bind815 --> bind8
bind816(["2020^^xsd:integer"])
bind816 --> bind8
bind817(["2021^^xsd:integer"])
bind817 --> bind8
bind818(["2022^^xsd:integer"])
bind818 --> bind8
bind819(["2023^^xsd:integer"])
bind819 --> bind8
bind9[/"'0^^xsd:integer'"/]
bind9 --as--o v8
bind10[/"'_'"/]
bind10 --as--o v8
end
union0r <== or ==> union0l
end
bind12[/"str(?year_)"/]
v8 --o bind12
bind12 --as--o v8
bind13[/"sum(?count_)"/]
v8 --o bind13
bind13 --as--o v9