Skip to content

Commit

Permalink
Fix 2276: organization panel on country-topic aspect
Browse files Browse the repository at this point in the history
  • Loading branch information
fnielsen committed Apr 26, 2023
1 parent 63b27b2 commit 5773ebb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scholia/app/templates/country-topic.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

{% block in_ready %}

{{ sparql_to_table('organizations') }}

{{ sparql_to_table('authors') }}

{{ sparql_to_iframe('coauthors-graph') }}
Expand All @@ -19,6 +21,12 @@ <h1 id="h1">Country-topic</h1>
<div id="intro"></div>


<h2 id="organizations">Organizations of the country who published on the topics</h2>

<table class="table table-hover" id="organizations-table"></table>



<h2 id="authors">Authors of the country who published on the topics</h2>

<table class="table table-hover" id="authors-table"></table>
Expand Down
37 changes: 37 additions & 0 deletions scholia/app/templates/country-topic_organizations.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PREFIX target1: <http://www.wikidata.org/entity/{{ q1 }}>
PREFIX target2: <http://www.wikidata.org/entity/{{ q2 }}>

SELECT
?number_of_works
?number_of_authors

?organization ?organizationLabel
(CONCAT("/organization/", SUBSTR(STR(?organization), 32)) AS ?organizationUrl)

?example_work ?example_workLabel (CONCAT("/work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WITH {
SELECT
?work
WHERE {
?work wdt:P921 / (wdt:P361 | wdt:P1269 | wdt:P31 | wdt:P279)* target2:
}
} AS %works
WITH {
SELECT
?organization
(COUNT(DISTINCT ?work) AS ?number_of_works)
(COUNT(DISTINCT ?author) AS ?number_of_authors)
(SAMPLE(?work) AS ?example_work)
WHERE {
INCLUDE %works
?work wdt:P50 ?author .
?author ( wdt:P108 | wdt:P1416 ) ?organization .
?organization wdt:P17 target1: .
}
GROUP BY ?organization
} AS %results
WHERE {
INCLUDE %results
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh". }
}
ORDER BY DESC(?number_of_works)

0 comments on commit 5773ebb

Please sign in to comment.