query-ecf0b4a2054266a7d9fa3b10ec6df44f

rq turtle/ttl

.on Mastodon and on TwitterOriginally posted

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 ?religion1 ?religion1Label ?religion2Label ?count WHERE {
   {
  SELECT ?religion1 ?religion2 (COUNT(DISTINCT ?person) AS ?count) WHERE {
    ?person wdt:P31 wd:Q5;
            wdt:P140 ?religion1, ?religion2.
    ?religion1 wdt:P279+ ?religion2.
  }
  GROUP BY ?religion1 ?religion2
  HAVING(?count > 1)
}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?count"):::projected v2("?person") v3("?religion1"):::projected v4("?religion2") c7(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?count > '1^^xsd:integer'"]] f0 --> v5 v2 --"wdt:P31"--> c3 v2 --"wdt:P140"--> v3 v2 --"wdt:P140"--> v4 v3 --"wdt:P279"--> v4 bind2[/"count(?person)"/] v2 --o bind2 bind2 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end