query-2e3215af0398b041d92467bb1402b846
Sites archéologiques en Suisse, avec plus qu'une valeur en P31 SELECT DISTINCT ?item ?itemLabel (COUNT(DISTINCT ?instance) as ?count) (GROUP_CONCAT( DISTINCT ?instanceLabel; separator=", " ) as ?instances) WHERE { ?item wdt:P17 wd:Q39; wdt:P31/wdt:P279* wd:Q839954. ?item wdt:P31 ?instance . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,de,it,en". ?item rdfs:label ?itemLabel . ?instance rdfs:label ?instanceLabel . } } GROUP BY ?item ?itemLabel HAVING (?count > 1) ORDER BY ?itemLabel
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Sites archéologiques en Suisse, avec plus qu'une valeur en P31
SELECT DISTINCT
?item ?itemLabel
(COUNT(DISTINCT ?instance) as ?count)
(GROUP_CONCAT( DISTINCT ?instanceLabel; separator=", " ) as ?instances)
WHERE
{
?item wdt:P17 wd:Q39;
wdt:P31/wdt:P279* wd:Q839954.
?item wdt:P31 ?instance .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,de,it,en".
?item rdfs:label ?itemLabel .
?instance rdfs:label ?instanceLabel .
}
}
GROUP BY ?item ?itemLabel
HAVING (?count > 1)
ORDER BY ?itemLabel
Query found at
- https://www.wikidata.org/wiki/User:Memoriav-bdc/GLAM
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2020/10
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count")
v4("?instance"):::projected
v5("?instanceLabel"):::projected
v6("?instances")
v3("?item"):::projected
v1("?itemLabel"):::projected
a1((" "))
c3(["wd:Q39"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,fr,de,it,en"]):::literal
c8(["bd:serviceParam"]):::iri
c6(["wd:Q839954"]):::iri
f0[["?count > '1^^xsd:integer'"]]
f0 --> v6
v3 --"wdt:P17"--> c3
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c6
v3 --"wdt:P31"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
v3 --"rdfs:label"--> v1
v4 --"rdfs:label"--> v5
end
bind3[/"count(?instance)"/]
v4 --o bind3
bind3 --as--o v6
bind4[/"?instanceLabel"/]
v5 --o bind4
bind4 --as--o v6