query-c5ca419cd1aed69e08c2415571773b08
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?amurl ?amQ_missing WHERE {
?item p:P9185 ?stat .
OPTIONAL {?stat pq:P1810 ?amQ_ .}
?stat ps:P9185 ?amID .
BIND(IF(BOUND(?amQ_),?amQ_,"ID") as ?amQ)
BIND(IF(!BOUND(?amQ_),"Oh","") as ?amQ_missing)
wd:P9185 rdfs:label ?propItemLabelam.
FILTER((LANG(?propItemLabelam)) = "en")
BIND(CONCAT("[https://www.allmusic.com/style/", ?amID," ",?amQ, "]") AS ?amurl)
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;
v5("?amID")
v6("?amQ")
v4("?amQ_")
v7("?amQ_missing"):::projected
v8("?amurl"):::projected
v2("?item"):::projected
v1("?propItemLabelam")
v3("?stat")
c8(["bd:serviceParam"]):::iri
c5(["wd:P9185"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?propItemLabelam = 'en'"]]
f0 --> v1
v2 --"p:P9185"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P1810".-> v4
end
v3 --"p:statement/P9185"--> v5
bind1[/"if(bound(?amQ_),?amQ_,'ID')"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"if(not bound(?amQ_),'Oh','')"/]
v4 --o bind2
bind2 --as--o v7
c5 --"rdfs:label"--> v1
bind3[/"concat('#91;https://www.allmusic.com/style/',?amID,' ',?amQ,'#93;')"/]
v5 --o bind3
v6 --o bind3
bind3 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end