Skip to content

BaseParser direct-xrefs fixes

Created by: mkszuba

Warning: this PR is now dependent on #326

Description

Fixes several bugs in the handling of direct xrefs and adds protection against inserting duplicate mappings.

Use case

Xref parsers inserting direct xrefs into the database.

Benefits

  • linkage_xref is now set to NULL rather than an empty string...
  • ...unless passed to add_to_direct_xref(), in which case it is actually used
  • get_direct_xref() can now retrieve xrefs with null linkage_xref
  • add_direct_xref() should now be replay-safe

Possible Drawbacks

get_direct_xref() now returns different data depending on whether it is called in list or scalar context so care must be taken to use the correct context. That said, returning a single value in scalar context has been left in for backwards compatibility and since it appears no parsers presently use get_direct_xref() (comments say it used to be used by GOParser but it seems to be no longer the case), we might just return a list regardless of the context.

Testing

Have you added/modified unit tests to test the changes? No.

If so, do the tests pass/fail? N/A

Have you run the entire test suite and no regression was detected? N/A but I have tested the changes by running a parser which uses the relevant bits of code (i.e. my delinted version of Mim2GeneParser) and the changes seem to do what they should.

Merge request reports