query-3f6defbae50a6bc203df654707cd7cea

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?itemLabel ?itemDescription
                          # we take the results of this named query - a list of ?item and ?citizenship_count
where 
{
   { SELECT ?item (count(distinct ?citizenships) as ?citizenship_count) WHERE 
{
  ?item wdt:P106 wd:Q10833314 . # they're a tennis player
  ?item wdt:P27 wd:Q31.         # they're Belgian
  ?item wdt:P27 ?citizenships.  # get any & all of their citizenships - this creates one row per citizenship
} group by ?item  }                   # and run a second query over the results
  filter (?citizenship_count<2) # rejecting rows where the count is more than 1
  optional {?item rdfs:label ?itemLabel. filter(lang(?itemLabel)="fr")}                     # get labels
  optional {?item schema:description ?itemDescription. filter(lang(?itemDescription)="fr")} # get descriptions
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?citizenship_count") v5("?citizenships") v4("?item"):::projected v1("?itemDescription"):::projected v3("?itemLabel"):::projected c4(["wd:Q10833314"]):::iri c6(["wd:Q31"]):::iri f0[["?citizenship_count < '2^^xsd:integer'"]] f0 --> v6 v4 --"wdt:P106"--> c4 v4 --"wdt:P27"--> c6 v4 --"wdt:P27"--> v5 bind2[/"count(?citizenships)"/] v5 --o bind2 bind2 --as--o v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."rdfs:label".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."schema:description".-> v1 end