query-e0154fa13d077893f39eef58b0e1ab78
Multi-graph and colors, I tried to do the following query (somewhat ridiculous but for the fun of it :-รพ) User:Fuzheado/queriesInspired by
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Graph
SELECT ?item1 ?image1 ?item1Label ?item2 ?image2 ?item2Label ?edgeLabel ?rgb
WHERE {
{
SELECT ?item1 ?rgb WHERE {
{
SELECT (?character as ?item1) WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
?game wdt:P674 ?character.
}
}
UNION
{
# Find sport -
SELECT (?sport as ?item1) WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
?game wdt:P674 ?character.
?character wdt:P641 ?sport.
}
}
UNION
{
# Find games
SELECT (?game as ?item1) ?rgb WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
BIND("7FFF00" as ?rgb)
}
}
}
}.
{
SELECT (?item1 AS ?item2) WHERE {
{
SELECT ?item1 ?rgb WHERE {
{
SELECT (?character as ?item1) WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
?game wdt:P674 ?character.
}
}
UNION
{
# Find sport -
SELECT (?sport as ?item1) WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
?game wdt:P674 ?character.
?character wdt:P641 ?sport.
}
}
UNION
{
# Find games
SELECT (?game as ?item1) ?rgb WHERE {
?game wdt:P31 wd:Q7889.
?game wdt:P179 wd:Q219623.
BIND("7FFF00" as ?rgb)
}
}
}
}
}
}.
?item1 ?wdt ?item2 .
?edge wikibase:directClaim ?wdt;
a wikibase:Property .
OPTIONAL { ?item1 wdt:P18 ?image1 . }
OPTIONAL { ?item2 wdt:P18 ?image2 . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?character")
v8("?edge")
v1("?game")
v9("?image1"):::projected
v10("?image2"):::projected
v6("?item1"):::projected
v6("?item2"):::projected
v6("?rgb"):::projected
v4("?sport")
v7("?wdt")
c9(["wikibase:Property"]):::iri
c12(["bd:serviceParam"]):::iri
c2(["wd:Q7889"]):::iri
c4(["wd:Q219623"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
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;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
bind0[/"'7FFF00'"/]
bind0 --as--o v6
bind1[/"?game"/]
v1 --o bind1
bind1 --as--o v6
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
v1 --"wdt:P674"--> v2
v2 --"wdt:P641"--> v4
bind2[/"?sport"/]
v4 --o bind2
bind2 --as--o v6
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
v1 --"wdt:P674"--> v2
bind3[/"?character"/]
v2 --o bind3
bind3 --as--o v6
end
union0r <== or ==> union0l
end
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;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
bind4[/"'7FFF00'"/]
bind4 --as--o v6
bind5[/"?game"/]
v1 --o bind5
bind5 --as--o v6
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
v1 --"wdt:P674"--> v2
v2 --"wdt:P641"--> v4
bind6[/"?sport"/]
v4 --o bind6
bind6 --as--o v6
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> c2
v1 --"wdt:P179"--> c4
v1 --"wdt:P674"--> v2
bind7[/"?character"/]
v2 --o bind7
bind7 --as--o v6
end
union2r <== or ==> union2l
end
bind8[/"?item1"/]
v6 --o bind8
bind8 --as--o v6
v6 -->v7--> v6
v8 --"wikibase:directClaim"--> v7
v8 --"a"--> c9
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P18".-> v9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P18".-> v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end