query-6b9034288ad1473232ae97be6af8762b
refine a stats queryHello, given that basis
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?month ?mois_brut ?Mois_Nom ?year ?patronage (SAMPLE(?reference_URL) AS ?sample_reference_URL)
WHERE
{ ?item wdt:P238 ?airport_code
VALUES ?airport_code { "BKK"}
?item p:P3872 ?statement.
?statement ps:P3872 ?patronage.
?statement pqv:P585 ?timevalue.
OPTIONAL { ?statement prov:wasDerivedFrom / (pr:P854|pr:P4656) ?reference_URL. }
?timevalue wikibase:timeValue ?time.
?timevalue wikibase:timePrecision 10 . # Precision only month (10)
BIND (MONTH(?time) AS ?month)
BIND (YEAR(?time) AS ?year)
VALUES (?mois_brut ?Mois_Nom) { (1 "jan")
(2 "fév" )
(3 "mar" )
(4 "avr" )
(5 "mai" )
(6 "juin" )
(7 "juil" )
(8 "aoû" )
(9 "sep" )
(10 "oct" )
(11 "nov" )
(12 "déc" )
}
filter(?month = ?mois_brut)
filter(?year>=2018)
} GROUP BY ?month ?mois_brut ?Mois_Nom ?year ?patronage
ORDER BY ?month ?year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?Mois_Nom"):::projected
v6("?airport_code")
v4("?item")
v11("?mois_brut"):::projected
v11("?month"):::projected
v7("?patronage"):::projected
v9("?reference_URL"):::projected
v12("?sample_reference_URL")
v6("?statement")
v10("?time")
v8("?timevalue")
v11("?year"):::projected
a1((" "))
c11(["10^^xsd:integer"]):::literal
f0[["?year >= '2018^^xsd:integer'"]]
f0 --> v11
f1[["?month = ?mois_brut"]]
f1 --> v11
f1 --> v11
v4 --"p:direct/P238"--> v6
bind2[/VALUES ?airport_code/]
bind2-->v6
bind20(["BKK"])
bind20 --> bind2
v4 --"p:P3872"--> v6
v6 --"p:statement/P3872"--> v7
v6 --"p:qualifier/value/P585"--> v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."prov:wasDerivedFrom".-> a1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a1 --"p:reference/P4656"--> v9
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
a1 --"p:reference/P854"--> v9
end
union0r <== or ==> union0l
end
end
v8 --"wikibase:timeValue"--> v10
v8 --"wikibase:timePrecision"--> c11
bind3[/"month-from-dateTime(?time)"/]
v10 --o bind3
bind3 --as--o v11
bind4[/"year-from-dateTime(?time)"/]
v10 --o bind4
bind4 --as--o v11
bind5[/VALUES ?Mois_Nom ?mois_brut/]
bind5-->v11
bind5-->v11
bind50(["1^^xsd:integer"])
bind50 --> bind5
bind51(["jan"])
bind51 --> bind5
bind52(["2^^xsd:integer"])
bind52 --> bind5
bind53(["fév"])
bind53 --> bind5
bind54(["3^^xsd:integer"])
bind54 --> bind5
bind55(["mar"])
bind55 --> bind5
bind56(["4^^xsd:integer"])
bind56 --> bind5
bind57(["avr"])
bind57 --> bind5
bind58(["5^^xsd:integer"])
bind58 --> bind5
bind59(["mai"])
bind59 --> bind5
bind510(["6^^xsd:integer"])
bind510 --> bind5
bind511(["juin"])
bind511 --> bind5
bind512(["7^^xsd:integer"])
bind512 --> bind5
bind513(["juil"])
bind513 --> bind5
bind514(["8^^xsd:integer"])
bind514 --> bind5
bind515(["aoû"])
bind515 --> bind5
bind516(["9^^xsd:integer"])
bind516 --> bind5
bind517(["sep"])
bind517 --> bind5
bind518(["10^^xsd:integer"])
bind518 --> bind5
bind519(["oct"])
bind519 --> bind5
bind520(["11^^xsd:integer"])
bind520 --> bind5
bind521(["nov"])
bind521 --> bind5
bind522(["12^^xsd:integer"])
bind522 --> bind5
bind523(["déc"])
bind523 --> bind5
bind7[/"sample(?reference_URL)"/]
v9 --o bind7
bind7 --as--o v12