query-a7cb49edb10360efb3b0fcfb13dba990
🪣 Invasion biology in a broader context that includes restoration ecology, urban ecology and freshwater ecology
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#>
#defaultView:Graph
#title: Invasion biology in a broader context that includes restoration ecology, urban ecology and freshwater ecology
PREFIX target1: <http://www.wikidata.org/entity/Q183368> # invasive species
PREFIX target2: <http://www.wikidata.org/entity/Q2428433> # restoration ecology
PREFIX target3: <http://www.wikidata.org/entity/Q60566657> # freshwater ecology
PREFIX target4: <http://www.wikidata.org/entity/Q1430301> # urban ecology
PREFIX target5: <http://www.wikidata.org/entity/Q42985020> # invasion biology
SELECT
?topic1 ?topic1Label ?rgb ?topic2 ?topic2Label
WHERE {
{
SELECT
(COUNT(DISTINCT ?work) AS ?count) ?topic1 ?topic2 ?rgb
WHERE {
# Find works that are marked with main subject of the topic.
{?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target1: .}
UNION
{?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target2: .}
UNION
{?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target3: .}
UNION
{?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target4: .}
UNION
{?work wdt:P921 / ( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) target5: .}
# Identify co-occuring topics.
?work wdt:P921 ?topic1, ?topic2 .
# Exclude the topic it self
FILTER (target1: != ?topic1 && target1: != ?topic2 && ?topic1 != ?topic2)
BIND(IF(?topic1 = target5:,"7FFF00",
IF( ?topic1 = target4:, "3080BB",
IF( ?topic1 = target3:, "3080BB",
IF( ?topic1 = target2:, "3080BB",
"FFA500"
)
)
)
)
AS ?rgb).
}
GROUP BY ?topic1 ?topic2 ?rgb
ORDER BY DESC(?count)
# There a performance problems in the browser: We cannot show large graphs,
# so we put a limit on the number of links displayed.
LIMIT 200
}
# Label the results
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh".
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count")
v5("?rgb"):::projected
v2("?topic1"):::projected
v3("?topic2"):::projected
v4("?work")
a1((" "))
a2((" "))
a3((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
a10((" "))
c9([http://www.wikidata.org/entity/Q1430301]):::iri
c8([http://www.wikidata.org/entity/Q60566657]):::iri
c7([http://www.wikidata.org/entity/Q2428433]):::iri
c10([http://www.wikidata.org/entity/Q42985020]):::iri
c1([http://www.wikidata.org/entity/Q183368]):::iri
c14(["en,da,de,es,fr,jp,nl,no,ru,sv,zh"]):::literal
c12(["bd:serviceParam"]):::iri
f0[["http://www.wikidata.org/entity/Q183368 != ?topic1http://www.wikidata.org/entity/Q183368 != ?topic2?topic1 != ?topic2"]]
f0 --> v2
f0 --> v3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P921"--> a9
subgraph union4[" Union "]
subgraph union4l[" "]
style union4l fill:#abf,stroke-dasharray: 3 3;
subgraph union5[" Union "]
subgraph union5l[" "]
style union5l fill:#abf,stroke-dasharray: 3 3;
a9 --"wdt:P1269"--> c10
end
subgraph union5r[" "]
style union5r fill:#abf,stroke-dasharray: 3 3;
a9 --"wdt:P361"--> c10
end
union5r <== or ==> union5l
end
end
subgraph union4r[" "]
style union4r fill:#abf,stroke-dasharray: 3 3;
a9 --"wdt:P31"--> a10
a10 --"wdt:P279"--> c10
end
union4r <== or ==> union4l
end
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P921"--> a7
subgraph union6[" Union "]
subgraph union6l[" "]
style union6l fill:#abf,stroke-dasharray: 3 3;
subgraph union7[" Union "]
subgraph union7l[" "]
style union7l fill:#abf,stroke-dasharray: 3 3;
a7 --"wdt:P1269"--> c9
end
subgraph union7r[" "]
style union7r fill:#abf,stroke-dasharray: 3 3;
a7 --"wdt:P361"--> c9
end
union7r <== or ==> union7l
end
end
subgraph union6r[" "]
style union6r fill:#abf,stroke-dasharray: 3 3;
a7 --"wdt:P31"--> a8
a8 --"wdt:P279"--> c9
end
union6r <== or ==> union6l
end
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P921"--> a5
subgraph union8[" Union "]
subgraph union8l[" "]
style union8l fill:#abf,stroke-dasharray: 3 3;
subgraph union9[" Union "]
subgraph union9l[" "]
style union9l fill:#abf,stroke-dasharray: 3 3;
a5 --"wdt:P1269"--> c8
end
subgraph union9r[" "]
style union9r fill:#abf,stroke-dasharray: 3 3;
a5 --"wdt:P361"--> c8
end
union9r <== or ==> union9l
end
end
subgraph union8r[" "]
style union8r fill:#abf,stroke-dasharray: 3 3;
a5 --"wdt:P31"--> a6
a6 --"wdt:P279"--> c8
end
union8r <== or ==> union8l
end
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P921"--> a3
subgraph union10[" Union "]
subgraph union10l[" "]
style union10l fill:#abf,stroke-dasharray: 3 3;
subgraph union11[" Union "]
subgraph union11l[" "]
style union11l fill:#abf,stroke-dasharray: 3 3;
a3 --"wdt:P1269"--> c7
end
subgraph union11r[" "]
style union11r fill:#abf,stroke-dasharray: 3 3;
a3 --"wdt:P361"--> c7
end
union11r <== or ==> union11l
end
end
subgraph union10r[" "]
style union10r fill:#abf,stroke-dasharray: 3 3;
a3 --"wdt:P31"--> a4
a4 --"wdt:P279"--> c7
end
union10r <== or ==> union10l
end
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"wdt:P921"--> a1
subgraph union12[" Union "]
subgraph union12l[" "]
style union12l fill:#abf,stroke-dasharray: 3 3;
subgraph union13[" Union "]
subgraph union13l[" "]
style union13l fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P1269"--> c1
end
subgraph union13r[" "]
style union13r fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P361"--> c1
end
union13r <== or ==> union13l
end
end
subgraph union12r[" "]
style union12r fill:#abf,stroke-dasharray: 3 3;
a1 --"wdt:P31"--> a2
a2 --"wdt:P279"--> c1
end
union12r <== or ==> union12l
end
end
union0r <== or ==> union0l
end
v4 --"wdt:P921"--> v2
v4 --"wdt:P921"--> v3
bind1[/"if(?topic1 = http://www.wikidata.org/entity/Q42985020,'7FFF00',if(?topic1 = http://www.wikidata.org/entity/Q1430301,'3080BB',if(?topic1 = http://www.wikidata.org/entity/Q60566657,'3080BB',if(?topic1 = http://www.wikidata.org/entity/Q2428433,'3080BB','FFA500'))))"/]
v2 --o bind1
bind1 --as--o v5
bind3[/"count(?work)"/]
v4 --o bind3
bind3 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end