Skip to content

Commit

Permalink
Wikidata (#3), 1603:1:51 (#9): 1603/45/1/1603_45_1.wikiq.tm.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Jan 22, 2022
1 parent afd9ffc commit 7f7f309
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
7 changes: 6 additions & 1 deletion officinam/999999999/0_0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ ROOTDIR="$(pwd)"
printf '\n\t\e[1;32m%-6s\e[m\n' "999999999/2600.sh"
bash "${ROOTDIR}/999999999/2600.sh"

printf '\n\t\e[1;32m%-6s\e[m\n' "999999999/1603_17.sh"
bash "${ROOTDIR}/999999999/1603_17.sh"

printf '\n\t\e[1;32m%-6s\e[m\n' "999999999/1603_87.sh"
sh "${ROOTDIR}/999999999/1603_87.sh"

Expand All @@ -51,11 +54,13 @@ bash "${ROOTDIR}/999999999/1603_47_639_3.sh"
printf '\n\t\e[1;32m%-6s\e[m\n' "999999999/1603_45_49.sh"
bash "${ROOTDIR}/999999999/1603_45_49.sh"

printf '\n\t\e[1;32m%-6s\e[m\n' "999999999/1603_3_1603_45_1.sh"
bash "${ROOTDIR}/999999999/1603_3_1603_45_1.sh"

printf '\n\t\e[1;32m%-6s\e[m\n' "9999999999/1603_45_16.sh"
bash "${ROOTDIR}/999999999/1603_45_16.sh"



# sudo apt install fonts-noto fonts-noto-color-emoji
# Download: 234 MB
# Disk after: 663 MB
Expand Down
9 changes: 9 additions & 0 deletions officinam/999999999/1603_3_1603_45_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ ROOTDIR="$(pwd)"
# shellcheck source=999999999.lib.sh
. "$ROOTDIR"/999999999/999999999.lib.sh


# printf "Q1065\nQ82151\n" | ./999999999/0/1603_3_12.py --actionem-sparql --query | ./999999999/0/1603_3_12.py --actionem-sparql --csv

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

file_translate_csv_de_numerordinatio_q "1603_45_1" "0" "0"

echo "TODO $1"

# Use this to fetch translations from 1603_45_1
104 changes: 104 additions & 0 deletions officinam/999999999/999999999.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,110 @@ file_convert_numerordinatio_de_hxltm() {
file_update_if_necessary csv "$objectivum_archivum_temporarium" "$objectivum_archivum"
}

#######################################
# (...)
#
# Globals:
# ROOTDIR
# Arguments:
# numerordinatio
# est_temporarium_fontem (default "1", from 99999/)
# est_temporarium_objectivumm (dfault "0", from real namespace)
# Outputs:
# Convert files
#######################################
file_translate_csv_de_numerordinatio_q() {
numerordinatio="$1"
est_temporarium_fontem="${2:-"1"}"
est_temporarium_objectivum="${3:-"0"}"


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

if [ "$est_temporarium_fontem" -eq "1" ]; then
_basim_fontem="${ROOTDIR}/999999"
else
_basim_fontem="${ROOTDIR}"
fi
if [ "$est_temporarium_objectivum" -eq "1" ]; then
_basim_objectivum="${ROOTDIR}/999999"
else
_basim_objectivum="${ROOTDIR}"
fi

fontem_archivum="${_basim_fontem}/$_path/$_nomen.no1.tm.hxl.csv"
objectivum_archivum="${_basim_objectivum}/$_path/$_nomen.wikiq.tm.csv"
objectivum_archivum_temporarium="${ROOTDIR}/999999/0/$_nomen.no1.tm.hxl.csv"
objectivum_archivum_temporarium_b="${ROOTDIR}/999999/0/$_nomen.q.txt"
objectivum_archivum_temporarium_b_u="${ROOTDIR}/999999/0/$_nomen.uniq.q.txt"
objectivum_archivum_temporarium_b_u_wiki="${ROOTDIR}/999999/0/$_nomen.wikiq.tm.csv"

# if [ -z "$(changed_recently "$fontem_archivum")" ]; then return 0; fi

echo "${FUNCNAME[0]} sources changed_recently. Reloading..."

# echo "$fontem_archivum"

# echo "file_translate_csv_de_numerordinatio_q $1 TODO"
# echo "fontem_archivum [$fontem_archivum]"
# echo "objectivum_archivum [$objectivum_archivum]"
# echo "objectivum_archivum_temporarium [$objectivum_archivum_temporarium]"
# head -n 2 "$fontem_archivum"
hxlcut \
--include="#item+rem+i_qcc+is_zxxx+ix_wikiq,#item+conceptum+numerordinatio" \
"$fontem_archivum" |
hxlselect --query="#item+rem+i_qcc+is_zxxx+ix_wikiq>0" \
>"$objectivum_archivum_temporarium"

hxlcut \
--include="#item+rem+i_qcc+is_zxxx+ix_wikiq" \
"$fontem_archivum" |
hxlselect --query="#item+rem+i_qcc+is_zxxx+ix_wikiq>0" \
>"$objectivum_archivum_temporarium_b"

sed -i '1,2d' "${objectivum_archivum_temporarium_b}"

# sort --numeric-sort < "$objectivum_archivum_temporarium_b" > "$objectivum_archivum_temporarium_b_u"
# sort --version-sort < "$objectivum_archivum_temporarium_b" > "$objectivum_archivum_temporarium_b_u"
# sort --version-sort --field-separator="Q" < "$objectivum_archivum_temporarium_b" > "$objectivum_archivum_temporarium_b_u"
sort --version-sort --field-separator="Q" <"$objectivum_archivum_temporarium_b" | uniq >"$objectivum_archivum_temporarium_b_u"

"${ROOTDIR}/999999999/0/1603_3_12.py" --actionem-sparql --query <"$objectivum_archivum_temporarium_b_u" |
./999999999/0/1603_3_12.py --actionem-sparql --csv \
> "$objectivum_archivum_temporarium_b_u_wiki"
# "$objectivum_archivum_temporarium_b_u"

rm "$objectivum_archivum_temporarium"
rm "$objectivum_archivum_temporarium_b"
rm "$objectivum_archivum_temporarium_b_u"

# mv "$objectivum_archivum_temporarium_b_u_wiki" "$objectivum_archivum"

file_update_if_necessary csv "$objectivum_archivum_temporarium_b_u_wiki" "$objectivum_archivum"

return 0

# 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"

# #| 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"

# # Strip empty header (already is likely to be ,,,,,,)
# sed -i '1d' "${objectivum_archivum_temporarium}"

# file_update_if_necessary csv "$objectivum_archivum_temporarium" "$objectivum_archivum"
}

#######################################
# contains(string, substring)
#
Expand Down

0 comments on commit 7f7f309

Please sign in to comment.