Skip to content

Commit

Permalink
Wikidata (#3), 1603:1:51 (#9): download scripts now allow select only…
Browse files Browse the repository at this point in the history
… a dataset
  • Loading branch information
fititnt committed Jan 21, 2022
1 parent bc6f8f9 commit e881ec4
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 28 deletions.
Empty file added officinam/1603/1/51/.gitkeep
Empty file.
Empty file.
38 changes: 19 additions & 19 deletions officinam/999999999/0/1603_3_12.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
# printf "30160\n1830260\n109830360\n" | ./999999999/0/2600.py --actionem-decifram


class NDT2600:
class CS1603_3_12:
def __init__(self):
self.D1613_2_60 = self._init_1613_2_60_datum()
# self.scientia_de_scriptura = {}
Expand Down Expand Up @@ -340,20 +340,20 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,

self.pyargs = pyargs

ndt2600 = NDT2600()
CS1603_3_12 = CS1603_3_12()

# ndt2600 = NDT2600()
# CS1603_3_12 = CS1603_3_12()

# print('self.pyargs', self.pyargs)

ndt2600.est_verbum_limiti(args.verbum_limiti)
ndt2600.est_resultatum_separato(args.resultatum_separato)
CS1603_3_12.est_verbum_limiti(args.verbum_limiti)
CS1603_3_12.est_resultatum_separato(args.resultatum_separato)

if args.codex_verbum_tabulae:
ndt2600.est_codex_verbum_tabulae(args.codex_verbum_tabulae)
CS1603_3_12.est_codex_verbum_tabulae(args.codex_verbum_tabulae)

if args.neo_scripturam_tabulae:
ndt2600.est_neo_scripturam_tabulae(
CS1603_3_12.est_neo_scripturam_tabulae(
args.neo_scripturam_tabulae, args.neo_scripturam_nomini)

# printf "abc\tABC\nefg\tEFG\n" | ./999999999/0/2600.py --actionem-cifram
Expand All @@ -369,7 +369,7 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,

for line in sys.stdin:
codicem = line.replace('\n', ' ').replace('\r', '')
neo_lineam = ndt2600.cifram_lineam(codicem)
neo_lineam = CS1603_3_12.cifram_lineam(codicem)
sys.stdout.writelines("{0}\n".format(neo_lineam))
return self.EXIT_OK

Expand All @@ -384,15 +384,15 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,

for line in sys.stdin:
codicem = line.replace('\n', ' ').replace('\r', '')
fontem = ndt2600.decifram_codicem_numerae(codicem)
fontem = CS1603_3_12.decifram_codicem_numerae(codicem)
sys.stdout.writelines(
"{0}{1}{2}\n".format(
codicem, args.resultatum_separato, fontem)
)
return self.EXIT_OK

if self.pyargs.neo_tabulam_numerae:
systema_numerali = ndt2600.exportatum_systema_numerali(
systema_numerali = CS1603_3_12.exportatum_systema_numerali(
self.pyargs.tabulam_numerae_initiale,
self.pyargs.tabulam_numerae_finale,
self.pyargs.tabulam_numerae_gradus
Expand All @@ -402,20 +402,20 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,
return self.output(systema_numerali)

if self.pyargs.verbum_simplex:
tabulam_multiplicatio = ndt2600.quod_tabulam_multiplicatio()
tabulam_multiplicatio = CS1603_3_12.quod_tabulam_multiplicatio()
return self.output(tabulam_multiplicatio)

if self.pyargs.codex_completum:
tabulam_multiplicatio = ndt2600.quod_codex()
tabulam_multiplicatio = CS1603_3_12.quod_codex()
return self.output(tabulam_multiplicatio)

if self.pyargs.neo_scripturam:
scientia = ndt2600.exportatum_scientia_de_scriptura(
scientia = CS1603_3_12.exportatum_scientia_de_scriptura(
args.neo_scripturam_hxl_selectum)
return self.output(scientia)

# Let's default to full table
tabulam_multiplicatio = ndt2600.quod_codex()
tabulam_multiplicatio = CS1603_3_12.quod_codex()
return self.output(tabulam_multiplicatio)
# print('unknow option.')
# return self.EXIT_ERROR
Expand Down Expand Up @@ -475,14 +475,14 @@ def output(self, output_collectiom):

# print(valueee)

# ndt2600 = NDT2600()
# CS1603_3_12 = CS1603_3_12()

# # print(quod_1613_2_60_datum())
# # print(ndt2600)
# # print(CS1603_3_12)

# print('0')
# print(ndt2600.quod_numerordinatio_digitalem('0', True))
# print(CS1603_3_12.quod_numerordinatio_digitalem('0', True))
# print('05')
# print(ndt2600.quod_numerordinatio_digitalem('05', True))
# print(CS1603_3_12.quod_numerordinatio_digitalem('05', True))
# print('zz')
# print(ndt2600.quod_numerordinatio_digitalem('zz', True))
# print(CS1603_3_12.quod_numerordinatio_digitalem('zz', True))
7 changes: 7 additions & 0 deletions officinam/999999999/1603_17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# USAGE: ./999999999/1603_17.sh
# FORCE_REDOWNLOAD=1 ./999999999/1603_17.sh
# FORCE_CHANGED=1 ./999999999/1603_17.sh
# FORCE_REDOWNLOAD_REM="1603_1_51" ./999999999/1603_17.sh
# DESCRIPTION: ---
#
# OPTIONS: ---
Expand Down Expand Up @@ -33,6 +34,7 @@ DATA_1603_45_1="https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2N
DATA_1603_84_1="https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=1366500643"
DATA_1603_44_1="https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=1333477190"
DATA_1603_44_142="https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=455141043"
DATA_1603_1_51="https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=272891124"


ROOTDIR="$(pwd)"
Expand All @@ -48,6 +50,11 @@ ROOTDIR="$(pwd)"
file_download_if_necessary "$DATA_1603_1_1" "1603_1_1" "csv" "tm.hxl.csv" "hxltmcli" "1"
file_convert_numerordinatio_de_hxltm "1603_1_1" "1" "0"


# FORCE_REDOWNLOAD_REM="1603_1_51"
file_download_if_necessary "$DATA_1603_1_51" "1603_1_51" "csv" "tm.hxl.csv" "hxltmcli" "1"
file_convert_numerordinatio_de_hxltm "1603_1_51" "1" "0"

# file_download_if_necessary "$DATA_1603_17_17" "1603_17_17" "csv" "tm.hxl.csv" "hxltmcli" "1"
# file_convert_numerordinatio_de_hxltm "1603_17_17" "1" "0"
file_download_if_necessary "$DATA_1603_3_12_6" "1603_3_12_6" "csv" "tm.hxl.csv" "hxltmcli" "1"
Expand Down
30 changes: 21 additions & 9 deletions officinam/999999999/999999999.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ numerordinatio_neo_separatum() {
# Globals:
# ROOTDIR
# FORCE_REDOWNLOAD
# FORCE_REDOWNLOAD_REM
# Arguments:
# iri
# numerordinatio
Expand Down Expand Up @@ -231,13 +232,26 @@ file_download_if_necessary() {

# return 0

if [ -z "$FORCE_REDOWNLOAD" ]; then
# echo "oi22 FORCE_REDOWNLOAD_REM [${FORCE_REDOWNLOAD_REM}] numerordinatio [$numerordinatio]"
# if [ -z "${FORCE_REDOWNLOAD_REM}" ]; then
if [ "${FORCE_REDOWNLOAD_REM}" != "" ]; then
# echo "testa se é igual"
_nomen_force=$(numerordinatio_neo_separatum "${FORCE_REDOWNLOAD_REM}" "_")
if [[ "$_nomen" == "$_nomen_force" ]]; then
# echo "_nomen_force [$_nomen_force] [$_nomen]"
_FORCE_REDOWNLOAD="1"
fi
fi

if [ -z "${FORCE_REDOWNLOAD}" ] && [ -z "${_FORCE_REDOWNLOAD}" ]; then
if [ -z "$(stale_archive "$objectivum_archivum")" ]; then return 0; fi
echo "${FUNCNAME[0]} stale data on [$objectivum_archivum], refreshing..."
else
echo "${FUNCNAME[0]} forced re-download [$objectivum_archivum]"
_FORCE_REDOWNLOAD=""
fi

# echo "going to download again.."

if [ "$downloader" == "hxltmcli" ]; then
hxltmcli "$iri" >"$objectivum_archivum_temporarium"
else
Expand All @@ -249,7 +263,6 @@ file_download_if_necessary() {
file_update_if_necessary "$archivum_typum" "$objectivum_archivum_temporarium" "$objectivum_archivum"
}


#######################################
# Convert HXLTM to numerordinatio with these defaults:
# - '#meta' are removed
Expand Down Expand Up @@ -295,15 +308,14 @@ file_convert_numerordinatio_de_hxltm() {
echo "${FUNCNAME[0]} sources changed_recently. Reloading..."

hxlcut --exclude="#meta" \
"$fontem_archivum" \
| hxlselect --query="#item+conceptum+codicem>0" \
| hxladd --before --spec="#item+conceptum+numerordinatio=${_prefix}:{{#item+conceptum+codicem}}" \
| hxlreplace --map="${ROOTDIR}/1603/13/1603_13.r.hxl.csv" \
> "$objectivum_archivum_temporarium"
"$fontem_archivum" |
hxlselect --query="#item+conceptum+codicem>0" |
hxladd --before --spec="#item+conceptum+numerordinatio=${_prefix}:{{#item+conceptum+codicem}}" |
hxlreplace --map="${ROOTDIR}/1603/13/1603_13.r.hxl.csv" \
>"$objectivum_archivum_temporarium"

#| hxlreplace --tags="#item+conceptum+numerordinatio" --pattern="_" --substitution=":" \


# hxlreplace --map="1603/13/1603_13.r.hxl.csv" 999999/999999/2020/4/1/1603_45_1.no1.tm.hxl.csv

# cp "$fontem_archivum" "$objectivum_archivum_temporarium"
Expand Down

0 comments on commit e881ec4

Please sign in to comment.