?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 "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?number_of_works)
Use at
https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# tool: scholia
PREFIX target1: <http://www.wikidata.org/entity/Q36>
PREFIX target2: <http://www.wikidata.org/entity/Q52>
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)
WHERE {
{
SELECT
?organization
(COUNT(DISTINCT ?work) AS ?number_of_works)
(COUNT(DISTINCT ?author) AS ?number_of_authors)
(SAMPLE(?work) AS ?example_work)
WHERE {
{
SELECT
?work
WHERE {
?work wdt:P921 / (wdt:P361| wdt:P1269 | wdt:P31 | wdt:P279)? target2:
}
} ?work wdt:P50 ?author .
?author ( wdt:P108 | wdt:P1416 ) ?organization .
?organization wdt:P17 target1: .
}
GROUP BY ?organization
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?number_of_works)