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

Translator generates two dates in attributes #18

Closed joaquimrcarvalho closed 10 months ago

joaquimrcarvalho commented 11 months ago

Data exported in xml contains for attributes contains two dates: the explicit date of the attribute and the date of the enclosing act:

<GROUP ID="140349-444-ls" NAME="ls" CLASS="attribute" ORDER="468" LEVEL="4" LINE="829">
    <ELEMENT NAME="line" CLASS="line"><core>829</core></ELEMENT>
    <ELEMENT NAME="id" CLASS="id"><core>140349-444-ls</core></ELEMENT>
    <ELEMENT NAME="groupname" CLASS="groupname"><core>ls</core></ELEMENT>
   <ELEMENT NAME="inside" CLASS="inside"><core>140349</core></ELEMENT>
   <ELEMENT NAME="class" CLASS="class"><core>attribute</core></ELEMENT>
    <ELEMENT NAME="order" CLASS="order"><core>468</core></ELEMENT>
    <ELEMENT NAME="level" CLASS="level"><core>4</core></ELEMENT>
   <ELEMENT NAME="tipo" CLASS="type">
         <core><![CDATA[uc.entrada]]></core>   </ELEMENT>
   <ELEMENT NAME="valor" CLASS="value">
         <core><![CDATA[1566-12-20]]></core>   </ELEMENT>
  <!-- First date, from attribute group -->
   <ELEMENT NAME="data" CLASS="date">
         <core><![CDATA[1566-12-20]]></core>   </ELEMENT>
   <ELEMENT NAME="id" CLASS="id">
         <core><![CDATA[140349-444-ls]]></core>   </ELEMENT>
   <ELEMENT NAME="entity" CLASS="entity">
         <core><![CDATA[140349]]></core>   </ELEMENT>

    <!-- Second date from enclosing act -->
   <ELEMENT NAME="date" CLASS="date">
         <core><![CDATA[20200211]]></core>   </ELEMENT>
</GROUP>

Apparently this was not a problem with the MHK importing algorithm, that uses the first, and relevant, date, but the Python algorithm overwrites the first date with the date from the act.

The problem should not exist. The date of the attribute is the explicit date if present, if not the enclosing act date, or whatever date is set at a higher scope.