SynBioDex / SBOLDesigner

SBOL Designer Project
Apache License 2.0
30 stars 7 forks source link

Problems opening SBOL when annotation references another CD #208

Closed cjmyers closed 6 years ago

cjmyers commented 6 years ago

The issue is when you download a part from SynBioHub it has a “TopLevel” annotation that points back to the part. Then, when you try to edit the part in your own namespace, the URI is changed but the TopLevel annotation continues to point to the old CD. Then when you do “createRecursiveCopy” you end up getting both the new part and the original part. This causes SBOLDesigner to crash opening the selected CD, since getRootComponentDefinition returns two roots when only one is expected:

https://synbiohub.org/public/igem/BBa_K879018/1 https://synbiohub.utah.edu/user/codymaughan/p53_TNF_Circuit/p53_TNF_Circuit/1 Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: expected one element but was: at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:317) at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:329) at edu.utah.ece.async.sboldesigner.sbol.SBOLUtils.getRootCD(SBOLUtils.java:258) at edu.utah.ece.async.sboldesigner.sbol.editor.SBOLDesign.load(SBOLDesign.java:463) at edu.utah.ece.async.sboldesigner.sbol.editor.SBOLDesignerPanel.openDocument(SBOLDesignerPanel.java:557)

There are two options: 1) SBOLDesigner could not rely on createRecursiveCopy only producing a single root CD but instead use the identity of the part selected to determine what the root is for display.

2) Create a new createRecursiveCopy function that only traverses "definitions" and not annotations.

p53_TNF_Circuit.zip

michael13162 commented 6 years ago

6050d27fd8813775e04dcda7f2381775fd153562 1829aa1a1433256f7342992d7d27c86fe49b7e2d

I've completely removed SBOLUtils getRootCD. Every prior usage of that helper function now directly gets the rootCD through other means. This is better than what we discussed (storing the root that was selected by RootInputDialog) because that root could change. What the rootCD actually is depends on the state of the canvas, etc.

There is still a bug with Activities and saving, but this is covered in the remaining Provenance issues.