query-fa6b7194c828b0258be10d0be0c76a93
TODO
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#>
SELECT ?item ?itemLabel ?CofOLabel ?CofO_ISO ?formLabel ?Cform_ISO ?inception ?genre where
{
{
SELECT ?item ?CofO ?CofO_ISO ?Cform_ISO ?form ?inception (group_concat(?gl;separator=", ") as ?genre)
WHERE
{
?item wdt:P31/wdt:P279* wd:Q215380. #is a band or subclass of a band
OPTIONAL {?item wdt:P495 ?CofO . # has a country of origin
OPTIONAL {?CofO wdt:P297 ?CofO_ISO .} # which has an ISO
}
OPTIONAL {?item wdt:P740 ?form . # has a location of formation
OPTIONAL {?form wdt:P131* ?Cform.
?Cform wdt:P31 wd:Q3624078 .
?Cform wdt:P297 ?Cform_ISO .} # which can be mapped to a sovereign state with an ISO
}
OPTIONAL {?item wdt:P571 ?inception . } # has an inception date
OPTIONAL {?item wdt:P136 ?g . # has a genre
?g rdfs:label ?gl . filter(lang(?gl)="en") }
} group by ?item ?CofO ?CofO_ISO ?Cform_ISO ?form ?inception } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?Cform")
v7("?Cform_ISO"):::projected
v3("?CofO")
v4("?CofO_ISO"):::projected
v5("?form")
v9("?g")
v10("?genre"):::projected
v1("?gl")
v8("?inception"):::projected
v2("?item"):::projected
a1((" "))
c4(["wd:Q215380"]):::iri
c9(["wd:Q3624078"]):::iri
c14(["bd:serviceParam"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P495".-> v3
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P297".-> v4
end
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P740".-> v5
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P131".-> v6
v6 --"wdt:P31"--> c9
v6 --"wdt:P297"--> v7
end
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P571".-> v8
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P136".-> v9
v9 --"rdfs:label"--> v1
end
bind1[/"?gl"/]
v1 --o bind1
bind1 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end