query-5ac1c1db226eccd9ab2a4b1dceb6a57b
Collaborating organizations
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#>
PREFIX target: <http://www.wikidata.org/entity/Q1269766>
SELECT DISTINCT
?collaborations
(CONCAT("#organization/", SUBSTR(STR(target:), 32), "/organization/", SUBSTR(STR(?organization), 32)) AS ?collaborationsUrl)
?example_home_author ?example_home_authorLabel
(CONCAT("#author/", SUBSTR(STR(?example_home_author), 32)) AS ?example_home_authorUrl)
?organization ?organizationLabel
?example_foreign_author ?example_foreign_authorLabel
(CONCAT("#author/", SUBSTR(STR(?example_foreign_author), 32)) AS ?example_foreign_authorUrl)
?example_work ?example_workLabel
WHERE {
{
SELECT
(COUNT(DISTINCT ?work) AS ?collaborations)
?organization
(SAMPLE(?author1) AS ?example_home_author)
(SAMPLE(?author2) AS ?example_foreign_author)
(SAMPLE(?work) AS ?example_work)
WHERE {
?author1 (wdt:P1416 | wdt:P108) target: .
?author2 (wdt:P1416 | wdt:P108) ?organization .
?work wdt:P50 ?author1, ?author2 .
FILTER (target: != ?organization)
}
GROUP BY ?organization
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?collaborations)
LIMIT 500
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?author1")
v4("?author2")
v6("?collaborations"):::projected
v9("?collaborationsUrl")
v7("?example_foreign_author"):::projected
v11("?example_foreign_authorUrl")
v6("?example_home_author"):::projected
v10("?example_home_authorUrl")
v8("?example_work"):::projected
v2("?organization"):::projected
v5("?work")
c6(["bd:serviceParam"]):::iri
c1([http://www.wikidata.org/entity/Q1269766]):::iri
c8(["en"]):::literal
f0[["http://www.wikidata.org/entity/Q1269766 != ?organization"]]
f0 --> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P108"--> c1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P1416"--> c1
end
union0r <== or ==> union0l
end
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P108"--> v2
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P1416"--> v2
end
union1r <== or ==> union1l
end
v5 --"wdt:P50"--> v3
v5 --"wdt:P50"--> v4
bind5[/"count(?work)"/]
v5 --o bind5
bind5 --as--o v6
bind6[/"sample(?author1)"/]
v3 --o bind6
bind6 --as--o v6
bind7[/"sample(?author2)"/]
v4 --o bind7
bind7 --as--o v7
bind8[/"sample(?work)"/]
v5 --o bind8
bind8 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end
bind9[/"concat('#organization/',substring(str(http://www.wikidata.org/entity/Q1269766),'32^^xsd:integer'),'/organization/',substring(str(?organization),'32^^xsd:integer'))"/]
v2 --o bind9
bind9 --as--o v9
bind10[/"concat('#author/',substring(str(?example_home_author),'32^^xsd:integer'))"/]
v6 --o bind10
bind10 --as--o v10
bind11[/"concat('#author/',substring(str(?example_foreign_author),'32^^xsd:integer'))"/]
v7 --o bind11
bind11 --as--o v11