query-57d6ab11e327f544efd2cbf4a2de5db3
Collaborations
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 target1: <http://www.wikidata.org/entity/Q1269766>
PREFIX target2: <http://www.wikidata.org/entity/Q193196>
SELECT DISTINCT
?collaborations
?author1 ?author1Label
(CONCAT("#author/", SUBSTR(STR(?author1), 32)) AS ?author1Url)
?example_author2 ?example_author2Label
(CONCAT("#author/", SUBSTR(STR(?example_author2), 32)) AS ?example_author2Url)
?example_work ?example_workLabel
(CONCAT("#work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WHERE {
{
SELECT
(COUNT(DISTINCT ?work) AS ?collaborations)
?author1
(SAMPLE(?author2) AS ?example_author2)
(SAMPLE(?work) AS ?example_work)
WHERE {
?author1 (wdt:P1416| wdt:P108) target1: .
?author2 (wdt:P1416 | wdt:P108) target2: .
?work wdt:P50 ?author1, ?author2 .
FILTER (STR(?author1) < STR(?author2))
}
GROUP BY ?author1
} 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;
v2("?author1"):::projected
v7("?author1Url")
v3("?author2")
v5("?collaborations"):::projected
v5("?example_author2"):::projected
v8("?example_author2Url")
v6("?example_work"):::projected
v9("?example_workUrl")
v4("?work")
c7(["bd:serviceParam"]):::iri
c2([http://www.wikidata.org/entity/Q1269766]):::iri
c4([http://www.wikidata.org/entity/Q193196]):::iri
c9(["en"]):::literal
f0[["str(?author1) < str(?author2)"]]
f0 --> v2
f0 --> v3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P108"--> c2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P1416"--> c2
end
union0r <== or ==> union0l
end
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P108"--> c4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P1416"--> c4
end
union1r <== or ==> union1l
end
v4 --"wdt:P50"--> v2
v4 --"wdt:P50"--> v3
bind4[/"count(?work)"/]
v4 --o bind4
bind4 --as--o v5
bind5[/"sample(?author2)"/]
v3 --o bind5
bind5 --as--o v5
bind6[/"sample(?work)"/]
v4 --o bind6
bind6 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind7[/"concat('#author/',substring(str(?author1),'32^^xsd:integer'))"/]
v2 --o bind7
bind7 --as--o v7
bind8[/"concat('#author/',substring(str(?example_author2),'32^^xsd:integer'))"/]
v5 --o bind8
bind8 --as--o v8
bind9[/"concat('#work/',substring(str(?example_work),'32^^xsd:integer'))"/]
v6 --o bind9
bind9 --as--o v9