query-106ddae8e1684485a25107465a130a72

rq turtle/ttl

OS SELECT ?product ?productLabel ?productType WHERE { VALUES ?product { wd:Q1406 wd:Q14116 wd:Q48493 wd:Q94 }. # macOS, Windows, iOS, Android OPTIONAL { ?product wdt:P31 ?isMobile. FILTER (?isMobile = wd:Q920890) } BIND(IF(BOUND(?isMobile), "MobileOS", "DesktopOS") AS ?productType) # if instance of mobileOS... SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

Use at

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
  OPTIONAL
  {
    ?product wdt:P31 ?isMobile.
    FILTER (?isMobile = wd:Q920890)
  }
  BIND(IF(BOUND(?isMobile), "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("?isMobile") v2("?product"):::projected v3("?productType"):::projected c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?product/] bind0-->v2 bind00(["wd:Q1406"]) bind00 --> bind0 bind01(["wd:Q14116"]) bind01 --> bind0 bind02(["wd:Q48493"]) bind02 --> bind0 bind03(["wd:Q94"]) bind03 --> bind0 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P31".-> v1 end bind1[/"if(bound(?isMobile),'MobileOS','DesktopOS')"/] v1 --o bind1 bind1 --as--o v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end