query-a8d1905f92023d7231ea63c41113323d

rq turtle/ttl

Athletes with Paralympic.org ID and Olympic Committee ID but no Country for Sport with stated in used as a reference. Property:P1532 Country for SportUses national Paralympic committee identifiers to infer country for sport. Goal of importing the country results of this query as

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 DISTINCT ?athlete ?athleteLabel ?dbCountry ?dbCountryLabel ?statedInRef ?statedInRefLabel WHERE {
  ?athlete wdt:P7550 ?paraID. #retrieve all athletes with a global paralympic id
  MINUS{?athlete wdt:P1532 ?country.} #remove those with country for sport specified 
  ?database wdt:P31 wd:Q30225604. #find all national database id properties related to paralympics 
  ?database wdt:P17 ?dbCountry. #find countries for those databases
  ?database wikibase:directClaim ?databaseProp.
  ?athlete ?databaseProp ?countryID. #find athletes who appear in those databases
  OPTIONAL{
    ?dbQID wdt:P1687 ?database.
    ?dbQID wdt:P31/wdt:P279* wd:Q7094076.
  }
  OPTIONAL{ ?database wdt:P9073 ?statedIn. }
  BIND(COALESCE(?statedIn, ?dbQID) as ?statedInRef)
  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("?athlete"):::projected v3("?country") v7("?countryID") v4("?database") v6("?databaseProp") v5("?dbCountry"):::projected v8("?dbQID") v2("?paraID") v9("?statedIn") v10("?statedInRef"):::projected a1((" ")) c9(["wd:Q7094076"]):::iri c12(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q30225604"]):::iri v1 --"wdt:P7550"--> v2 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P1532"--> v3 end v4 --"wdt:P31"--> c4 v4 --"wdt:P17"--> v5 v4 --"wikibase:directClaim"--> v6 v1 -->v6--> v7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v8 -."wdt:P1687".-> v4 v8 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c9 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P9073".-> v9 end bind1[/"?statedIn?dbQID"/] v9 --o bind1 v8 --o bind1 bind1 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end