query-aa5f2a949a2630b2a882a8998a65c294
US gymnastics SELECT DISTINCT ?item ?itemLabel ?usaid ?usid WHERE { ?item wdt:P31 wd:Q5 . { ?item wdt:P4668 ?usaid . OPTIONAL { ?item wdt:P4583 ?usid } } UNION { ?item wdt:P4583 ?usid . OPTIONAL { ?item wdt:P4668 ?usaid } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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#>
#US gymnastics
SELECT DISTINCT ?item ?itemLabel ?usaid ?usid
WHERE
{
?item wdt:P31 wd:Q5 .
{ ?item wdt:P4668 ?usaid . OPTIONAL { ?item wdt:P4583 ?usid } }
UNION
{ ?item wdt:P4583 ?usid . OPTIONAL { ?item wdt:P4668 ?usaid } }
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;
v1("?item"):::projected
v2("?usaid"):::projected
v3("?usid"):::projected
c6(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P31"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P4583"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P4668".-> v2
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P4668"--> v2
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P4583".-> v3
end
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end