From c2d766969a2da0e0b1eecdb41c3e60ecead05377 Mon Sep 17 00:00:00 2001 From: Emerson Rocha Date: Tue, 7 Jun 2022 08:30:34 -0300 Subject: [PATCH] rdf+bcp47+hxl (#41): RDF+HXL early test cases (administrative boundaries #39) --- .gitignore | 5 +- .../999999999/1568346/bcp47-to-hxl-to-rdf.sh | 95 ++++++++++++++++++- .../data/cod-ab-br--example1.bcp47.tsv | 2 - .../data/cod-ab-br--example2.bcp47.tsv | 2 - .../cod-ab-example1-with-inferences.bcp47.tsv | 3 + .../1568346/data/cod-ab-example1.bcp47.tsv | 3 + 6 files changed, 100 insertions(+), 10 deletions(-) delete mode 100644 officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv delete mode 100644 officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv create mode 100644 officina/999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv create mode 100644 officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv diff --git a/.gitignore b/.gitignore index 62908e3..8876b98 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh b/officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh index f3bd51d..4a2af20 100755 --- a/officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh +++ b/officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh @@ -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 \ @@ -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 # @@ -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 @@ -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 diff --git a/officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv b/officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv deleted file mode 100644 index bddb3b1..0000000 --- a/officina/999999999/1568346/data/cod-ab-br--example1.bcp47.tsv +++ /dev/null @@ -1,2 +0,0 @@ -qcc-Zxxx-r-sU2200-s1-snop _ _ _ -_ _ _ _ diff --git a/officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv b/officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv deleted file mode 100644 index bddb3b1..0000000 --- a/officina/999999999/1568346/data/cod-ab-br--example2.bcp47.tsv +++ /dev/null @@ -1,2 +0,0 @@ -qcc-Zxxx-r-sU2200-s1-snop _ _ _ -_ _ _ _ diff --git a/officina/999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv b/officina/999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv new file mode 100644 index 0000000..cd4816b --- /dev/null +++ b/officina/999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv @@ -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 diff --git a/officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv b/officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv new file mode 100644 index 0000000..2ad0c83 --- /dev/null +++ b/officina/999999999/1568346/data/cod-ab-example1.bcp47.tsv @@ -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