query-f4be14c6d52f1ae804c2eb17b65dd96d
This fails with a not very comprehensible way when attempting three main subject columns:
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 ?item ?itemLabel ?ms1 ?ms1Label ?ms2 ?ms2Label ?ms3 ?ms3Label WHERE
{
VALUES ?item {
wd:Q99536927 # 3 P921s
wd:Q99689936 # 2 P921s
wd:Q99927619 # 1 P921
wd:Q100144327 # 0 P921s
}
optional {?item wdt:P921 ?ms1 .
optional {?item wdt:P921 ?ms2 . filter(str(?ms1) > str(?ms2) )
optional {?item wdt:P921 ?ms3 . filter(str(?ms1) > str(?ms3) && str(?ms2) > str(?ms3) )
}
}
}
SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}
} order by ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v2("?ms1"):::projected
v3("?ms2"):::projected
v4("?ms3"):::projected
c3(["bd:serviceParam"]):::iri
c5(["en"]):::literal
bind0[/VALUES ?item/]
bind0-->v2
bind00(["wd:Q99536927"])
bind00 --> bind0
bind01(["wd:Q99689936"])
bind01 --> bind0
bind02(["wd:Q99927619"])
bind02 --> bind0
bind03(["wd:Q100144327"])
bind03 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P921".-> v2
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P921".-> v3
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P921".-> v4
end
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end