Skip to content

Commit

Permalink
(#41): urn:mdciii:1603:1:1603[] dedicated numerordinatio (disk repres…
Browse files Browse the repository at this point in the history
…entation: 1603/1/1603/1603_1_1603.owl)
  • Loading branch information
fititnt committed Jun 19, 2022
1 parent 7ee15e1 commit 4914b0d
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 3 deletions.
1 change: 1 addition & 0 deletions officina/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file added officina/1603/1/1603/.gitkeep
Empty file.
4 changes: 1 addition & 3 deletions officina/MDCIII.owl → officina/1603/1/1603/1603_1_1603.owl
Original file line number Diff line number Diff line change
Expand Up @@ -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#">
<owl:Ontology rdf:about="urn:mdciii">
<owl:versionIRI rdf:resource="https://github.com/EticaAI/lexicographi-sine-finibus/blob/main/officina/MDCIII.owl"/>
<owl:Ontology rdf:about="urn:mdciii:1603:1:1603[]">
<rdfs:comment xml:lang="en">Work in progress</rdfs:comment>
</owl:Ontology>

Expand Down Expand Up @@ -2147,4 +2146,3 @@


<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->

96 changes: 96 additions & 0 deletions officina/999999999/0/1603_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 ?')

Expand Down Expand Up @@ -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 = [
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>',
'<catalog prefer="public" '
'xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
]

# 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(
' <uri id="_{0}_" name="urn:mdciii:{2}?t=owl"'
' uri="{1}/{0}.no11.owl.ttl"/>'.format(
codex__under, codex__path, codex__norm
))
elif exists(ontologia_ex_archivo_basi + '.no1.owl.ttl'):
paginae.append(
' <uri id="_{0}_" name="urn:mdciii:{2}?t=owl"'
' uri="{1}/{0}.no1.owl.ttl"/>'.format(
codex__under, codex__path, codex__norm
))

if exists(ontologia_ex_archivo_basi + '.no11.skos.ttl'):
paginae.append(
' <uri id="_{0}_" name="urn:mdciii:{2}?t=owl"'
' uri="{1}/{0}.no11.skos.ttl"/>'.format(
codex__under, codex__path, codex__norm
))
elif exists(ontologia_ex_archivo_basi + '.no1.skos.ttl'):
paginae.append(
' <uri id="_{0}_" name="urn:mdciii:{2}?t=skos"'
' uri="{1}/{0}.no1.skos.ttl"/>'.format(
codex__under, codex__path, codex__norm
))

paginae.append('</catalog>')

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):
Expand Down
4 changes: 4 additions & 0 deletions officina/catalog-v003.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri id="_1603_1_1603_" name="urn:mdciii:1603:1:1603[]" uri="1603/1/1603/1603_1_1603.owl"/>
</catalog>

0 comments on commit 4914b0d

Please sign in to comment.