Skip to content

Commit

Permalink
rdf+bcp47+hxl (#41): RDF+HXL early test cases (administrative boundar…
Browse files Browse the repository at this point in the history
…ies #39)
  • Loading branch information
fititnt committed Jun 7, 2022
1 parent 4a21825 commit c2d7669
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ officina/1603/1603.statum.yml
!officina/999999999/1568346/data/unesco-thesaurus.bcp47g.tsv
!officina/999999999/1568346/data/unesco-thesaurus.tm.hxl.tsv
!officina/999999999/1568346/data/unesco-thesaurus~statement.xrdf.hxl.csv
!officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv
!officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv
!officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv
# !officina/999999999/1568346/data/cod-ab-example2.bcp47.tsv
!officina/999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv
!officina/999999999/1568346/data/hxlstandard-rdf-namespaces-hardcoded.hxl.csv
!officina/999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv
# /officina/README.md
Expand Down
95 changes: 91 additions & 4 deletions officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ test_unesco_thesaurus() {
archivum__resultata_bag2="${ROOTDIR}/999999/0/unesco-thesaurus~rdfbag2.ttl"
archivum__resultata_ttl="${ROOTDIR}/999999/0/unesco-thesaurus.rdf.ttl"
archivum__resultata_xml="${ROOTDIR}/999999/0/unesco-thesaurus.rdf.xml"
archivum__resultata_meta_json="${ROOTDIR}/999999/1568346/data/unesco-thesaurus.meta.json"

set -x
"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47_meta_in_json \
--rdf-namespaces-archivo=999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv \
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv |
jq >999999/1568346/data/unesco-thesaurus.meta.json
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__unesco_thesaurus_bcp47}" |
jq >"${archivum__resultata_meta_json}"

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
Expand Down Expand Up @@ -138,6 +139,89 @@ test_unesco_thesaurus() {
set +x
}

#######################################
# test_cod_ab
#
# Globals:
# ROOTDIR
# Arguments:
# None
# Outputs:
# Test result
#######################################
test_cod_ab() {
archivum__namespace="${ROOTDIR}/999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv"
archivum__cod_ab_bcp47="${ROOTDIR}/999999999/1568346/data/cod-ab-example1.bcp47.tsv"
archivum__resultata_bag1="${ROOTDIR}/999999/0/cod-ab-example1~rdfbag1.ttl"
archivum__resultata_bag2="${ROOTDIR}/999999/0/cod-ab-example1~rdfbag2.ttl"
archivum__resultata_bag3="${ROOTDIR}/999999/0/cod-ab-example1~rdfbag3.ttl"
archivum__resultata_bag4="${ROOTDIR}/999999/0/cod-ab-example1~rdfbag4.ttl"
archivum__resultata_ttl="${ROOTDIR}/999999/1568346/data/cod-ab-example1.rdf.ttl"
archivum__resultata_xml="${ROOTDIR}/999999/1568346/data/cod-ab-example1.rdf.xml"
archivum__resultata_meta_json="${ROOTDIR}/999999/1568346/data/cod-ab-example1.meta.json"

# officina/999999/1568346/data

set -x
"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47_meta_in_json \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
jq >"${archivum__resultata_meta_json}"

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=1 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
>"${archivum__resultata_bag1}"

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=2 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
>"${archivum__resultata_bag2}"

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=3 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
>"${archivum__resultata_bag3}"

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=4 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
>"${archivum__resultata_bag4}"

# @TODO eventually remove --nocheck
# riot --output=Turtle \
riot --time --nocheck --output=RDF/XML \
"${archivum__resultata_bag1}" \
"${archivum__resultata_bag2}" \
>"${archivum__resultata_xml}"

riot --time --nocheck --output=Turtle \
"${archivum__resultata_xml}" \
>"${archivum__resultata_ttl}"


# Is not validating rigth now; Lets allow fail
echo "before riot --validate"
# # set +e
riot --validate "${archivum__resultata_ttl}" || echo "Failed. Ignoring..."
# # set -e
echo "after riot --validate"
set +x
}

#######################################
# bcp47_and_hxlrdf_roundtrip item
#
Expand Down Expand Up @@ -303,6 +387,9 @@ bcp47_and_hxlrdf_roundtrip__drill() {

# echo "test"

test_cod_ab
exit 0

echo "bcp47_to_hxl_to_rdf__tests"
bcp47_to_hxl_to_rdf__tests

Expand Down Expand Up @@ -347,4 +434,4 @@ bcp47_and_hxlrdf_roundtrip__drill

# rdfcompare 999999/0/bfo_classes_only.owl 999999/0/21838-2/owl/bfo-2020.owl

# rdfdiff 999999/0/bfo_classes_only.owl 999999/0/21838-2/owl/bfo-2020.owl RDF/XML RDF/XML
# rdfdiff 999999/0/bfo_classes_only.owl 999999/0/21838-2/owl/bfo-2020.owl RDF/XML RDF/XML > 999999/0/diff-obo-source-vs-iso.diff
2 changes: 0 additions & 2 deletions officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv

This file was deleted.

2 changes: 0 additions & 2 deletions officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
qcc-Zxxx-r-sU2200-s1-snop-pOBO-bfo124-ps2 qcc-Zxxx-r-sU2200-s2-snop-pOBO-bfo124-ps3-pOBO-bfo171-ps1 qcc-Zxxx-r-sU2200-s3-snop-pOBO-bfo124-ps3-pOBO-bfo171-ps2 qcc-Zxxx-r-sU2200-s4-snop-pOBO-bfo124-ps4-pOBO-bfo171-ps3 por-Latn-r-pSKOS-pprefLabel-ps1 por-Latn-r-pSKOS-pprefLabel-ps2 por-Latn-r-pSKOS-pprefLabel-ps3 por-Latn-r-pSKOS-pprefLabel-ps4
1603:45:16:76:0 1603:45:16:76:1:31 1603:45:16:76:2:3106200 _ Brasil Minas Gerais Belo Horizonte _
1603:45:16:24:0 1603:45:16:24:1:7 1603:45:16:24:2:7060 1603:45:16:24:3:7060201 Angola Cuanza Sul Sumbe (Ngangula) Kikombo
3 changes: 3 additions & 0 deletions officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
qcc-Zxxx-r-sU2200-s1-snop qcc-Zxxx-r-sU2200-s2-snop-pOBO-bfo171-ps1 qcc-Zxxx-r-sU2200-s3-snop-pOBO-bfo171-ps2 qcc-Zxxx-r-sU2200-s4-snop-pOBO-bfo171-ps3 por-Latn-r-pSKOS-pprefLabel-ps1 por-Latn-r-pSKOS-pprefLabel-ps2 por-Latn-r-pSKOS-pprefLabel-ps3 por-Latn-r-pSKOS-pprefLabel-ps4
1603:45:16:76:0 1603:45:16:76:1:31 1603:45:16:76:2:3106200 _ Brasil Minas Gerais Belo Horizonte _
1603:45:16:24:0 1603:45:16:24:1:7 1603:45:16:24:2:7060 1603:45:16:24:3:7060201 Angola Cuanza Sul Sumbe (Ngangula) Kikombo

0 comments on commit c2d7669

Please sign in to comment.