Skip to content

Commit

Permalink
999999999_521850.py (#43): worldbank, prepare creation of pivot column
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Aug 3, 2022
1 parent 57a410d commit 93cb7bf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
16 changes: 13 additions & 3 deletions officina/999999999/0/999999999_521850.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@
# '#item+rem+i_qcc+is_zxxx+ix_xywdatap1539': r"^#population\+f$",
# # male population (P1540)
# '#item+rem+i_qcc+is_zxxx+ix_xywdatap1540': r"^#population\+m$",

'#item+rem+i_qcc+is_zxxx+ix_iso8601v{v1}+ix_xyhxltrivio': r"^#indicator\+value\+year(?P<v1>[0-9]{4})$",
}

DATA_NO1_DE_HXLTM_GENERIC = {
Expand Down Expand Up @@ -791,6 +793,9 @@ def __init__(
# 'not_in': DATA_HXL_DE_CSV_REGEX['worldbank'].keys()
# },
]
# self._hxlPivot = {}
self._hxlPivot = DATA_HXL_DE_CSV_REGEX['worldbank']
self._hxlPivotCode = '#indicator+code'

self._Adm0CodexLocali = None

Expand Down Expand Up @@ -995,7 +1000,11 @@ def de_csvnorm_ad_hxl(
if not self._skip_line(linea):
_csv_writer.writerow(linea)

def de_hxl_ad_hxltm(self, fonti: str, objetivum: str):
def de_hxl_ad_hxltm(
self, fonti: str,
objetivum: str,
hxl_vocab: bool = False
):
# print("TODO de_csv_ad_csvnorm")
index_linea = 0
codicem_inconito = False
Expand Down Expand Up @@ -1371,6 +1380,8 @@ def praeparatio(self):
r = requests.get(self.link_fonti)
with open(temp_fonti_zip, 'wb') as f:
f.write(r.content)
# else:
# print('already cached', temp_fonti_zip)

# zip file handler
zip = zipfile.ZipFile(temp_fonti_zip)
Expand Down Expand Up @@ -1408,11 +1419,10 @@ def praeparatio(self):
'not_in': DATA_HXL_DE_CSV_REGEX['worldbank'].keys()
}
)
# def _qcallback(qself, caput):
# return qself
self.de_csvnorm_ad_hxl(
self._temp['csv'], self._temp['hxl']
)

