# -*- coding: utf-8; mode: fundamental; srcfile: /phm/15/03/27/mlhtsyn.txt -*- (top @adrsxm = |id|+typ+lok+plz+str+dom+mail+nom|+des+rem+| @spztab = |id|+mon+ust+odat+fdat+de+rkod+status+nom+|+des+rem+| @fylsxm = |id|fyl|+tit+des+| # data structure consist of identifiers, attributes and positional text elements # identifiers may consist only of \w+ and only the first such field may contain '_'; all are joined by '_' to form the identifier that is used to name subnodes # attributes are data fields consisting of numbers, symbols and unchangeable names # positional text elements are rewordable/translatable text elements # The identifiers and field names given here are used for rewriting the database later @adrmap = ||adrsxm|person||id|person||typ|adrtyp||des|persdes||rem|persrem| @spzmap = ||spztab|spez||id|spez||typ|speztyp||nom|speznom||des|spezdes||rem|spezrem| # simple mapping from data stucture variable to database schema, consisting of a hash of values to be changed special = tabsxm adrtab adrsxm special = sxmmap adrsxm adrmap @adrtab +>= |lyre|frm+adr+ham+24057+Hauptstraße+19+sme@lyre.com|+Lyre Music LLP+|# append a record @adrtab .= |lyre|+++++Nebenstraße+18|# modify two fields in the record identified by 'lyre', empty fields in the expression lead to no change, use '_' to overwrite a field with null; fail and warn if no record can be identified @adrtab .= |lyre|+/str/Seitengasse/+/dom/17/+|# Modification of attributes by name, using another separator level, should also work: # mnemonic: '+' add (with > push, < unshift), '-' delete (with > pop, < shift), '>' after (with + push, - pop), '<' before (with + unshift, -shift') # .= is rather special in that it actually does not replace an identified record with exactly the list structure that is specified but rather operates along the lines of A2E::Daba::put, based on info obtained thanks to the 'special = tabsxm adrtab adrsxm' connection. special = tabsxm adrtab adrsxm # that in this case is implicit in the # The '=' can be left out when other symbols are present. # Instead of '+' and '-' we can use '.' to indicate that no adding/deleting but only updating is done. # These assignement symbols are also used to indicate the way in which the node's subnodes relate to existing subnodes. (adr /proc+tabel+tab+adrtab+sxm+adrsxm+map+adrmap+get+inklud_adr+put+1/proc+adrrow/ inklud_adr = $(include_tab|/opt/a2e/share/mlht/data/adrtab.txt) # Data strcture is read from variable @adrsxm (address schema) via map @adrmap and from a file via inklud_adr, and the modified result is written into to database (put) # Processes tabel and adrrow read all the information before tabel takes back control and does the final output. # The inklud_adr function is also used via the tabget+inklud_adr switch to further populate the subnode data table @adrtab. # It is not necessary but convenient to use an external subnode data table like @adrtab. # Due to the use of the external table, the sxm and map info becomes redundant here. # Headers may now, in addition to variable assignments, also contain direct pre-assignments of values to the subnode table. # The dbmap+adrmap switch indirectly assignes a schema to the subnode table. This is redundant here. |lyre|+frm+adr+ham+24057+Hauptstraße+19+sme@lyre.com|+Lyre Music LLP+| |ldapaper|+frm+adr+fra+63207+Nordkaiplatz+1+fabius.fairmayor@ldapaper.com|+LDA Paper UK LLP+| # There's also a more verbose generic way of operating on the subnode table which is made identical to the variable @adrtab by the dbtab+artab switch. +>= # Here, after the '+>' line the text body section starts, records are used to update existing ones if such can be identified (=), otherwise appended (>). # This is the default behaviour when dbmap is active. Therefore the above specification can be omitted. (_lyre str = Nadelöhr dom = 20 多年回頭客 ) (_ldapaper str = 北方碼頭廣場 LDA紙張有限公司 ) ) (_spz /proc+tabel+dbmap+spzmap+tabget+s2get+dbput+1/proc+spzrow/ s2get = $(dbget/|match|id|\w{4}S2|/) |memoS1|126|00|2015-01-08|2015-01-12|de|lingoserv|rkod|Auftrag 1501023|f| |imibS2|2015-01-09|2015-01-13|de|lingoserv||f| (_memoS1 pre = imibS1 Memorandum der Quintus Baum GmbH Deutsch-Chinesisch 90 Zeilen a 1,70 EUR ) (_imib Gesamt ADV-Dokumente ins Chinesische und Japanische ) ) (_fyl /proc+itemlist+dbsxm+fylsxm+tabget+globget/call+fileitem/ @files = $(wildcard kfgcS3_*_resu_de.pdf) resu_match = $(list|$(match ${1},\AkfgcS3\_(.*)\_resu.de.pdf\Z)|${1}) globget = $(map|call+resu_match|@files) fileitem = $(ah|${fyl}|${tit})$(and|${des}| -- ${des}) |geburt||Geburtsurkunde|nicht zu übersetzen| .= # '.=' means that we can only overwrite, not append/prepend anything; subnodes of inexistant @files are ignored with a warning (_geburt Geburtsurkunde bereits übersetzt ) (_doktor Doktorwürdeverleihungsurkunde Summa Cum ) ) )