query-98e066b1abdbfb71cdc37ed9d46ddda1

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?potus ?potusLabel WHERE {
   {
SELECT ?pm_gn {
   ?pm wdt:P31 wd:Q5; wdt:P39 wd:Q14211.
   ?pm p:P735/ps:P735 ?pm_gn .
}
GROUP BY ?pm_gn
}  ?potus wdt:P31 wd:Q5; wdt:P39 wd:Q11696.
  ?potus p:P735/ps:P735 ?potus_gn . 
  BIND(IF(?potus_gn=?pm_gn,1,0) AS ?same_gn) 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?potus ?potusLabel
HAVING(SUM(?same_gn)=0)
ORDER BY ?potusLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?_anon_d00291b7e9a143df8ec0be8c8ebd714c7034") v2("?pm") v3("?pm_gn") v4("?potus"):::projected v1("?potusLabel"):::projected v5("?potus_gn") v6("?same_gn") a2((" ")) a3((" ")) a1((" ")) c5(["wd:Q14211"]):::iri c10(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c8(["wd:Q11696"]):::iri f0[[" = '0^^xsd:integer'"]] f0 --> a1 v2 --"p:direct/P31"--> c3 v2 --"p:direct/P39"--> c5 v2 --"p:P735"--> a2 a2 --"p:statement/P735"--> v3 v4 --"p:direct/P31"--> c3 v4 --"p:direct/P39"--> c8 v4 --"p:P735"--> a3 a3 --"p:statement/P735"--> v5 bind1[/"if(?potus_gn = ?pm_gn,'1^^xsd:integer','0^^xsd:integer')"/] v5 --o bind1 v3 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind3[/"sum(?same_gn)"/] v6 --o bind3 bind3 --as--o v7