query-be7d7cba9461720937268de956074f0f
, for instance, has one operator, multiple pennants, is only in the above report, not the below.(Q5630258)HMAS Barcoo : Oh, late news from me: The below report is probably nearere what you actually asked for. It checks for 2 operators first. The previous report was only checking for 2 pennants. So Vicarage@
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 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 ?item ?itemLabel ?oper1Label ?oper2Label ?pen1 ?pen2 ?poper1Label ?poper2Label
WHERE
{
#?item wdt:P137 wd:Q172771.
?item wdt:P31/wdt:P279* wd:Q177597.
?item wdt:P137 ?oper1.
?item wdt:P137 ?oper2.
filter(str(?oper1) > str(?oper2))
?item p:P879 ?pstat1.
?item p:P879 ?pstat2.
?pstat1 ps:P879 ?pen1.
?pstat2 ps:P879 ?pen2.
OPTIONAL {?pstat1 pq:P137 ?poper1}
OPTIONAL {?pstat2 pq:P137 ?poper2}
FILTER(!BOUND(?poper1)||!BOUND(?poper2))
filter(str(?pen1) > str(?pen2))
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;
v7("?item"):::projected
v5("?oper1")
v6("?oper2")
v1("?pen1"):::projected
v2("?pen2"):::projected
v3("?poper1")
v4("?poper2")
v8("?pstat1")
v9("?pstat2")
a1((" "))
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q177597"]):::iri
f0[["str(?pen1) > str(?pen2)"]]
f0 --> v1
f0 --> v2
f1[["(not bound(?poper1) || not bound(?poper2))"]]
f1 --> v3
f1 --> v4
f2[["str(?oper1) > str(?oper2)"]]
f2 --> v5
f2 --> v6
v7 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v7 --"p:direct/P137"--> v5
v7 --"p:direct/P137"--> v6
v7 --"p:P879"--> v8
v7 --"p:P879"--> v9
v8 --"p:statement/P879"--> v1
v9 --"p:statement/P879"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P137".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:qualifier/P137".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end