query-35646cae51e6b9e2774c48df39f17f63
title: Mix of P159, P115 & P276 used in sport event SELECT ?value ?ct ?sampleitem ?sampleitemLabel WHERE { { SELECT ?value (count() as ?ct) (SAMPLE(?item) as ?sampleitem) WHERE { ?item (wdt:P31/(wdt:P279)) wd:Q16510064. # àmbit sobre el que es vol explorar optional { ?item wdt:P159 ?p159.} # propietats a analitzar si hi són optional { ?item wdt:P115 ?p115.} optional { ?item wdt:P276 ?p276.} BIND(IF(BOUND(?p159),"P159","") AS ?seu). # genera text per cada propietat existent BIND(IF(BOUND(?p115),"P115","") AS ?sta). BIND(IF(BOUND(?p276),"P276","") AS ?loc). bind(CONCAT(?seu, "-", ?sta, "-", ?loc) as ?value). #crear un codi amb els textos concatenats } GROUP BY ?value ORDER BY DESC(?ct) LIMIT 10 } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } ORDER BY DESC(?ct) ASC(?value)
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 bd: <http://www.bigdata.com/rdf#>
#title: Mix of P159, P115 & P276 used in sport event
SELECT ?value ?ct ?sampleitem ?sampleitemLabel
WHERE
{
{
SELECT ?value (count(*) as ?ct) (SAMPLE(?item) as ?sampleitem)
WHERE
{
?item (wdt:P31/(wdt:P279*)) wd:Q16510064. # àmbit sobre el que es vol explorar
optional { ?item wdt:P159 ?p159.} # propietats a analitzar si hi són
optional { ?item wdt:P115 ?p115.}
optional { ?item wdt:P276 ?p276.}
BIND(IF(BOUND(?p159),"P159","") AS ?seu). # genera text per cada propietat existent
BIND(IF(BOUND(?p115),"P115","") AS ?sta).
BIND(IF(BOUND(?p276),"P276","") AS ?loc).
bind(CONCAT(?seu, "-", ?sta, "-", ?loc) as ?value). #crear un codi amb els textos concatenats
}
GROUP BY ?value
ORDER BY DESC(?ct)
LIMIT 10 }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY DESC(?ct) ASC(?value)