zazuko / elcom-strompreis-poc

PoC ElCom Strompreise LD
0 stars 0 forks source link

Calculate Tarifdaten #2

Open ktk opened 4 years ago

ktk commented 4 years ago

I've prepared calculation of "Tarifdaten". It is split into the following queries:

I execute them like this:

#!/bin/sh
curl -H "Accept: text/turtle" -o canton-municipality-population.ttl --data-urlencode query@sparql/calc-canton-municipality-population.rq  https://ld.geo.admin.ch/query
curl -H "Accept: text/turtle" -o provider-category-max-min.ttl --data-urlencode query@sparql/calc-provider-category-max-min.rq  https://trifid-lindas.test.cluster.ldbar.ch/query

for testing I load the data in a local TDB and execute the last query on them:

This query returns a result-set and should be executed for each canton. This can be done by replacing 8: on line 16 with an integer between 1-26.

Sample for Kanton Glarus:

municipality name population max min
https://ld.geo.admin.ch/boundaries/municipality/1630 "Glarus Nord" 18247 1.900873374938965E1 1.900873374938965E1
https://ld.geo.admin.ch/boundaries/municipality/1631 "Glarus Süd" 9581 1.8326534271240234E1 1.8326534271240234E1

Note that the municipality Glarus is missing due to a bug in the source-data.

ktk commented 4 years ago

@bergos btw I can't seem to remember how to assign proper dataype in SPARQL, sorry for the max/min format.

ktk commented 4 years ago

Ah and I assume we have to do that for each category, which is hardcoded here, the list of all categories used can be found here