query-bd251f4f622f57eb36bbfbe5395826df
杭州车牌table view 下order 正确,但linechard下却不对???
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#>
#defaultView:LineChart
SELECT
#?item
?date ?price
#?pointTimeMonthNorm
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?item wdt:P31/(wdt:P279)* wd:Q114885389.
?item p:P2284 ?priceStatement.
?priceStatement ps:P2284 ?price.
?priceStatement pq:P366 wd:Q215627.
?priceStatement pq:P1552 wd:Q10585806.
OPTIONAL{
?item wdt:P585 ?itemPointTime.
}
OPTIONAL{
?priceStatement pq:P585 ?priceStatementPointTime.
}.
BIND(IF(BOUND(?itemPointTime),?itemPointTime, ?priceStatementPointTime) as ?pointTime)
BIND(YEAR(?pointTime) as ?pointTimeYear)
BIND(MONTH(?pointTime) as ?pointTimeMonth)
# IF(?pointTimeMonth < 10,
# BIND(CONCAT("0",?pointTimeMonth) AS ?pointTimeMonth),
# BIND(CONCAT("0",?pointTimeMonth) AS ?pointTimeMonth)
# )
# IF( 1 < 2, BIND(?pointTimeMonth as ?A), (?pointTimeMonth as ?A))
BIND(IF(?pointTimeMonth < 10, CONCAT("0",Str(?pointTimeMonth)), Str(?pointTimeMonth)) as ?pointTimeMonthNorm)
BIND(CONCAT(Str(?pointTimeYear), "年", Str(?pointTimeMonthNorm), "月") as ?date)
}
ORDER BY ASC(?date)
LIMIT 10000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?date"):::projected
v2("?item")
v5("?itemPointTime")
v7("?pointTime")
v9("?pointTimeMonth")
v10("?pointTimeMonthNorm")
v8("?pointTimeYear")
v4("?price"):::projected
v3("?priceStatement")
v6("?priceStatementPointTime")
a1((" "))
c2(["bd:serviceParam"]):::iri
c13(["wd:Q10585806"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c7(["wd:Q114885389"]):::iri
c11(["wd:Q215627"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v2 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c7
v2 --"p:P2284"--> v3
v3 --"p:statement/P2284"--> v4
v3 --"p:qualifier/P366"--> c11
v3 --"p:qualifier/P1552"--> c13
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P585".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P585".-> v6
end
bind0[/"if(bound(?itemPointTime),?itemPointTime,?priceStatementPointTime)"/]
v5 --o bind0
v6 --o bind0
bind0 --as--o v7
bind1[/"year-from-dateTime(?pointTime)"/]
v7 --o bind1
bind1 --as--o v8
bind2[/"month-from-dateTime(?pointTime)"/]
v7 --o bind2
bind2 --as--o v9
bind3[/"if(?pointTimeMonth < '10^^xsd:integer',concat('0',str(?pointTimeMonth)),str(?pointTimeMonth))"/]
v9 --o bind3
bind3 --as--o v10
bind4[/"concat(str(?pointTimeYear),'年',str(?pointTimeMonthNorm),'月')"/]
v8 --o bind4
v10 --o bind4
bind4 --as--o v11