From 3c0d91c23ee5ae0f983c2c99b8fb4e46540788b5 Mon Sep 17 00:00:00 2001 From: Emerson Rocha Date: Tue, 14 Jun 2022 18:31:57 -0300 Subject: [PATCH] rdf+bcp47+hxl (#41), skos (#38): ok, at least not breaking the reasoner --- officina/999999999/0/L999999999_0.py | 63 ++++++++++++++++++++-------- officina/999999999/1603_45_16.sh | 2 +- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/officina/999999999/0/L999999999_0.py b/officina/999999999/0/L999999999_0.py index 6cb3297..71934cd 100644 --- a/officina/999999999/0/L999999999_0.py +++ b/officina/999999999/0/L999999999_0.py @@ -2412,7 +2412,18 @@ def _helper_aux_triple( trivium_antecessori = linea[index_id].split(':') # This initialize trivium_antecessori.pop() - numerordinatio_cum_antecessoribus(trivium_antecessori) + if len(trivium_antecessori) > 0 and len(trivium_antecessori[0]) > 0: + # trivium_antecessori = list(trivium_antecessori) + numerordinatio_cum_antecessoribus(trivium_antecessori) + + _ns = ':'.join(trivium_antecessori) + + if len(_ns.strip()) > 0: + result['rdf_triplis'].append([ + ''.format(_ns), + 'skos:member', + triple_subject + ]) elif is_urn: triple_subject = ''.format(linea[index_id]) triple_rdfs_label_literal = linea[index_id] @@ -5851,6 +5862,9 @@ def numerordinatio_cum_antecessoribus( _numerordinatio = numerordinatio_neo_separatum(numerordinatio, ':') numerordinatio = _numerordinatio.split(':') + if len(numerordinatio) == 0 or len(numerordinatio[0].strip()) == 0: + raise SyntaxError(numerordinatio) + if ':'.join(numerordinatio) in NUMERODINATIO_ANTECESSORIBUS__OKAY: return NUMERODINATIO_ANTECESSORIBUS__RDF_TRIPLIS @@ -5882,14 +5896,14 @@ def numerordinatio_cum_antecessoribus( elif ordo == radix: NUMERODINATIO_ANTECESSORIBUS__RDF_TRIPLIS.extend([ [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'a', 'skos:ConceptScheme', ], [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'rdfs:label', - '"::{0}::"'.format(':'.join(trivium)), + '"({0})"'.format(':'.join(trivium)), ], # [ # ''.format(praefixum, ':'.join(trivium)), @@ -5901,43 +5915,58 @@ def numerordinatio_cum_antecessoribus( elif ordo == (radix + 1): NUMERODINATIO_ANTECESSORIBUS__RDF_TRIPLIS.extend([ [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'a', # 'skos:ConceptScheme', 'skos:Collection', ], [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'rdfs:label', - '"::{0}::"'.format(':'.join(trivium)), + '"({0})"'.format(':'.join(trivium)), ], [ - ''.format(praefixum, ':'.join(trivium)), - # 'skos:inScheme', - 'skos:member', - ''.format( + ''.format(praefixum, ':'.join(trivium)), + # 'skos:member', + # ''.format( + # praefixum, ':'.join(trivium_antecessori)), + 'skos:inScheme', + # 'skos:member', + ''.format( praefixum, ':'.join(trivium_antecessori)), + # ''.format(praefixum, ':'.join(trivium)), ] + # [ + # # ''.format(praefixum, ':'.join(trivium)), + # # 'skos:member', + # ''.format( + # praefixum, ':'.join(trivium_antecessori)), + # # 'skos:inScheme', + # 'skos:member', + # # ''.format( + # # praefixum, ':'.join(trivium_antecessori)), + # ''.format(praefixum, ':'.join(trivium)), + # ] ]) else: NUMERODINATIO_ANTECESSORIBUS__RDF_TRIPLIS.extend([ [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'a', # 'skos:ConceptScheme', 'skos:Collection', ], [ - ''.format(praefixum, ':'.join(trivium)), + ''.format(praefixum, ':'.join(trivium)), 'rdfs:label', - '"::{0}::"'.format(':'.join(trivium)), + '"({0})"'.format(':'.join(trivium)), ], [ - ''.format(praefixum, ':'.join(trivium)), + ''.format( + praefixum, ':'.join(trivium_antecessori)), # 'skos:inScheme', 'skos:member', - ''.format( - praefixum, ':'.join(trivium_antecessori)), + ''.format(praefixum, ':'.join(trivium)), ] ]) pass diff --git a/officina/999999999/1603_45_16.sh b/officina/999999999/1603_45_16.sh index 0346506..1dc2a28 100755 --- a/officina/999999999/1603_45_16.sh +++ b/officina/999999999/1603_45_16.sh @@ -129,7 +129,7 @@ bootstrap_1603_45_16__all() { continue fi - bootstrap_1603_45_16__item_no1 "$numerordinatio_praefixo" "$unm49" "$v_iso3" "$v_iso2" "$cod_ab_level_max" "1" "0" + # bootstrap_1603_45_16__item_no1 "$numerordinatio_praefixo" "$unm49" "$v_iso3" "$v_iso2" "$cod_ab_level_max" "1" "0" bootstrap_1603_45_16__item_rdf "$numerordinatio_praefixo" "$unm49" "$v_iso3" "$v_iso2" "$cod_ab_level_max" "1" "0" # echo "Sleep 5 (disable me later)"