query-e89d402a4fcfec230953c8dfb5b91b20
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 ?work ?workLabel ?type ?incept ?published ?instruments ?tonality ?external ?sitelinks ?opus ?brown ?chominski ?kobylanska {
{ SELECT
?work
(GROUP_CONCAT(DISTINCT ?typeLabel; separator=', ') AS ?type)
(MIN(?inception) AS ?incept)
(MIN(?published) AS ?published)
(GROUP_CONCAT(DISTINCT ?instrumentLabel; separator=', ') AS ?instruments)
(GROUP_CONCAT(DISTINCT ?tonalityLabel; separator=', ') AS ?tonality)
(COUNT(DISTINCT ?wdt) + COUNT(DISTINCT ?catalogue) AS ?external)
(SAMPLE(?opus) AS ?opus) (SAMPLE(?brown) AS ?brown) (SAMPLE(?chominski) AS ?chominski) (SAMPLE(?kobylanska) AS ?kobylanska)
{
?work wdt:P86 wd:Q1268;
wdt:P31 ?type .
?type wdt:P279* wd:Q2188189 .
OPTIONAL { ?work wdt:P571 ?inception } .
OPTIONAL { ?work wdt:P577 ?published } .
OPTIONAL { ?work wdt:P826 ?tonality } .
OPTIONAL { ?work wdt:P870 ?instrument } .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
?type rdfs:label ?typeLabel .
?instrument rdfs:label ?instrumentLabel .
?tonality rdfs:label ?tonalityLabel .
} .
OPTIONAL {
?work p:P528 ?statement .
?statement pq:P972 ?catalogue .
OPTIONAL { FILTER( ?catalogue = wd:Q385271 ) . ?statement ps:P528 ?opus } .
OPTIONAL { FILTER( ?catalogue = wd:Q16749676 ) . ?statement ps:P528 ?brown } .
OPTIONAL { FILTER( ?catalogue = wd:Q16749680 ) . ?statement ps:P528 ?chominski } .
OPTIONAL { FILTER( ?catalogue = wd:Q16747642 ) . ?statement ps:P528 ?kobylanska } .
} .
OPTIONAL {
?work ?wdt [] .
?wdt ^wikibase:directClaim/wikibase:propertyType wikibase:ExternalId .
} .
} GROUP BY ?work } .
OPTIONAL { ?work wikibase:sitelinks ?sitelinks } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
} ORDER BY DESC(?incept)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v18("?_anon_42b5416610844a34809f33a099ae9de119106")
v19("?_anon_42b5416610844a34809f33a099ae9de119107")
v22("?brown"):::projected
v11("?catalogue")
v22("?chominski"):::projected
v21("?external"):::projected
v20("?incept"):::projected
v4("?inception")
v7("?instrument")
v9("?instrumentLabel")
v20("?instruments"):::projected
v22("?kobylanska"):::projected
v22("?opus"):::projected
v20("?published"):::projected
v22("?sitelinks"):::projected
v12("?statement")
v21("?tonality"):::projected
v10("?tonalityLabel")
v20("?type"):::projected
v8("?typeLabel")
v17("?wdt")
v2("?work"):::projected
a1((" "))
a2((" "))
c11(["bd:serviceParam"]):::iri
c2(["wd:Q1268"]):::iri
c13(["en"]):::literal
c24(["wikibase:ExternalId"]):::iri
c5(["wd:Q2188189"]):::iri
v2 --"p:direct/P86"--> c2
v2 --"p:direct/P31"--> v20
v20 --"p:direct/P279"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P571".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P577".-> v20
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P826".-> v21
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P870".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
v20 --"rdfs:label"--> v8
v7 --"rdfs:label"--> v9
v21 --"rdfs:label"--> v10
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:P528".-> v12
v12 --"p:qualifier/P972"--> v11
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v12 -."p:statement/P528".-> v22
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v12 -."p:statement/P528".-> v22
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v12 -."p:statement/P528".-> v22
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v12 -."p:statement/P528".-> v22
end
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v2 -->v17--> a1
a2 -."wikibase:directClaim".-> v17
a2 --"wikibase:propertyType"--> c24
end
bind11[/"count(?wdt)"/]
v17 --o bind11
bind11 --as--o v18
bind12[/"count(?catalogue)"/]
v11 --o bind12
bind12 --as--o v19
bind13[/"?typeLabel"/]
v8 --o bind13
bind13 --as--o v20
bind14[/"min(?inception)"/]
v4 --o bind14
bind14 --as--o v20
bind15[/"min(?published)"/]
v20 --o bind15
bind15 --as--o v20
bind16[/"?instrumentLabel"/]
v9 --o bind16
bind16 --as--o v20
bind17[/"?tonalityLabel"/]
v10 --o bind17
bind17 --as--o v21
bind18[/" + "/]
null --o bind18
null --o bind18
bind18 --as--o v21
bind19[/"sample(?opus)"/]
v22 --o bind19
bind19 --as--o v22
bind20[/"sample(?brown)"/]
v22 --o bind20
bind20 --as--o v22
bind21[/"sample(?chominski)"/]
v22 --o bind21
bind21 --as--o v22
bind22[/"sample(?kobylanska)"/]
v22 --o bind22
bind22 --as--o v22
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wikibase:sitelinks".-> v22
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end