if self.objectivum_formato in ['hxltm', 'no1']:
self.de_hxl_ad_hxltm(
self._temp['hxl'], self._temp['hxltm']
Expand Down
33 changes: 27 additions & 6 deletions officina/999999999/0/MDCIII.simulato.owl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@



<!-- urn:mdciii_simulato::@1603_{POP}() -->

<owl:Class rdf:about="urn:mdciii_simulato::@1603_{POP}()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:label xml:lang="en">@1603_{POP}()</rdfs:label>
<skos:notation xml:lang="en">1603:9947</skos:notation>
</owl:Class>



<!-- urn:mdciii_simulato::@1603_{PROC}() -->

<owl:Class rdf:about="urn:mdciii_simulato::@1603_{PROC}()">
Expand Down Expand Up @@ -230,6 +240,17 @@



<!-- urn:mdciii_simulato::@1603_{SPOP}() -->

<owl:Class rdf:about="urn:mdciii_simulato::@1603_{SPOP}()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:label xml:lang="en">@1603_{SPOP}()</rdfs:label>
<skos:definition xml:lang="en">Subpopulation, such as total population for a place, but by gender/sex, by age group, urban population, ...</skos:definition>
<skos:notation xml:lang="en">1603:9966</skos:notation>
</owl:Class>



<!-- urn:mdciii_simulato:@1603_{AC}_1603() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{AC}_1603()">
Expand Down Expand Up @@ -335,7 +356,7 @@
<!-- urn:mdciii_simulato:@1603_{POP}_N_0() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{POP}_N_0()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{POP}()"/>
<rdfs:comment xml:lang="en">Population (by ABL0)</rdfs:comment>
<rdfs:label>@1603_{POP}_N_0()</rdfs:label>
<rdfs:seeAlso xml:lang="en">http://purl.obolibrary.org/obo/OBI_0000181</rdfs:seeAlso>
Expand All @@ -347,7 +368,7 @@
<!-- urn:mdciii_simulato:@1603_{POP}_N_1() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{POP}_N_1()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{POP}()"/>
<rdfs:comment xml:lang="en">Population (by ABL1)</rdfs:comment>
<rdfs:label>@1603_{POP}_N_1()</rdfs:label>
<rdfs:seeAlso xml:lang="en">http://purl.obolibrary.org/obo/OBI_0000181</rdfs:seeAlso>
Expand All @@ -359,7 +380,7 @@
<!-- urn:mdciii_simulato:@1603_{POP}_N_2() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{POP}_N_2()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{POP}()"/>
<rdfs:comment xml:lang="en">Population (by ABL2)</rdfs:comment>
<rdfs:label>@1603_{POP}_N_2()</rdfs:label>
<rdfs:seeAlso xml:lang="en">http://purl.obolibrary.org/obo/OBI_0000181</rdfs:seeAlso>
Expand Down Expand Up @@ -401,7 +422,7 @@
<!-- urn:mdciii_simulato:@1603_{SPOP}_N_0() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{SPOP}_N_0()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{SPOP}()"/>
<rdfs:comment xml:lang="en">Subpopulation (by ABL0)</rdfs:comment>
<rdfs:label>@1603_{SPOP}_N_0()</rdfs:label>
</owl:Class>
Expand All @@ -411,7 +432,7 @@
<!-- urn:mdciii_simulato:@1603_{SPOP}_N_1() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{SPOP}_N_1()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{SPOP}()"/>
<rdfs:comment xml:lang="en">Subpopulation (by ABL1)</rdfs:comment>
<rdfs:label>@1603_{SPOP}_N_1()</rdfs:label>
</owl:Class>
Expand All @@ -421,7 +442,7 @@
<!-- urn:mdciii_simulato:@1603_{SPOP}_N_2() -->

<owl:Class rdf:about="urn:mdciii_simulato:@1603_{SPOP}_N_2()">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000027"/>
<rdfs:subClassOf rdf:resource="urn:mdciii_simulato::@1603_{SPOP}()"/>
<rdfs:comment xml:lang="en">Subpopulation (by ABL2)</rdfs:comment>
<rdfs:label>@1603_{SPOP}_N_2()</rdfs:label>
</owl:Class>
Expand Down
12 changes: 12 additions & 0 deletions officina/999999999/999999_17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ rdfpipe --input-format=turtle --output-format=longturtle \
>"999999/0/1603_992_1_0~worldbank~SP_POP_TOTL.no1.owl.ttl"


./999999999/0/999999999_521850.py \
--methodus-fonti=worldbank \
--methodus="health" \
--objectivum-formato=hxl \
>"999999/0/1603_99966_1_0~worldbank~health.hxl.csv"

./999999999/0/999999999_521850.py \
--methodus-fonti=worldbank \
--methodus="health" \
--objectivum-formato=hxltm \
>"999999/0/1603_99966_1_0~worldbank~health.tm.hxl.csv"

# ./999999999/0/999999999_54872.py --methodus=_temp_no1 --rdf-sine-spatia-nominalibus=devnull,mdciii --rdf-trivio=1603 999999/0/1603_992_1_0~worldbank~SP_POP_TOTL.no1.tm.hxl.csv | head -n 20
# head -n 3 999999/0/1603_992_1_0~worldbank~SP_POP_TOTL.no1.tm.hxl.csv

Expand Down

0 comments on commit 93cb7bf

Please sign in to comment.