WDscholia / scholia

Wikidata-based scholarly profiles
https://scholia.toolforge.org
Other
223 stars 81 forks source link

Citations for topics aspect #622

Open fnielsen opened 5 years ago

fnielsen commented 5 years ago

Citations for topics aspect:


SELECT
  (SAMPLE(?citations_) AS ?citations)
  (MIN(?publication_date_) AS ?publication_date)
  ?cited_work ?cited_workLabel
WITH {
  SELECT (COUNT(?topic) AS ?count) ?work
    (GROUP_CONCAT(DISTINCT ?topic_label; separator=" // ") AS ?topics)
  WHERE {
    VALUES ?topic {  wd:Q1513879  wd:Q2013  }

    # A broad query including "(wdt:P361+ | wdt:P1269+ | (wdt:P31* / wdt:P279*) )" seems to take
    # long time and time out.
    ?work wdt:P921 ?topic  .
    ?topic rdfs:label ?topic_label .
    FILTER(LANG(?topic_label) = 'en')
  }
  GROUP BY ?work ?topics
  HAVING(?count > 1)
  ORDER BY DESC(?count)
  LIMIT 200
} AS %works
WITH {
  SELECT 
    (COUNT(?work) AS ?citations_)
    ?cited_work
  WHERE {
    INCLUDE %works

    ?work wdt:P2860 ?cited_work .
  }
  GROUP BY ?cited_work
} AS %results
WHERE {
  INCLUDE %results
  OPTIONAL {
    ?cited_work wdt:P577 ?publication_datetime .
    BIND(xsd:date(?publication_datetime) AS ?publication_date_)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh". }
}
GROUP BY ?cited_work ?cited_workLabel
ORDER BY DESC(?citations) DESC(?publication_date)
Daniel-Mietchen commented 5 years ago

This seems to be "Citations from (recent) works on the target topic(s) to other works", i.e. the plural form of #528 .

There could also be "Citations from (recent) works to works on the target topic(s)", i.e. the plural of #214.