query-d547aec57a71e3afdfd77a9d39ef4e16

rq turtle/ttl

multiple optional conditionsHi! we currently try to request a query for a list of q-numbers. The q-number is replaced from time to time. Depending on the requested q-number the given values of orcid, employer(s) and gender are given (or not) in the data set of the item. Therefore, those values should somehow be indicated as "optional".

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#>
SELECT  ?orcid ?employerLabel ?genderLabel ?parents ?parentsLabel
                        WHERE { 
                         OPTIONAL {?item wdt:P496 ?orcid }.  
                         OPTIONAL {?item wdt:P108 ?employer }. 
                         OPTIONAL {?item wdt:P21 ?gender }.

                         Values ?item { wd:Q28360163 }. 
                         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; v3("?employer") v4("?gender") v5("?item") v2("?orcid"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P496".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P108".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P21".-> v4 end bind0[/VALUES ?item/] bind0-->v5 bind00(["wd:Q28360163"]) bind00 --> bind0 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end