query-a982d1f12b486789ed3975a35a0e114a
Bcoh
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:AreaChart
SELECT ?dpa (STR(YEAR(?date)) AS ?year) ?budget ?dpaLabel
WHERE {
?dpa wdt:P31/wdt:P279* wd:Q55499415;
p:P2769 _:budget.
_:budget psv:P2769 _:budgetvalue;
pq:P585 ?date.
_:budgetvalue wikibase:quantityAmount ?amount;
wikibase:quantityUnit ?unit.
OPTIONAL { ?unit p:P2284 / psv:P2284 [ wikibase:quantityAmount ?price ; wikibase:quantityUnit wd:Q4916 ] }
BIND (IF ( ?unit = wd:Q4916,
?amount,
IF ( BOUND (?price), ?amount * ?price, 0 )
) AS ?budget)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?amount")
v6("?budget"):::projected
v2("?date"):::projected
v1("?dpa"):::projected
v5("?price")
v4("?unit")
v7("?year")
a2((" "))
a3((" "))
a1((" "))
a5((" "))
a4((" "))
c15(["#91;AUTO_LANGUAGE#93;,en,de,fr"]):::literal
c9(["wd:Q4916"]):::iri
c3(["wd:Q55499415"]):::iri
c13(["bd:serviceParam"]):::iri
v1 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v1 --"p:P2769"--> a2
a2 --"p:statement/value/P2769"--> a3
a2 --"p:qualifier/P585"--> v2
a3 --"wikibase:quantityAmount"--> v3
a3 --"wikibase:quantityUnit"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a4 -."wikibase:quantityAmount".-> v5
a4 --"wikibase:quantityUnit"--> c9
v4 --"p:P2284"--> a5
a5 --"p:statement/value/P2284"--> a4
end
bind0[/"if(?unit = 'wd:Q4916',?amount,if(bound(?price),?amount * ?price,'0^^xsd:integer'))"/]
v4 --o bind0
v3 --o bind0
v5 --o bind0
bind0 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
bind1[/"str(year-from-dateTime(?date))"/]
v2 --o bind1
bind1 --as--o v7