Skip to content

Commit

Permalink
rdf+bcp47+hxl (#41), admin-l (#39), pcodes (#2): HXL_HASHTAGS_AD_WIKI…
Browse files Browse the repository at this point in the history
…DATA mappings improved
  • Loading branch information
fititnt committed Jun 11, 2022
1 parent 9c2922f commit abe808e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 57 deletions.
14 changes: 7 additions & 7 deletions officina/999999999/0/999999999_54872.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
Temporary tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(Debug information in JSON)
{0} --objectivum-formato=_temp_bcp47_meta_in_json \
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-bag=2
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-trivio=2
{0} --objectivum-formato=_temp_bcp47_meta_in_json \
--rdf-namespaces-archivo=\
Expand All @@ -114,15 +114,15 @@
(Data operations)
{0} --objectivum-formato=_temp_bcp47 \
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-bag=2
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-trivio=2
{0} --objectivum-formato=_temp_bcp47 --rdf-namespaces-archivo=\
999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv \
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-bag=1
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-trivio=1
{0} --objectivum-formato=_temp_bcp47 --rdf-namespaces-archivo=\
999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv \
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-bag=2
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-trivio=2
{0} --objectivum-formato=_temp_bcp47 --rdf-namespaces-archivo=\
999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv \
Expand All @@ -132,12 +132,12 @@
(Data operation; example of "SKOS version" without OWL/OBO assertions)
{0} --objectivum-formato=_temp_bcp47 \
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv \
--rdf-sine-spatia-nominalibus=owl,obo,devnull --rdf-bag=2
--rdf-sine-spatia-nominalibus=owl,obo,devnull --rdf-trivio=2
(Data operation; example of "OWL + OBO" without SKOS linguistic metadata)
{0} --objectivum-formato=_temp_bcp47 \
999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv \
--rdf-sine-spatia-nominalibus=skos,wdata,devnull --rdf-bag=2
--rdf-sine-spatia-nominalibus=skos,wdata,devnull --rdf-trivio=2
(Data operations, header conversion RDF+HXL -> RDF+BCP47)
varbcp47=$(head -n1 \
Expand Down Expand Up @@ -282,7 +282,7 @@ def make_args(self, hxl_output=True):
)

parser.add_argument(
'--rdf-bag',
'--rdf-trivio',
help='(Advanced) RDF bag; extract triples from tabular data from '
'other groups than 1',
dest='rdf_bag',
Expand Down
4 changes: 2 additions & 2 deletions officina/999999999/0/999999999_826165.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{0} --objectivum-formato=_temp_bcp47 --rdf-namespaces-archivo=\
999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv \
--rdf-bag=2 \
--rdf-trivio=2 \
999999999/1568346/data/unesco-thesaurus.bcp47g.tsv
{0} --objectivum-formato=_temp_bcp47 --rdf-namespaces-archivo=\
Expand Down Expand Up @@ -209,7 +209,7 @@ def make_args(self, hxl_output=True):
# # ex
# # fontī, m, s, dativus, https://en.wiktionary.org/wiki/fons#Latin
parser.add_argument(
'--rdf-bag',
'--rdf-trivio',
help='(Advanced) RDF bag; extract triples from tabular data from '
'other groups than 1',
dest='rdf_bag',
Expand Down
28 changes: 19 additions & 9 deletions officina/999999999/0/L999999999_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,36 +232,45 @@
# wdtaxonomy Q6256 -P P131
HXL_HASHTAGS_AD_WIKIDATA = {
'#country': {
'wdata': 'Q6256' # country
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q6256', # country
'rdftrivio': '5000'
},
# Not a valid HXL hashtag, but using anyway as alias to country
'#adm0': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q6256' # country
'wdata': 'Q6256', # country
'rdftrivio': '5000'
},
'#adm1': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q10864048' # first-level administrative country subdivisio
'wdata': 'Q10864048', # first-level administrative country subdivisio
'rdftrivio': '5001'
},
'#adm2': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q13220204' # second-level administrative country subdivision
'wdata': 'Q13220204', # second-level administrative country subdivision
'rdftrivio': '5002'
},
'#adm3': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q13221722' # third-level administrative country subdivision
'wdata': 'Q13221722', # third-level administrative country subdivision
'rdftrivio': '5003'
},
'#adm4': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q14757767' # fourth-level administrative country subdivision
'wdata': 'Q14757767', # fourth-level administrative country subdivision
'rdftrivio': '5004'
},
'#adm5': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q15640612' # fifth-level administrative country subdivision
'wdata': 'Q15640612', # fifth-level administrative country subdivision
'rdftrivio': '5005'
},
'#adm6': {
'hxlattrs': HXL_ATTRIBUTES_AD_WIKIDATA['geo'],
'wdata': 'Q22927291' # sixth-level administrative country subdivision
'wdata': 'Q22927291', # sixth-level administrative country subdivision
'rdftrivio': '5006'
},
}

