lmaurits / BEASTling

A linguistics-focussed command line tool for generating BEAST XML files.
BSD 2-Clause "Simplified" License
20 stars 6 forks source link

IDs are not unique across models #14

Closed Anaphory closed 8 years ago

Anaphory commented 8 years ago

Defining two different covarion models in my configuration file, I get

Error 104 parsing the xml input file

IDs should be unique. Duplicate id 'covarion_alpha.s' found

Error detected about here:
  <beast>
      <state id='state'>
          <parameter id='covarion_alpha.s' name='stateNode'>

IDs should always also contain the model name, I guess.

lmaurits commented 8 years ago

Thanks for catching this. This kind of problem has happened before. I plan to eventually write a nice class called NameManager or something, where you can request an id for something (e.g. NameManager.getNewID("tree") for a ID) and it will give you back a guaranteed unique ID, by internally keeping track of all previously issued IDs. This will also allow a perfectly consistent naming scheme for all kinds of IDs - it's a bit of a mess at the moment.

However, because I want to get 1.0.0 out the door soon, for now I've just put the model name in front of the current IDs, with a colon separator, which should fix this specific issue. Can you try your configuration file again to make sure this works?

Anaphory commented 8 years ago

Instead of only allocating the provision of IDs, you could have a class that assembles the DAG of references, and writes it out as xml in a (later possibly optimized) manner. This would also be able to check that all referenced IDs exist and enforce some consistency in how dependencies are specfied, as opposed to the 145 different ways beast2 permits it.

lmaurits commented 8 years ago

To my surprise, I was bit by this again yesterday when I edited tests/configs/covarion.conf to use multiple models! Apparently I didn't do a through enough job last time. However, it now works, as guaranteed by the passing tests, so I'm closing this.