Skip to content

Commit d1eb12f

Browse files
committed
Fix #2583 Better author score for multiple topics
1 parent 189d70a commit d1eb12f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

scholia/app/templates/topics_authors.sparql

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# title: Authors for specific topics
22
SELECT
3-
?score
3+
((?distinct_topics + ?topics / (?topics + 100)) AS ?score)
44
?author ?authorLabel (CONCAT("/author/", SUBSTR(STR(?author), 32)) AS ?authorUrl)
55
?example_work ?example_workLabel (CONCAT("/work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
66
WITH {
7-
SELECT (COUNT(?topic) AS ?score) ?author (SAMPLE(?work_) AS ?example_work)
8-
WHERE {
7+
SELECT
8+
(COUNT(DISTINCT ?topic) AS ?distinct_topics)
9+
(COUNT(?topic) AS ?topics)
10+
?author
11+
(SAMPLE(?work) AS ?example_work)
12+
WHERE {
913
VALUES ?topic { {% for q in qs %} wd:{{ q }} {% endfor %} }
1014

1115
# A broad query including "(wdt:P361+ | wdt:P1269+ | (wdt:P31* / wdt:P279*) )" seems to take
1216
# long time and time out.
13-
?work wdt:P921 ?topic .
14-
?work wdt:P2860 ?cited_work .
15-
{ ?cited_work wdt:P50 ?author . BIND(?cited_work AS ?work_) }
16-
UNION
17-
{ ?work wdt:P50 ?author . BIND(?work AS ?work_) }
17+
?work wdt:P921 ?topic ;
18+
wdt:P50 ?author .
1819
}
1920
GROUP BY ?author
20-
ORDER BY DESC(?score)
21+
ORDER BY DESC(?distinct_topics) DESC(?topics)
2122
LIMIT 200
2223
} AS %results
2324
WHERE {

0 commit comments

Comments
 (0)