query-e92d75b87c9250a135110bd29282812d
OS SELECT ?product ?productLabel ?productType WHERE { VALUES ?product { wd:Q1406 wd:Q14116 wd:Q48493 wd:Q94 }. # macOS, Windows, iOS, Android BIND(IF(EXISTS { ?product wdt:P31 wd:Q920890 }, "MobileOS", "DesktopOS") AS ?productType) # if instance of mobileOS... 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#>
#OS
SELECT ?product ?productLabel ?productType
WHERE
{
VALUES ?product { wd:Q1406 wd:Q14116 wd:Q48493 wd:Q94 }. # macOS, Windows, iOS, Android
BIND(IF(EXISTS { ?product wdt:P31 wd:Q920890 }, "MobileOS", "DesktopOS") AS ?productType) # if instance of mobileOS...
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("?product"):::projected
v2("?productType"):::projected
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?product/]
bind0-->v1
bind00(["wd:Q1406"])
bind00 --> bind0
bind01(["wd:Q14116"])
bind01 --> bind0
bind02(["wd:Q48493"])
bind02 --> bind0
bind03(["wd:Q94"])
bind03 --> bind0
v1 --"wdt:P31"--> null
bind1[/"if( ,'MobileOS','DesktopOS')"/]
subgraph bind1e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?product"):::projected
e0c2(["wd:Q920890"]):::iri
end
bind1--EXISTS--> bind1e0
v1 --o bind1
null --o bind1
null --o bind1
bind1 --as--o v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end