query-3befc2e1428288627bda2ec4a0b0e0c2

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table;
#------------------------------------------------------------------------------------
# opera singers who are sopranos with article in English Wikipedia and no data in voice type
#------------------------------------------------------------------------------------
SELECT DISTINCT ?item ?itemLabel ?desc_en ?voice_typeLabel ?maybe_sopran ?article_en ?article_de  
WHERE {
  ?item wdt:P31 wd:Q5.                # is human
  ?item wdt:P106 wd:Q2865819.         # and occupatition is opera singer
  MINUS { ?item wdt:P412  [] }        # and has no data in voice type

  ?item schema:description ?desc_en . filter (lang(?desc_en) = "en").            # get english description
  BIND(IF(REGEX(STR(?desc_en), "sopran","i"),"sopran"," - ") AS ?maybe_sopran)   # check english description for "sopran"
  FILTER(CONTAINS(?maybe_sopran, 'sopran')) .                                    # filter only sopran

  ?article_en schema:about ?item.
  ?article_en schema:isPartOf <https://en.wikipedia.org/>.    # article in English

  OPTIONAL {
    ?article_de schema:about ?item.
    ?article_de schema:isPartOf <https://de.wikipedia.org/>.    # article in German
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
order by ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?article_de"):::projected v5("?article_en"):::projected v3("?desc_en"):::projected v4("?item"):::projected v1("?itemLabel"):::projected v5("?maybe_sopran"):::projected a1((" ")) c12([https://de.wikipedia.org/]):::iri c11([https://en.wikipedia.org/]):::iri c14(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal c6(["wd:Q2865819"]):::iri f0[["contains(?maybe_sopran,'sopran')"]] f0 --> v5 f1[["?desc_en = 'en'"]] f1 --> v3 v4 --"wdt:P31"--> c4 v4 --"wdt:P106"--> c6 subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v4 --"wdt:P412"--> a1 end v4 --"schema:description"--> v3 bind3[/"if(regex(str(?desc_en),'sopran','i'),'sopran',' - ')"/] v3 --o bind3 bind3 --as--o v5 v5 --"schema:about"--> v4 v5 --"schema:isPartOf"--> c11 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."schema:about".-> v4 v6 --"schema:isPartOf"--> c12 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end