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

str groups defined with json #23

Open joaquimrcarvalho opened 7 months ago

joaquimrcarvalho commented 7 months ago

The main design obstacle for user customization of Timelink is the user definition of new groups in Kleio.

New groups need to be added to the generic gacto2.str. Recently the possibility was added to use a local copy of gacto2.str (or sources.str) in a project directory inside the "structures" directory.

An issue exists #12 to allow for str files to import other str files, which would allow a user defined str to include the base one, or a subset, and add specific groups.

Another technic would be to use json to define new groups. A format to express str information in json already exists, and a copy in json of a processed str file is generated for each str processed.

The existing json notation was created for documentation purposes and needs some changes, namely, use the true parameter names (guaranteed, position, also, part, repetition, arbitrary, source).

With json schemas ad VSCode integration of json schemas in editing this could be a better solution. See https://code.visualstudio.com/docs/languages/json

    part name=bap; source=pt-acto;
    position=id,dia,mes,ano,fol,loc,celebrante;
        also=fol,loc,celebrante,obs;
        guaranteed=id,dia,mes,ano;
        repeat=celebrante,n,
                     test,referido,referida
{
  "groups": {
    "bap": {
      "name": "bap",
      "source":"pt-acto",
      "position": ["id", "dia", "mes", "ano", "fol", "loc", "celebrante"],
      "guaranteed": ["id", "dia", "mes", "ano"],
      "also": ["fol", "loc", "celebrante", "obs"],
      "repeat": ["celebrante", "n", "test", "referido", "referida"]
    }
  }
}
joaquimrcarvalho commented 7 months ago

See #12

joaquimrcarvalho commented 7 months ago

Code to adapt:

https://github.com/time-link/timelink-kleio/blob/main/src/dataDictionary.pl#L606-L635