Expand Down Expand Up @@ -2196,7 +2205,8 @@ def _helper_aux_triple(
triple = [triple_subject, 'a', predicate]
result['rdf_triplis'].append(triple)

for referenced_by in bag_meta['indices_columnis']:
# for referenced_by in bag_meta['indices_columnis']:
for referenced_by in bag_meta['indices_cum_aliis']:
if referenced_by == index_id:
continue

Expand Down
44 changes: 22 additions & 22 deletions officina/999999999/1568346/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,31 @@ for datasets that already are highly reusable, as mere suggestion:
### Suggested "subject group" for country, and administrative boundaries 1 to 6+

- Country:
- Number: `500`
- BCP47 RDF extension part (self): `r-sU2200-s500-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s500`
- Number: `5000`
- BCP47 RDF extension part (self): `r-sU2200-s5000-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5000`
- #adm1:
- Number: `501`
- BCP47 RDF extension part (self): `r-sU2200-s501-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s501`
- Number: `5001`
- BCP47 RDF extension part (self): `r-sU2200-s5001-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5001`
- #adm2:
- Number: `502`
- BCP47 RDF extension part (self): `r-sU2200-s502-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s502`
- Number: `5002`
- BCP47 RDF extension part (self): `r-sU2200-s5002-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5002`
- #adm3:
- Number: `503`
- BCP47 RDF extension part (self): `r-sU2200-s503-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s503`
- Number: `5003`
- BCP47 RDF extension part (self): `r-sU2200-s5003-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5003`
- #adm4:
- Number: `504`
- BCP47 RDF extension part (self): `r-sU2200-s504-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s504`
- Number: `5004`
- BCP47 RDF extension part (self): `r-sU2200-s5004-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5004`
- #adm5:
- Number: `505`
- BCP47 RDF extension part (self): `r-sU2200-s505-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s505`
- Number: `5005`
- BCP47 RDF extension part (self): `r-sU2200-s5005-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s5005`
- #adm6:
- Number: `506`
- Number: `5006`
- BCP47 RDF extension part (self): `r-sU2200-s506-snop`
- HXL RDF attribute (self): `+rdf_s_u2200_s506`

Expand All @@ -98,9 +98,9 @@ for datasets that already are highly reusable, as mere suggestion:
> dataset, for a dataset that is for example about #adm3, you could:
>
> - #adm3:
> - Number: `503` and `1`
> - BCP47 RDF extension part (self): `r-sU2200-s1-snop-sU2200-s503-snop`
> - HXL RDF attribute (self): `+rdf_s_u2200_s1+rdf_s_u2200_s503`
> - Number: `5003` and `1`
> - BCP47 RDF extension part (self): `r-sU2200-s1-snop-sU2200-s5003-snop`
> - HXL RDF attribute (self): `+rdf_s_u2200_s1+rdf_s_u2200_s5003`

## To Dos
Expand Down
33 changes: 17 additions & 16 deletions officina/999999999/1568346/bcp47-to-hxl-to-rdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ test_unesco_thesaurus() {

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=1 \
--rdf-trivio=1 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__unesco_thesaurus_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-trivio=2 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__unesco_thesaurus_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
Expand Down Expand Up @@ -190,31 +190,31 @@ test_cod_ab() {

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=1 \
--rdf-trivio=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-trivio=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-trivio=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-trivio=4 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
Expand Down Expand Up @@ -273,44 +273,45 @@ test_cod_ab__with_inferences_prebuild() {
# officina/999999/1568346/data

# @TODO: implement implicit aliases when sU2200 reference multiple subject
# groups (like s500-s506 for administrative regions) but user
# askis for s1 and s1 is also one of these s500-s506.
# groups (like s5000-s506 for administrative regions) but user
# askis for s1 and s1 is also one of these s5000-s506.

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

"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=500 \
--rdf-trivio=5000 \
--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=501 \
--rdf-trivio=5001 \
--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=502 \
--rdf-trivio=5002 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
>"${archivum__resultata_bag3}"

# --rdf-trivio=503 is equivalent to --rdf-trivio=1
"${ROOTDIR}/999999999/0/999999999_54872.py" \
--objectivum-formato=_temp_bcp47 \
--rdf-bag=503 \
--rdf-trivio=1 \
--rdf-namespaces-archivo="${archivum__namespace}" \
"${archivum__cod_ab_bcp47}" |
rapper --quiet --input=turtle --output=turtle /dev/fd/0 \
Expand Down Expand Up @@ -560,13 +561,13 @@ exit 0
# ./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


# ./999999999/0/999999999_54872.py 999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-namespaces-archivo=999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv --objectivum-formato=_temp_bcp47_meta_in_json --rdf-bag=1 | jq
# ./999999999/0/999999999_54872.py 999999999/1568346/data/unesco-thesaurus.bcp47g.tsv --rdf-namespaces-archivo=999999999/1568346/data/hxlstandard-rdf-namespaces-example.hxl.csv --objectivum-formato=_temp_bcp47_meta_in_json --rdf-trivio=1 | jq

# ./999999999/0/999999999_54872.py 999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --objectivum-formato=_temp_bcp47_meta_in_json --rdf-bag=1 | jq
# ./999999999/0/999999999_54872.py 999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --objectivum-formato=_temp_bcp47_meta_in_json --rdf-trivio=1 | jq

# ./999999999/0/linguacodex.py --de_bcp47_simplex --de_codex=por-Latn-r-pSKOS-pprefLabel-ps4

# ./999999999/0/999999999_54872.py --objectivum-formato=_temp_bcp47 999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-bag=2 --rdf-sine-spatia-nominalibus=skos
# ./999999999/0/999999999_54872.py --objectivum-formato=_temp_bcp47 999999999/1568346/data/cod-ab-example1-with-inferences.bcp47.tsv --rdf-trivio=2 --rdf-sine-spatia-nominalibus=skos

#### BFO _______________________________________________________________________
# @see https://standards.iso.org/iso-iec/21838/-2/ed-1/en/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s500-snop-pOBO-pbfo124-ps501 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s501-snop-pOBO-pbfo124-ps502-pOBO-pbfo171-ps500 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s502-snop-pOBO-pbfo124-ps502-pOBO-pbfo171-ps501 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s1-snop-sU2200-s503-snop-pOBO-pbfo124-ps503-pOBO-pbfo171-ps502 por-Latn-r-pSKOS-pprefLabel-ps500 por-Latn-r-pSKOS-pprefLabel-ps501 por-Latn-r-pSKOS-pprefLabel-ps502 por-Latn-r-pSKOS-pprefLabel-ps503
qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s5000-snop-pOBO-pbfo124-ps5001 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s5001-snop-pOBO-pbfo124-ps5002-pOBO-pbfo171-ps5000 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s5002-snop-pOBO-pbfo124-ps5002-pOBO-pbfo171-ps5001 qcc-Zxxx-r-aOBO-abfo29-anop-sU2200-s1-snop-sU2200-s5003-snop-pOBO-pbfo124-ps5003-pOBO-pbfo171-ps5002 por-Latn-r-pSKOS-pprefLabel-ps5000 por-Latn-r-pSKOS-pprefLabel-ps5001 por-Latn-r-pSKOS-pprefLabel-ps5002 por-Latn-r-pSKOS-pprefLabel-ps5003
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 abe808e

Please sign in to comment.