query-e904d4b9ce330ce96ee2df811fdd8942
Has every airport 12 month values?
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 prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?year ?item ?itemLabel ?number_of_months ?first_month ?last_month ?have_value_for_year
WHERE
{
{
SELECT ?item (COUNT(DISTINCT ?date) AS ?number_of_months) (MAX(?date) AS ?last_month) (MIN(?date) AS ?first_month)
WHERE
{
{
SELECT ?item ?statement ?date ?year ?timevalue ?numberperperiod ?reference_URL
WHERE
{
?item (wdt:P31/wdt:P279*) wd:Q62447.
?item p:P3872 ?statement.
?statement pqv:P585 ?timevalue;
ps:P3872 ?numberperperiod.
?timevalue wikibase:timeValue ?date.
OPTIONAL { ?statement pq:P518 ?applies. }
OPTIONAL { ?statement prov:wasDerivedFrom / (pr:P854|pr:P4656) ?reference_URL. }
FILTER (BOUND(?applies)=false || ?applies = wd:Q2165236 )
MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
BIND (YEAR(?date) AS ?year)
FILTER (?year=2020).
}
} ?timevalue wikibase:timePrecision 10 . # Precicision is month
}
GROUP BY ?item
HAVING (?number_of_months != 12)
}
OPTIONAL
{
{
SELECT ?item
WHERE
{
{
SELECT ?item ?statement ?date ?year ?timevalue ?numberperperiod ?reference_URL
WHERE
{
?item (wdt:P31/wdt:P279*) wd:Q62447.
?item p:P3872 ?statement.
?statement pqv:P585 ?timevalue;
ps:P3872 ?numberperperiod.
?timevalue wikibase:timeValue ?date.
OPTIONAL { ?statement pq:P518 ?applies. }
OPTIONAL { ?statement prov:wasDerivedFrom / (pr:P854|pr:P4656) ?reference_URL. }
FILTER (BOUND(?applies)=false || ?applies = wd:Q2165236 )
MINUS { ?statement wikibase:rank wikibase:DeprecatedRank }
BIND (YEAR(?date) AS ?year)
FILTER (?year=2020).
}
} ?timevalue wikibase:timePrecision 9 . # Precicision is year
}
GROUP BY ?item
}
BIND ("yes" AS ?have_value_for_year)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?applies")
v8("?date")
v11("?first_month"):::projected
v12("?have_value_for_year"):::projected
v4("?item"):::projected
v10("?last_month"):::projected
v10("?number_of_months"):::projected
v7("?numberperperiod")
v9("?reference_URL")
v5("?statement")
v6("?timevalue")
v12("?year"):::projected
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c17(["wikibase:DeprecatedRank"]):::iri
c24(["fr"]):::literal
c7(["wd:Q62447"]):::iri
c22(["bd:serviceParam"]):::iri
c20(["9^^xsd:integer"]):::literal
c19(["10^^xsd:integer"]):::literal
f0[["?number_of_months != '12^^xsd:integer'"]]
f0 --> v10
f1[["?year = '2020^^xsd:integer'"]]
f1 --> v12
f2[["(bound(?applies) = 'false^^xsd:boolean' || ?applies = 'wd:Q2165236')"]]
f2 --> v3
v4 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c7
v4 --"p:P3872"--> v5
v5 --"p:qualifier/value/P585"--> v6
v5 --"p:statement/P3872"--> v7
v6 --"wikibase:timeValue"--> v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P518".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."prov:wasDerivedFrom".-> a2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a2 --"p:reference/P4656"--> v9
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
a2 --"p:reference/P854"--> v9
end
union0r <== or ==> union0l
end
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v5 --"wikibase:rank"--> c17
end
bind4[/"year-from-dateTime(?date)"/]
v8 --o bind4
bind4 --as--o v12
v6 --"wikibase:timePrecision"--> c19
bind8[/"count(?date)"/]
v8 --o bind8
bind8 --as--o v10
bind9[/"max(?date)"/]
v8 --o bind9
bind9 --as--o v10
bind10[/"min(?date)"/]
v8 --o bind10
bind10 --as--o v11
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
f11[["?year = '2020^^xsd:integer'"]]
f11 --> v12
f12[["(bound(?applies) = 'false^^xsd:boolean' || ?applies = 'wd:Q2165236')"]]
f12 --> v3
v4 -."p:direct/P31".-> a3
a3 --"p:direct/P279"--> c7
v4 --"p:P3872"--> v5
v5 --"p:qualifier/value/P585"--> v6
v5 --"p:statement/P3872"--> v7
v6 --"wikibase:timeValue"--> v8
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P518".-> v3
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."prov:wasDerivedFrom".-> a4
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
a4 --"p:reference/P4656"--> v9
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
a4 --"p:reference/P854"--> v9
end
union1r <== or ==> union1l
end
end
subgraph minus13["MINUS"]
style minus13 stroke-width:6px,fill:pink,stroke:red;
v5 --"wikibase:rank"--> c17
end
bind14[/"year-from-dateTime(?date)"/]
v8 --o bind14
bind14 --as--o v12
v6 --"wikibase:timePrecision"--> c20
bind15[/"'yes'"/]
bind15 --as--o v12
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c22 --"wikibase:language"--> c24
end