Skip to content

Commit

Permalink
1603_1,py (#39): OntologiaSimplici() started
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed May 27, 2022
1 parent b995f80 commit dc549c9
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 15 deletions.
52 changes: 37 additions & 15 deletions officina/999999999/0/1603_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
import yaml

from L999999999_0 import (
OntologiaSimplici,
OntologiaSimpliciAdOWL,
bcp47_langtag,
DictionariaLinguarum,
DictionariaInterlinguarum,
Expand Down Expand Up @@ -187,9 +189,12 @@
--ex-librario='locale'
Ontologia simplicī . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
{0} --methodus='ontologia-simplici' --ontologia-de 1603_1_1
{0} --methodus='ontologia-simplici' --ontologia-radici=1603_1_1
{0} --methodus='ontologia-simplici' --ontologia-de 1603_1_7
{0} --methodus='ontologia-simplici' --ontologia-radici=1603_1_7
{0} --methodus='ontologia-simplici' --ontologia-radici=1603_1_7 \
--ontologia-ex-archivo=1603/1/7/1603_1_7.no1.tm.hxl.csv
Opus temporibus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
{0} --methodus='opus-temporibus' --ex-opere-temporibus='cdn'
Expand Down Expand Up @@ -979,7 +984,7 @@ def codex_archio(self) -> list:
- dictiōnāria, n, pl, (Nominative),
https://en.wiktionary.org/wiki/dictionarium#Latin
- archīva, n, pl, (Nominative)
- ex (+ ablative), https://en.wiktionary.org/wiki/ex#Latin
- ex (+ ablativus), https://en.wiktionary.org/wiki/ex#Latin
- ad (+ accusative), https://en.wiktionary.org/wiki/ad#Latin
- ab (+ ablative), https://en.wiktionary.org/wiki/ab#Latin
- prō (+ ablative, accusative) (accusative in Late Latin)
Expand Down Expand Up @@ -5069,14 +5074,23 @@ def make_args(self, hxl_output=True):
"Ontologia simplicī",
'[ --methodus=\'ontologia-simplici\' ] '
"Otimized generation of OWL from previous generated table "
"Requires --ontologia-de 1603_NN_NN (focused Codex). "
"Requires --ontologia-radici 1603_NN_NN (focused Codex). "
)

ontologia_simplici.add_argument(
'--ontologia-de',
'--ontologia-radici',
help='Working ontology code',
# metavar='',
dest='ontologia_de',
dest='ontologia_radici',
# const=True,
nargs='?'
)

ontologia_simplici.add_argument(
'--ontologia-ex-archivo',
help='Explicit path to a file on disk. ',
# metavar='',
dest='ontologia_ex_archivo',
# const=True,
nargs='?'
)
Expand Down Expand Up @@ -5338,18 +5352,26 @@ def execute_cli(self, pyargs, stdin=STDIN, stdout=sys.stdout,
return self.output(data_apothecae.imprimere())
# return self.output(['TODO...'])

# Opus temporibus _____________________________________________________
# if self.pyargs.dictionaria_numerordinatio:
# if pyargs.methodus == 'opus-temporibus' or \
# self.pyargs.ex_opere_temporibus and \
# len(self.pyargs.ex_opere_temporibus) > 0:
# Ontologia Simplicī ___________________________________________________
if pyargs.methodus == 'ontologia-simplici':
# @TODO implement from direct file
if not pyargs.ontologia_de:
raise ValueError('--ontologia-de ?')
if not pyargs.ontologia_radici:
raise ValueError('--ontologia-radici ?')

if not pyargs.ontologia_ex_archivo:
raise NotADirectoryError(
'@TODO infer from --ontologia-radici ')
ontologia_ex_archivo = pyargs.ontologia_ex_archivo

ontologia = OntologiaSimpliciAdOWL(
pyargs.ontologia_radici,
ontologia_ex_archivo
)
# print(ontologia)
ontologia.imprimere_ad_tabula()

print(pyargs.ontologia_de)
return self.EXIT_ERROR
print(pyargs.ontologia_radici)
return self.EXIT_OK

# Opus temporibus _____________________________________________________
# if self.pyargs.dictionaria_numerordinatio:
Expand Down
75 changes: 75 additions & 0 deletions officina/999999999/0/L999999999_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import sys
from datetime import date, datetime
from typing import (
Iterator,
List,
Tuple,
Type,
Expand Down Expand Up @@ -2896,6 +2897,69 @@ def numerordinatio_progenitori(
return separatum.join(_parts)


class OntologiaSimplici:
"""Ontologia Simplicī
Trivia:
- ontologia, ---, https://en.wiktionary.org/wiki/ontologia#Latin
- simplicī, s, m/f/b, dativus, https://en.wiktionary.org/wiki/simplex
- ex (+ ablativus), https://en.wiktionary.org/wiki/ex#Latin
- rādīcī, s, f, dativus, https://en.wiktionary.org/wiki/radix#Latin
- archīvō, s, n, dativus, https://en.wiktionary.org/wiki/archivum
@see https://www.w3.org/2001/sw/BestPractices/OEP/SimplePartWhole
@see https://www.w3.org/TR/owl2-overview/#Overview
"""

# No 1603 prefix
ontologia_radici: str = None
data_apothecae_ex: str = []
caput_no1: List[str] = None
data: List[list] = None

PRAEFIXUM = [
'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .',
'@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .',
'@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .',
'@prefix owl: <http://www.w3.org/2002/07/owl#> .'
]

def __init__(
self,
ontologia_radici: str,
ontologia_ex_archivo: str,
):

self.ontologia_radici = ontologia_radici
self.ontologia_ex_archivo = ontologia_ex_archivo

self.initiari()

def initiari(self):
"""initiarī
Trivia:
- initiārī, https://en.wiktionary.org/wiki/initio#Latin
"""
self.caput_no1, self.data = hxltm_carricato(self.ontologia_ex_archivo)
# pass

def imprimere_ad_tabula(self, punctum_separato: str = ","):
csv_imprimendo(
self.caput_no1, self.data, punctum_separato=punctum_separato)
# return self.resultatum


class OntologiaSimpliciAdOWL(OntologiaSimplici):
def imprimere_owl(self, punctum_separato: str = ","):
paginae = []
paginae.extend(self.PRAEFIXUM)

ttl_imprimendo(paginae)


def qhxl(rem: dict, query: Union[str, list]):
if isinstance(query, str):
query = [query]
Expand Down Expand Up @@ -3389,6 +3453,17 @@ def quod_rdf_skos_ttl_concepta(self) -> list:
return paginae


def ttl_imprimendo(
paginae: Iterator[str],
archivum_trivio: str = None):
if archivum_trivio:
raise NotImplementedError('{0}'.format(archivum_trivio))
# imprimendō, v, s, dativus, https://en.wiktionary.org/wiki/impressus#Latin

for linea in paginae:
print(linea)


class XLSXSimplici:
"""Read-only wrapper for XLSX files
Expand Down

0 comments on commit dc549c9

Please sign in to comment.