Skip to content

Commit

Permalink
999999999_7200235.py (#45): --methodus=cod_ab_et_wdata uses no11.tm.h…
Browse files Browse the repository at this point in the history
…xl.csv (near 250+ languages for each adm0) if cached file exist on disk
  • Loading branch information
fititnt committed Jul 21, 2022
1 parent 7ef079a commit 2005f32
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
9 changes: 8 additions & 1 deletion officina/999999999/0/999999999_7200235.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,14 @@ def execute_cli(self, pyargs, stdin=STDIN, _stdout=sys.stdout,
numerordinatio_praefixo=numerordinatio_praefixo,
no1_simplici=True, cod_ab_level__inline=True)

caput_wdata, data_wdata = hxltm_carricato(WDATA_ADM0)
if exists(WDATA_ADM0_NO11):
caput_wdata, data_wdata = hxltm_carricato(WDATA_ADM0_NO11)
elif exists(WDATA_ADM0):
caput_wdata, data_wdata = hxltm_carricato(WDATA_ADM0)
else:
raise FileNotFoundError('[{0}, {1}] ?'.format(
WDATA_ADM0_NO11, WDATA_ADM0
))
# print(data_wdata[0])

caput, data = hxltm_carricato__cod_ab_et_wdata(
Expand Down
1 change: 1 addition & 0 deletions officina/999999999/1603_45_16.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# REQUIREMENTS: - Bash shell (or better)
# - wget
# - csvkit (https://github.com/wireservice/csvkit)
# - rapper (sudo apt install raptor2-utils)
# BUGS: ---
# NOTES: ---
# AUTHOR: Emerson Rocha <rocha[at]ieee.org>
Expand Down
63 changes: 61 additions & 2 deletions officina/999999999/999999999.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# - ssconvert (sudo apt install gnumeric)
# - wget
# - unzip
# - rapper (sudo apt install raptor2-utils)
#
# BUGS: ---
# NOTES: ---
Expand Down Expand Up @@ -1017,6 +1018,64 @@ file_convert_rdf_skos_ttl_de_numerordinatio11() {
file_update_if_necessary 'rdf_skos_ttl' "$objectivum_archivum_temporarium" "$objectivum_archivum"
}

#######################################
# Convert a "full" .no11.tm.hxl.csv to .no11.skos.ttl, method optimized for
# large datasets.
#
# @see https://www.w3.org/2015/03/ShExValidata/
#
# Globals:
# ROOTDIR
# DESTDIR
# Arguments:
# numerordinatio
# Outputs:
# Convert files
#######################################
file_convert_rdf_skos_ttl_de_numerordinatio11__v2() {
numerordinatio="$1"

_path=$(numerordinatio_neo_separatum "$numerordinatio" "/")
_nomen=$(numerordinatio_neo_separatum "$numerordinatio" "_")
_prefix=$(numerordinatio_neo_separatum "$numerordinatio" ":")

_basim_fontem="${ROOTDIR}"
_basim_objectivum="${DESTDIR}"

fontem_archivum="${_basim_fontem}/$_path/$_nomen.no11.tm.hxl.csv"
objectivum_archivum="${_basim_objectivum}/$_path/$_nomen.no11.skos.ttl"
objectivum_archivum_temporarium="${ROOTDIR}/999999/0/$_nomen.no11.skos.ttl"
# tmeta="${ROOTDIR}/999999999/0/hxltm-exemplum.tmeta.yml"

echo "@TODO finish this version. See also function bootstrap_1603_45_16__item_rdf()"
return 0

# echo "${FUNCNAME[0]}: [$fontem_archivum] --> [$objectivum_archivum]"

# "${ROOTDIR}/999999999/0/1603_1.py" \
# --methodus='status-quo' \
# --status-quo-in-rdf-skos-turtle \
# --codex-de "$_nomen" \
# >"$objectivum_archivum_temporarium"

# file_update_if_necessary 'rdf_skos_ttl' "$objectivum_archivum_temporarium" "$objectivum_archivum"

# "${ROOTDIR}/999999999/0/999999999_54872.py" \
# --objectivum-formato=_temp_no1 \
# --numerordinatio-cum-antecessoribus \
# --rdf-sine-spatia-nominalibus=devnull \
# --rdf-ontologia-ordinibus="${rdf_ontologia_ordinibus}" \
# --rdf-trivio="${rdf_trivio}" \
# <"${objectivum_archivum_no1}" >"${opus_temporibus_temporarium}"

# rapper --quiet --input=turtle --output=turtle \
# "${opus_temporibus_temporarium}" \
# >"${objectivum_archivum_no1_owl_ttl}"

# riot --validate "${objectivum_archivum_no1_owl_ttl}"

}

#######################################
# Hotfix to remove duplicated merge keys in files (in place change)
# See file_merge_numerordinatio_de_wiki_q() for reasoning
Expand Down Expand Up @@ -1702,8 +1761,8 @@ file_translate_csv_de_numerordinatio_q__v2() {
# wikiq=$(file_extract_ix_wikiq "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.tm.hxl.csv")
wikiq=$(file_extract_ix_wikiq "$fontem_archivum")

# wikidata_q_ex_totalibus "$wikiq" "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.wikiq.tm.hxl.csv"
wikidata_q_ex_totalibus "$wikiq" "$objectivum_archivum"
# wikidata_q_ex_totalibus "$wikiq" "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.wikiq.tm.hxl.csv"
wikidata_q_ex_totalibus "$wikiq" "$objectivum_archivum"
printf "\t%40s\n" "${tty_green}${FUNCNAME[0]} FINISHED OKAY ${tty_normal}"
}

Expand Down
13 changes: 11 additions & 2 deletions officina/999999999/999999_17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ ROOTDIR="$(pwd)"
### Quick tests

# file_extract_ix_wikiq "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.tm.hxl.csv" "999999/0/1603_3_45_16_1_1.uniq.q.txt"
wikiq=$(file_extract_ix_wikiq "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.tm.hxl.csv")
# wikiq=$(file_extract_ix_wikiq "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.tm.hxl.csv")

wikidata_q_ex_totalibus "$wikiq" "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.wikiq.tm.hxl.csv"
# wikidata_q_ex_totalibus "$wikiq" "999999/1603/3/45/16/1/1/1603_3_45_16_1_1.wikiq.tm.hxl.csv"
set -x
./999999999/0/999999999_7200235.py --methodus='cod_ab_et_wdata' --numerordinatio-praefixo='1603_16' > 999999/0/teste.csv
ls -lha 999999/0/teste.csv

./999999999/0/999999999_54872.py --objectivum-formato=_temp_no1 --numerordinatio-cum-antecessoribus --rdf-trivio=1603 999999/0/teste.csv > 999999/0/teste.ttl-simplici.ttl

rapper --quiet --input=turtle --output=turtle 999999/0/teste.ttl-simplici.ttl > 999999/0/teste.ttl

set +x
exit 0
### Really boostrapping downloads, end _________________________________________

Expand Down

0 comments on commit 2005f32

Please sign in to comment.