time-link / timelink-kleio

Provides translation of files in Kleio notation into XML and other formats. Part of Timelink.
1 stars 0 forks source link

Automatic generation of database mappings #28

Open joaquimrcarvalho opened 8 months ago

joaquimrcarvalho commented 8 months ago

Could the Kleio server automatically generate a new database mapping for a group?

Currently if a new group is processed and there is no database mapping specific for that group, Kleio Server will use a mapping from a class up in the group inheritance hierarchy. For instance, there is no mapping for the various groups that specialize "Acts". They all are stored in the generic acts table.

Since all the groups inherit from Entities, there is always a way to store them in the database, but there will be loss of information if the groups define extra elements. This already occurs with baptisms and specially with Portuguese burials (óbitos).

The Kleio translator can easily find the closest mapping and also can determine which elements of the group are not mapped. It could generate a mapping that specializes the closest mapping and adds columns for new elements. The only problem is determining the data type of the new elements. This could be done by assigning a source to the new elements that allow the system to determine the data type .

We already have elements that serve as data type markers (day, month, year, same_as, id, obs). We could add various varchar variants (v1024,v16656, v32768), and so on.

The inferred mapping could go to a mapping file in json format as suggested elsewhere.

To be determined: is this a stru processing enhancement or a gactoxml enhacement?

joaquimrcarvalho commented 2 months ago

This would generate a new mapping each time a file is processed Even if the table already exists in the database. Possibly generated by a previous import.

joaquimrcarvalho commented 1 month ago

See #24

joaquimrcarvalho commented 1 month ago

This would generate a new mapping each time a file is processed Even if the table already exists in the database. Possibly generated by a previous import.

But this is already the case. Each xml file with the translation carries all the mappings related to all the groups in the file from entities down in the hierarchy.

The question is rather if all the elements of the new group should go to a new table or if we take just the guaranteed.

Note that this solution can coexist with the json based solution in #24