query-a2ae283233e72cd712d8d4a698d70072
Malfunctionning queryHello, I wonder why this query would work
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 DISTINCT ?item
?itemLabel
?year (sample(?number) as ?number)
WHERE {
?item wdt:P238 ?IATA
VALUES ?IATA {"SIN" }.
?item p:P3872 ?statement.
?statement pq:P585 ?time.
bind (YEAR(?time) AS ?year)
?statement ps:P3872 ?number.
optional { ?statement pq:P518 ?applies .}
filter(bound(?applies)=false || ?applies = wd:Q2165236 )
bind(if(bound(?applies)=false,"no applies","everywhere") as ?where )
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en,ro,pt". }
MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
} group by ?year ?item ?itemLabel
order by ?item desc (?year)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?IATA")
v3("?applies")
v1("?item"):::projected
v9("?number"):::projected
v5("?statement")
v6("?time")
v8("?where")
v7("?year"):::projected
c13(["wikibase:DeprecatedRank"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["fr,en,ro,pt"]):::literal
f0[["(bound(?applies) = 'false^^xsd:boolean' || ?applies = 'wd:Q2165236')"]]
f0 --> v3
v1 --"p:direct/P238"--> v5
bind1[/VALUES ?IATA/]
bind1-->v5
bind10(["SIN"])
bind10 --> bind1
v1 --"p:P3872"--> v5
v5 --"p:qualifier/P585"--> v6
bind2[/"year-from-dateTime(?time)"/]
v6 --o bind2
bind2 --as--o v7
v5 --"p:statement/P3872"--> v9
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P518".-> v3
end
bind3[/"if(bound(?applies) = 'false^^xsd:boolean','no applies','everywhere')"/]
v3 --o bind3
bind3 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v5 --"wikibase:rank"--> c13
end
bind6[/"sample(?number)"/]
v9 --o bind6
bind6 --as--o v9