query-5f4e3f6b4ca99122cca1bd2e88da48e8
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 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 (CONCAT(replace(str(?item),"http://www.wikidata.org/entity/Q", ""),STR(?order)) AS ?PK) ?item ?itemLabel ?albumLabel ?genreLabel WHERE {
?item wdt:P31 wd:Q59191021;
wdt:P361 wd:Q829965;
p:P527 [ps:P527 ?album;
pq:P1545 ?order;
].
OPTIONAL {
?album wdt:P136 ?genre.
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?item rdfs:label ?itemLabel .
?album rdfs:label ?albumLabel .
?genre rdfs:label ?genreLabel
}
#(GROUP_CONCAT(?genreLabel) AS ?genres)
MINUS{?item p:P360 [ps:P360 ?album_list;
pq:P291 [];
].}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?PK")
v2("?album")
v6("?albumLabel"):::projected
v8("?album_list")
v4("?genre")
v7("?genreLabel"):::projected
v1("?item"):::projected
v5("?itemLabel"):::projected
v3("?order"):::projected
a3((" "))
a1((" "))
a2((" "))
c2(["wd:Q59191021"]):::iri
c10(["bd:serviceParam"]):::iri
c4(["wd:Q829965"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P361"--> c4
a1 --"p:statement/P527"--> v2
a1 --"p:qualifier/P1545"--> v3
v1 --"p:P527"--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P136".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
v1 --"rdfs:label"--> v5
v2 --"rdfs:label"--> v6
v4 --"rdfs:label"--> v7
end
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
a2 --"p:statement/P360"--> v8
a2 --"p:qualifier/P291"--> a3
v1 --"p:P360"--> a2
end
bind1[/"concat(replace(str(?item),'http://www.wikidata.org/entity/Q',''),str(?order))"/]
v1 --o bind1
v3 --o bind1
bind1 --as--o v9