Several problems with the class ParserResult
I note several problems with the class fr.boreal.io.dlgp.ParserResult.java
in the module integraal-io
:
- This class is in the package
fr.boreal.io.dlgp
, although it is used in the interfaceParser
infr.boreal.io.api
, and thus it is not specific to DLGP. - The Javadoc in the class refers to a "Result of the DLGP parsing" and a class named "DlgpParserResult," although, again, it is not specific to DLGP.
- It is not stated in the Javadoc that this class is not lazy.
I am not sure that this class should be kept in its current state. Indeed, all the data are parsed and put into memory directly, which can be very costly. Moreover, the structures used are not structures that allow reasoning; the data need to be copied into another structure after parsing. I think this class, as it stands, is not a good practice: the parsed data should be put directly into the data structure that the user wants to use, even when it is in memory. Otherwise, this class imposes a double cost: processor time is required to create a temporary data structure that is ultimately useless, and it doubles the memory space consumed.
This is not merely a hypothetical concern. In the latter case, during the past summer, a user of Integraal could not execute a task due to a lack of memory because they used ParserResult
, which seems like the natural choice. However, it worked when they put the parsed atoms directly into a FactBase
in memory.
IMHO, this class needs to be refactored.