query-db3abf6687fb3aa5703512c38e79c238
Query #3: Select popular music genres and their sub-genres
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#>
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?genreSubClassOf ?genreSubClassOfLabel ?genreSubClassOfDescription ?inceptionDate
WHERE
{
{
?item wdt:P31/wdt:P279* wd:Q188451 .
?item wdt:P31 ?instanceOf .
FILTER(?instanceOf IN (wd:Q188451)) # Filter out 'instance of' values NOT in this list
?item wdt:P279 ?genreSubClassOf .
OPTIONAL {?item wdt:P571 ?inceptionDate} .
OPTIONAL {?item wdt:P495 ?countryOfOrgin} .
FILTER(?countryOfOrgin IN (wd:Q30)) # Filter out 'country of orgin' values NOT in this list
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?countryOfOrgin")
v5("?genreSubClassOf"):::projected
v6("?inceptionDate"):::projected
v3("?instanceOf")
v4("?item"):::projected
v1("?itemLabel"):::projected
a1((" "))
c8(["bd:serviceParam"]):::iri
c2(["wd:Q188451"]):::iri
c10(["en"]):::literal
f0[["?countryOfOrgin = 'wd:Q30'"]]
f0 --> v2
f1[["?instanceOf = 'wd:Q188451'"]]
f1 --> v3
v4 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c2
v4 --"wdt:P31"--> v3
v4 --"wdt:P279"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P571".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P495".-> v2
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end