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/author_citations-by-year.sparql
Author aspect: citations by year
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#defaultView:BarChart
PREFIX target: <http://www.wikidata.org/entity/Q97270>
SELECT ?year (count(distinct ?citing_work) as ?count) ?kind WHERE {
?work wdt:P50 target: .
?citing_work wdt:P2860 ?work .
bind(if (exists { ?citing_work wdt:P50 target: }, "self-citations", "citations from others") as ?kind)
?citing_work wdt:P577 ?date .
BIND(str(YEAR(?date)) AS ?year)
} group by ?year ?kind
order by desc(?year)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?citing_work"):::projected
v6("?count")
v5("?date")
v4("?kind"):::projected
v2("?work")
v6("?year"):::projected
c2([http://www.wikidata.org/entity/Q97270]):::iri
v2 --"p:direct/P50"--> c2
v3 --"p:direct/P2860"--> v2
v3 --"p:direct/P50"--> c2
bind0[/"if( ,'self-citations','citations from others')"/]
subgraph bind0e0["Exists Clause"]
e0v1 --"p:direct/P50"--> e0c2
e0v1("?citing_work"):::projected
e0c2([http://www.wikidata.org/entity/Q97270]):::iri
end
bind0--EXISTS--> bind0e0
v3 --o bind0
c1 --o bind0
c2 --o bind0
bind0 --as--o v4
v3 --"p:direct/P577"--> v5
bind1[/"str(year-from-dateTime(?date))"/]
v5 --o bind1
bind1 --as--o v6
bind3[/"count(?citing_work)"/]
v3 --o bind3
bind3 --as--o v6