query-ca6e1d4eae54a57cb297eeb33301fc2b

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#>
SELECT DISTINCT ?item ?itemLabel ?lang ?article WHERE 
{  
  VALUES ?country {wd:Q36}
  ?item wdt:P31 wd:Q23413.

  OPTIONAL { ?article1 schema:about ?item ;
                       schema:isPartOf <https://en.wikipedia.org/> .  
           }
  OPTIONAL { ?item wdt:P17 ?country.
             ?article2 schema:about ?item ;
                       schema:inLanguage ?lang ;
                       schema:isPartOf [ wikibase:wikiGroup "wikipedia" ] .
            ?country wdt:P37/wdt:P424 ?lang. 
           }
  BIND(COALESCE(?article1,?article2) as ?article)
  FILTER(BOUND(?article))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?article"):::projected v4("?article1") v5("?article2") v2("?country") v3("?item"):::projected v6("?lang"):::projected a1((" ")) a2((" ")) c2(["wd:Q23413"]):::iri c5([https://en.wikipedia.org/]):::iri c13(["bd:serviceParam"]):::iri c15(["#91;AUTO_LANGUAGE#93;"]):::literal c9(["wikipedia"]):::literal f0[["bound(?article)"]] f0 --> v7 bind1[/VALUES ?country/] bind1-->v2 bind10(["wd:Q36"]) bind10 --> bind1 v3 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."schema:about".-> v3 v4 --"schema:isPartOf"--> c5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P17".-> v2 v5 --"schema:about"--> v3 v5 --"schema:inLanguage"--> v6 a1 --"wikibase:wikiGroup"--> c9 v5 --"schema:isPartOf"--> a1 v2 --"wdt:P37"--> a2 a2 --"wdt:P424"--> v6 end bind2[/"?article1?article2"/] v4 --o bind2 v5 --o bind2 bind2 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end