query-323a1eae566f8636868e6e41b5100673
title:Exclude single results SELECT ?item ?place ?trec WHERE { { SELECT (count(DISTINCT ?item) AS ?items) ?place WHERE { ?item wdt:P31 wd:Q5 . ?item wdt:P3365 ?trec . ?item wdt:P19 ?place . ?place wdt:P131* wd:Q1273 . } GROUP BY ?place HAVING (?items > 1) } ?item wdt:P31 wd:Q5 . ?item wdt:P3365 ?trec . ?item wdt:P19 ?place . }
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#title:Exclude single results
SELECT ?item ?place ?trec
WHERE
{
{
SELECT (count(DISTINCT ?item) AS ?items) ?place
WHERE
{
?item wdt:P31 wd:Q5 .
?item wdt:P3365 ?trec .
?item wdt:P19 ?place .
?place wdt:P131* wd:Q1273 .
}
GROUP BY ?place
HAVING (?items > 1)
}
?item wdt:P31 wd:Q5 .
?item wdt:P3365 ?trec .
?item wdt:P19 ?place .
}
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v5("?items")
v4("?place"):::projected
v3("?trec"):::projected
c3(["wd:Q5"]):::iri
c7(["wd:Q1273"]):::iri
f0[["?items > '1^^xsd:integer'"]]
f0 --> v5
v2 --"wdt:P31"--> c3
v2 --"wdt:P3365"--> v3
v2 --"wdt:P19"--> v4
v4 --"wdt:P131"--> c7
bind2[/"count(?item)"/]
v2 --o bind2
bind2 --as--o v5
v2 --"wdt:P31"--> c3
v2 --"wdt:P3365"--> v3
v2 --"wdt:P19"--> v4