diff --git a/officina/.gitignore b/officina/.gitignore index 983029c..adf93e1 100644 --- a/officina/.gitignore +++ b/officina/.gitignore @@ -25,6 +25,7 @@ node_modules !999999/0/.gitkeep !999999999/1568346/* catalog-v001.xml +!catalog-v003.xml MDCIII.devel.owl *.devel.owl *.devel.owl.ttl diff --git a/officina/1603/1/1603/.gitkeep b/officina/1603/1/1603/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/officina/MDCIII.owl b/officina/1603/1/1603/1603_1_1603.owl similarity index 99% rename from officina/MDCIII.owl rename to officina/1603/1/1603/1603_1_1603.owl index 8d7d42a..cd54085 100644 --- a/officina/MDCIII.owl +++ b/officina/1603/1/1603/1603_1_1603.owl @@ -9,8 +9,7 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:skos="http://www.w3.org/2004/02/skos/core#"> - - + Work in progress @@ -2147,4 +2146,3 @@ - diff --git a/officina/999999999/0/1603_1.py b/officina/999999999/0/1603_1.py index 7027d72..c249b80 100755 --- a/officina/999999999/0/1603_1.py +++ b/officina/999999999/0/1603_1.py @@ -156,6 +156,10 @@ --data-apothecae-ex='1603_45_1,1603_45_31' \ --data-apothecae-ad='apothecae.datapackage.json' + {0} --methodus='data-apothecae' \ +--data-apothecae-ex='1603_1_1,1603_1_51' \ +--data-apothecae-ad='999999/0/catalog-v001.xml' + {0} --methodus='data-apothecae' \ --data-apothecae-ex='1603_45_1,1603_45_31' \ --data-apothecae-ad='apothecae.sqlite' @@ -4025,6 +4029,8 @@ def __init__( self.data_apothecae_formato = 'sqlite' elif data_apothecae_ad.endswith('.json'): self.data_apothecae_formato = 'datapackage' + elif data_apothecae_ad.endswith('.xml'): + self.data_apothecae_formato = 'catalog_v001' else: raise ValueError('--data-apothecae-formato ?') @@ -4062,12 +4068,102 @@ def praeparatio(self): if self.data_apothecae_formato == 'datapackage': # return self.praeparatio_datapackage(libraria) return self.praeparatio_datapackage() + + if self.data_apothecae_formato == 'catalog_v001': + # return self.praeparatio_datapackage(libraria) + return self.praeparatio_catalog_v001() + if self.data_apothecae_formato == 'sqlite': # return self.praeparatio_sqlite(libraria) return self.praeparatio_sqlite() return True + def praeparatio_catalog_v001( + self, + temporarium: str = None): + """praeparatio_catalog_v001 _summary_ + + A Protege-like catalog-v001.xml file syntax + + Specification: + - https://en.wikipedia.org/wiki/XML_catalog + - www.oasis-open.org/committees/download.php/14810/xml-catalogs.pdf + - https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + + Examples: + - https://github.com/EnvironmentOntology + /environmental-exposure-ontology/blob/v2022-05-12/catalog-v001.xml + - https://github.com/w3c-lbd-cg/opm/blob/master/catalog-v001.xml + + See also: + - http://www.stylusstudio.com/super-catalogs.html + - https://norman.walsh.name/2003/06/05/xmlcatalogs + - https://norman.walsh.name/2003/06/26/cache + + Args: + temporarium (str, optional): _description_. Defaults to None. + """ + paginae = [ + '', + '' + ] + + # raise ValueError("TODO") + + # if bool(DATA_APOTHECAE_MINIMIS) is True: + + for codex in self.data_apothecae_ex: + codex__under = numerordinatio_neo_separatum(codex, '_') + codex__path = numerordinatio_neo_separatum(codex, '/') + codex__norm = numerordinatio_neo_separatum(codex, ':') + ontologia_ex_archivo_basi = '{0}/{1}'.format( + codex__path, codex__under, + ) + # print(ontologia_ex_archivo_basi + '.no11.tm.hxl.csv') + if exists(ontologia_ex_archivo_basi + '.no11.owl.ttl'): + paginae.append( + ' '.format( + codex__under, codex__path, codex__norm + )) + elif exists(ontologia_ex_archivo_basi + '.no1.owl.ttl'): + paginae.append( + ' '.format( + codex__under, codex__path, codex__norm + )) + + if exists(ontologia_ex_archivo_basi + '.no11.skos.ttl'): + paginae.append( + ' '.format( + codex__under, codex__path, codex__norm + )) + elif exists(ontologia_ex_archivo_basi + '.no1.skos.ttl'): + paginae.append( + ' '.format( + codex__under, codex__path, codex__norm + )) + + paginae.append('') + + if temporarium: + with open(temporarium, 'w') as archivum: + for lineam in paginae: + archivum.write(lineam + "\n") + else: + _path_archivum = NUMERORDINATIO_BASIM + '/' + self.data_apothecae_ad + # self.resultatum.append('TODO praeparatio_datapackage') + self.resultatum.append(_path_archivum) + + with open(_path_archivum, 'w') as archivum: + # Further file processing goes here + for lineam in paginae: + archivum.write(lineam + "\n") + def praeparatio_datapackage( self, temporarium: str = None): diff --git a/officina/catalog-v003.xml b/officina/catalog-v003.xml new file mode 100644 index 0000000..306a95a --- /dev/null +++ b/officina/catalog-v003.xml @@ -0,0 +1,4 @@ + + + +