nus-yam/ex-repair huggingface dataset:
Program: 12364
Project: 12364
Buggy source:
void copy(Component component) throws SBOLValidationException {
  ((ComponentInstance)this).copy((ComponentInstance)component);
  if (!component.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : component.getMapsTos()) {
      String displayId=URIcompliance.findDisplayId(mapsTo);
      String localDisplayId=URIcompliance.findDisplayId(mapsTo.getLocal());
      MapsTo newMapsTo=this.createMapsTo(displayId,mapsTo.getRefinement(),localDisplayId,mapsTo.getRemoteURI());
      newMapsTo.copy(mapsTo);
    }
  }
  for (  URI role : component.getRoles()) {
    this.addRole(URI.create(role.toString()));
  }
}

Fixed version (ground truth):
void copy(Component component) throws SBOLValidationException {
  ((ComponentInstance)this).copy((ComponentInstance)component);
  this.mapsTos=new HashMap<>();
  for (  URI role : component.getRoles()) {
    this.addRole(URI.create(role.toString()));
  }
}
Program: 12365
Project: 12365
Buggy source:
void copy(FunctionalComponent functionalComponent) throws SBOLValidationException {
  ((ComponentInstance)this).copy((ComponentInstance)functionalComponent);
  this.mapsTos=new HashMap<>();
  if (!functionalComponent.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : functionalComponent.getMapsTos()) {
      String displayId=URIcompliance.findDisplayId(mapsTo);
      String localDisplayId=URIcompliance.findDisplayId(mapsTo.getLocal());
      MapsTo newMapsTo=this.createMapsTo(displayId,mapsTo.getRefinement(),localDisplayId,mapsTo.getRemoteURI());
      newMapsTo.copy(mapsTo);
    }
  }
}

Fixed version (ground truth):
void copy(FunctionalComponent functionalComponent) throws SBOLValidationException {
  ((ComponentInstance)this).copy((ComponentInstance)functionalComponent);
  this.mapsTos=new HashMap<>();
}
Program: 12378
Project: 12378
Buggy source:
/** 
 * Validates if all URI references to SBOL objects are in the same given SBOL document.
 * @param sbolDocument the given SBOL document to be validated for completeness
 */
private static void validateCompleteness(SBOLDocument sbolDocument){
  for (  Identified identified : sbolDocument.getTopLevels()) {
    checkIdentifiedCompleteness(sbolDocument,identified);
  }
  for (  Collection collection : sbolDocument.getCollections()) {
    checkCollectionCompleteness(sbolDocument,collection);
  }
  for (  ComponentDefinition componentDefinition : sbolDocument.getComponentDefinitions()) {
    checkComponentDefinitionCompleteness(sbolDocument,componentDefinition);
  }
  for (  ModuleDefinition moduleDefinition : sbolDocument.getModuleDefinitions()) {
    checkModuleDefinitionCompleteness(sbolDocument,moduleDefinition);
  }
}

Fixed version (ground truth):
/** 
 * Validates if all URI references to SBOL objects are in the same given SBOL document.
 * @param sbolDocument the given SBOL document to be validated for completeness
 */
private static void validateCompleteness(SBOLDocument sbolDocument){
  for (  Identified identified : sbolDocument.getTopLevels()) {
    checkIdentifiedCompleteness(sbolDocument,identified);
  }
  for (  Collection collection : sbolDocument.getCollections()) {
    checkCollectionCompleteness(sbolDocument,collection);
  }
  for (  ComponentDefinition componentDefinition : sbolDocument.getComponentDefinitions()) {
    checkComponentDefinitionCompleteness(sbolDocument,componentDefinition);
  }
  for (  ModuleDefinition moduleDefinition : sbolDocument.getModuleDefinitions()) {
    checkModuleDefinitionCompleteness(sbolDocument,moduleDefinition);
  }
  for (  Activity activity : sbolDocument.getActivities()) {
    checkActivityCompleteness(sbolDocument,activity);
  }
}
Program: 12379
Project: 12379
Buggy source:
/** 
 * Creates an implementation, and then adds it to this SBOL document's list of implementations. <p> This method creates a compliant URI for the implementation to be created first. It starts with the given URI prefix after its been successfully validated, followed by the given display ID, and ends with the given version.
 * @param URIprefix the URI prefix used to construct the compliant URI for the implementation to be created
 * @param displayId the display ID of the implementation to be created
 * @param version the version of the implementation to be created
 * @param template the template URI of the implementation to be created
 * @return the created implementation
 * @throws SBOLValidationException if any of the following SBOL validation rules was violated: TODO: 10201, 10202, 10204, 10206, 10220, 10502, 10503.
 */
public Implementation createImplementation(String URIprefix,String displayId,String version) throws SBOLValidationException {
  URIprefix=URIcompliance.checkURIprefix(URIprefix);
  Implementation cd=new Implementation(createCompliantURI(URIprefix,TopLevel.IMPLEMENTATION,displayId,version,typesInURIs));
  cd.setDisplayId(displayId);
  cd.setPersistentIdentity(createCompliantURI(URIprefix,TopLevel.IMPLEMENTATION,displayId,"String_Node_Str",typesInURIs));
  cd.setVersion(version);
  addImplementation(cd);
  return cd;
}

Fixed version (ground truth):
/** 
 * Creates an implementation, and then adds it to this SBOL document's list of implementations. <p> This method creates a compliant URI for the implementation to be created first. It starts with the given URI prefix after its been successfully validated, followed by the given display ID, and ends with the given version.
 * @param URIprefix the URI prefix used to construct the compliant URI for the implementation to be created
 * @param displayId the display ID of the implementation to be created
 * @param version the version of the implementation to be created
 * @return the created implementation
 * @throws SBOLValidationException if any of the following SBOL validation rules was violated: TODO: 10201, 10202, 10204, 10206, 10220, 10502, 10503.
 */
public Implementation createImplementation(String URIprefix,String displayId,String version) throws SBOLValidationException {
  URIprefix=URIcompliance.checkURIprefix(URIprefix);
  Implementation cd=new Implementation(createCompliantURI(URIprefix,TopLevel.IMPLEMENTATION,displayId,version,typesInURIs));
  cd.setDisplayId(displayId);
  cd.setPersistentIdentity(createCompliantURI(URIprefix,TopLevel.IMPLEMENTATION,displayId,"String_Node_Str",typesInURIs));
  cd.setVersion(version);
  addImplementation(cd);
  return cd;
}
Program: 12381
Project: 12381
Buggy source:
/** 
 * Sets the URI of the built property to the given one.
 * @param builtURI the given URI to set to
 * @throws SBOLValidationException on SBOL validation rule violation XXXXX.
 */
public void setBuiltURI(URI builtURI) throws SBOLValidationException {
  if (this.getSBOLDocument().getComponentDefinition(builtURI) == null && this.getSBOLDocument().getModuleDefinition(builtURI) == null) {
    throw new SBOLValidationException("String_Node_Str",this);
  }
  this.built=builtURI;
}

Fixed version (ground truth):
/** 
 * Sets the URI of the built property to the given one.
 * @param builtURI the given URI to set to
 * @throws SBOLValidationException on SBOL validation rule violation XXXXX.
 */
public void setBuiltURI(URI builtURI) throws SBOLValidationException {
  if (this.getSBOLDocument() != null && this.getSBOLDocument().getComponentDefinition(builtURI) == null && this.getSBOLDocument().getModuleDefinition(builtURI) == null) {
    throw new SBOLValidationException("String_Node_Str",this);
  }
  this.built=builtURI;
}
Program: 12383
Project: 12383
Buggy source:
/** 
 * Adds the given collection to this SBOL document's list of collections.
 * @param collection the collection object to be added
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in {@link #addTopLevel(TopLevel,Map,String,Map)}
 */
void addCollection(Collection collection) throws SBOLValidationException {
  addTopLevel(collection,collections,"String_Node_Str",componentDefinitions,genericTopLevels,activities,plans,agents,models,moduleDefinitions,sequences,combinatorialDerivations);
}

Fixed version (ground truth):
/** 
 * Adds the given collection to this SBOL document's list of collections.
 * @param collection the collection object to be added
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in {@link #addTopLevel(TopLevel,Map,String,Map)}
 */
void addCollection(Collection collection) throws SBOLValidationException {
  addTopLevel(collection,collections,"String_Node_Str",componentDefinitions,genericTopLevels,activities,plans,agents,models,moduleDefinitions,sequences,combinatorialDerivations,implementations);
}
Program: 12384
Project: 12384
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + activities + "String_Node_Str"+ agents+ "String_Node_Str"+ plans+ "String_Node_Str"+ genericTopLevels+ "String_Node_Str"+ collections+ "String_Node_Str"+ componentDefinitions+ "String_Node_Str"+ models+ "String_Node_Str"+ moduleDefinitions+ "String_Node_Str"+ sequences+ "String_Node_Str"+ nameSpaces+ "String_Node_Str"+ defaultURIprefix+ "String_Node_Str"+ complete+ "String_Node_Str"+ compliant+ "String_Node_Str"+ typesInURIs+ "String_Node_Str"+ createDefaults+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + activities + "String_Node_Str"+ agents+ "String_Node_Str"+ plans+ "String_Node_Str"+ implementations+ "String_Node_Str"+ genericTopLevels+ "String_Node_Str"+ collections+ "String_Node_Str"+ componentDefinitions+ "String_Node_Str"+ models+ "String_Node_Str"+ moduleDefinitions+ "String_Node_Str"+ sequences+ "String_Node_Str"+ nameSpaces+ "String_Node_Str"+ defaultURIprefix+ "String_Node_Str"+ complete+ "String_Node_Str"+ compliant+ "String_Node_Str"+ typesInURIs+ "String_Node_Str"+ createDefaults+ "String_Node_Str";
}
Program: 12386
Project: 12386
Buggy source:
private static void formatImplementation(Set<Implementation> implementations,List<TopLevelDocument<QName>> topLevelDoc){
  for (  Implementation implementation : implementations) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonTopLevelData(list,implementation);
    list.add(NamedProperty(Sbol2Terms.Implementation.built,implementation.getBuiltURI()));
    topLevelDoc.add(TopLevelDocument(Sbol2Terms.Implementation.Implementation,implementation.getIdentity(),NamedProperties(list)));
  }
}

Fixed version (ground truth):
private static void formatImplementation(Set<Implementation> implementations,List<TopLevelDocument<QName>> topLevelDoc){
  for (  Implementation implementation : implementations) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonTopLevelData(list,implementation);
    if (implementation.isSetBuilt()) {
      list.add(NamedProperty(Sbol2Terms.Implementation.built,implementation.getBuiltURI()));
    }
    topLevelDoc.add(TopLevelDocument(Sbol2Terms.Implementation.Implementation,implementation.getIdentity(),NamedProperties(list)));
  }
}
Program: 12387
Project: 12387
Buggy source:
/** 
 * Run SBOL 1.1 / SBOL 2.0 conversion test.
 * @throws Exception
 */
@Test public void test_SBOL2_Files() throws Exception {
  if (file.getAbsolutePath().contains("String_Node_Str"))   return;
  if (file.getAbsolutePath().contains("String_Node_Str"))   return;
  try {
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument expected=SBOLReader.read(file);
    ByteArrayOutputStream out=new ByteArrayOutputStream();
    SBOLWriter.write(expected,out);
    SBOLDocument actual=SBOLReader.read(new ByteArrayInputStream(out.toByteArray()));
    if (!actual.equals(expected)) {
      System.out.println(file.getName() + "String_Node_Str");
      throw new AssertionError("String_Node_Str" + file.getName());
    }
 else {
    }
  }
 catch (  SBOLValidationException e) {
    throw new AssertionError("String_Node_Str" + file.getName());
  }
}

Fixed version (ground truth):
/** 
 * Run SBOL 1.1 / SBOL 2.0 conversion test.
 * @throws Exception
 */
@Test public void test_SBOL2_Files() throws Exception {
  if (file.getAbsolutePath().contains("String_Node_Str"))   return;
  try {
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument expected=SBOLReader.read(file);
    ByteArrayOutputStream out=new ByteArrayOutputStream();
    SBOLWriter.write(expected,out);
    SBOLDocument actual=SBOLReader.read(new ByteArrayInputStream(out.toByteArray()));
    if (!actual.equals(expected)) {
      System.out.println(file.getName() + "String_Node_Str");
      throw new AssertionError("String_Node_Str" + file.getName());
    }
 else {
    }
  }
 catch (  SBOLValidationException e) {
    throw new AssertionError("String_Node_Str" + file.getName());
  }
}
Program: 12389
Project: 12389
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (!super.equals(obj))   return false;
  if (getClass() != obj.getClass())   return false;
  Implementation other=(Implementation)obj;
  if (!this.built.equals(other.getBuiltURI()))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (!super.equals(obj))   return false;
  if (getClass() != obj.getClass())   return false;
  Implementation other=(Implementation)obj;
  if (!this.isSetBuilt() || !this.built.equals(other.getBuiltURI()))   return false;
  return true;
}
Program: 12390
Project: 12390
Buggy source:
/** 
 * Check if this top-level object's and all of its descendants' URIs are all compliant. 
 * @throws SBOLValidationException validation error
 */
abstract void checkDescendantsURIcompliance() throws SBOLValidationException ;

Fixed version (ground truth):
/** 
 * Check if this top-level object's and all of its descendants' URIs are all compliant.
 * @throws SBOLValidationException validation error
 */
abstract void checkDescendantsURIcompliance() throws SBOLValidationException ;
Program: 12391
Project: 12391
Buggy source:
/** 
 * Make a copy of a top-level object whose URI and its descendants' URIs (children, grandchildren, etc) are all compliant.  It first makes a deep copy of this object, then updates its own identity URI and all of its descendants' identity URIs according to the given   {@code URIprefix, displayId}, and   {@code version}. This method also updates the   {@code displayId}and   {@code version} fields for each updated object.
 * @return the copied top-level object if this object and all of its descendants have compliant URIs, and {@code null} otherwise.
 */
abstract Identified copy(String URIprefix,String displayId,String version) throws SBOLValidationException ;

Fixed version (ground truth):
/** 
 * Make a copy of a top-level object whose URI and its descendants' URIs (children, grandchildren, etc) are all compliant. It first makes a deep copy of this object, then updates its own identity URI and all of its descendants' identity URIs according to the given   {@code URIprefix, displayId}, and  {@code version}. This method also updates the   {@code displayId} and{@code version} fields for each updated object.
 * @return the copied top-level object if this object and all of its descendantshave compliant URIs, and  {@code null} otherwise.
 */
abstract Identified copy(String URIprefix,String displayId,String version) throws SBOLValidationException ;
Program: 12392
Project: 12392
Buggy source:
/** 
 * Test if the given object's identity URI is compliant.
 * @param objURI
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods:<ul> <li> {@link URIcompliance#isTopLevelURIformCompliant(URI)},</li>  <li>  {@link URIcompliance#isURIcompliant(Identified)}, or</li> <li>  {@link #checkDescendantsURIcompliance()}.</li> </ul>
 */
void isURIcompliant() throws SBOLValidationException {
  try {
    URIcompliance.isURIcompliant(this);
  }
 catch (  SBOLValidationException e) {
    throw new SBOLValidationException(e.getRule(),this);
  }
  this.checkDescendantsURIcompliance();
}

Fixed version (ground truth):
/** 
 * Test if the given object's identity URI is compliant.
 * @param objURI
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods: <ul> <li> {@link URIcompliance#isTopLevelURIformCompliant(URI)},</li> <li>  {@link URIcompliance#isURIcompliant(Identified)}, or</li> <li>  {@link #checkDescendantsURIcompliance()}.</li> </ul>
 */
void isURIcompliant() throws SBOLValidationException {
  try {
    URIcompliance.isURIcompliant(this);
  }
 catch (  SBOLValidationException e) {
    throw new SBOLValidationException(e.getRule(),this);
  }
  this.checkDescendantsURIcompliance();
}
Program: 12393
Project: 12393
Buggy source:
/** 
 * Creates a child variable component for this combinatorial derivation with the given arguments, and then adds to this combinatorial derivation's list of variable components. <p> This method first creates a compliant URI for the child variable component to be created. This URI starts with this combinatorial derivation's persistent identity, followed by the given display ID and ends with this combinatorial derivation's version.
 * @param displayId the display ID for the variable component to be created
 * @param operator the operator property for the variable component to be created
 * @param variable the component referenced by the variable component to be created
 * @return the created variable component
 * @throws SBOLValidationException if any of the following SBOL validation rules was violated:  10201, 10202, 10204, 10206, 13002, 13003, 13004, 13005.
 */
public VariableComponent createVariableComponent(String displayId,OperatorType operator,Component variable) throws SBOLValidationException {
  String URIprefix=this.getPersistentIdentity().toString();
  String version=this.getVersion();
  VariableComponent c=createVariableComponent(createCompliantURI(URIprefix,displayId,version),operator,variable);
  c.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  c.setDisplayId(displayId);
  c.setVersion(version);
  return c;
}

Fixed version (ground truth):
/** 
 * Creates a child variable component for this combinatorial derivation with the given arguments, and then adds to this combinatorial derivation's list of variable components. <p> This method first creates a compliant URI for the child variable component to be created. This URI starts with this combinatorial derivation's persistent identity, followed by the given display ID and ends with this combinatorial derivation's version.
 * @param displayId the display ID for the variable component to be created
 * @param operator the operator property for the variable component to be created
 * @param variableId the component displayId referenced by the variable component to be created
 * @return the created variable component
 * @throws SBOLValidationException if any of the following SBOL validation rules was violated:  10201, 10202, 10204, 10206, 13002, 13003, 13004, 13005.
 */
public VariableComponent createVariableComponent(String displayId,OperatorType operator,String variableId) throws SBOLValidationException {
  URI variableURI=URIcompliance.createCompliantURI(getTemplate().getPersistentIdentity().toString(),variableId,getTemplate().getVersion());
  return createVariableComponent(displayId,operator,variableURI);
}
Program: 12394
Project: 12394
Buggy source:
private static void formatVariableComponents(Set<VariableComponent> variableComponents,List<NamedProperty<QName>> properties){
  for (  VariableComponent variableComponent : variableComponents) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonIdentifiedData(list,variableComponent);
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariable,variableComponent.getVariable().getIdentity()));
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasOperator,OperatorType.convertToURI(variableComponent.getOperator())));
    for (    URI variant : variableComponent.getVariantURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariants,variant));
    }
    for (    URI variantCollection : variableComponent.getVariantCollectionURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantCollections,variantCollection));
    }
    for (    URI variantDerivation : variableComponent.getVariantDerivationURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantDerivations,variantDerivation));
    }
    properties.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.hasVariableComponent,NestedDocument(Sbol2Terms.VariableComponent.VariableComponent,variableComponent.getIdentity(),NamedProperties(list))));
  }
}

Fixed version (ground truth):
private static void formatVariableComponents(Set<VariableComponent> variableComponents,List<NamedProperty<QName>> properties){
  for (  VariableComponent variableComponent : variableComponents) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonIdentifiedData(list,variableComponent);
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariable,variableComponent.getVariableURI()));
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasOperator,OperatorType.convertToURI(variableComponent.getOperator())));
    for (    URI variant : variableComponent.getVariantURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariants,variant));
    }
    for (    URI variantCollection : variableComponent.getVariantCollectionURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantCollections,variantCollection));
    }
    for (    URI variantDerivation : variableComponent.getVariantDerivationURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantDerivations,variantDerivation));
    }
    properties.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.hasVariableComponent,NestedDocument(Sbol2Terms.VariableComponent.VariableComponent,variableComponent.getIdentity(),NamedProperties(list))));
  }
}
Program: 12395
Project: 12395
Buggy source:
/** 
 * Returns the instance matching the given variable component's variable.
 * @return the matching component if present, or {@code null} otherwise.
 */
public Component getVariable(){
  if (combinatorialDerivation == null)   return null;
  return combinatorialDerivation.getTemplate().getComponent(variable);
}

Fixed version (ground truth):
/** 
 * Returns the instance matching the given variable component's variable.
 * @return the matching component if present, or {@code null} otherwise.
 */
public Component getVariable(){
  if (combinatorialDerivation == null)   return null;
  if (combinatorialDerivation.getTemplate() == null)   return null;
  return combinatorialDerivation.getTemplate().getComponent(variable);
}
Program: 12396
Project: 12396
Buggy source:
public static void main(String[] args){
  try {
    System.out.println(SynBioHubFrontend.getRegistries());
  }
 catch (  SynBioHubException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws SBOLValidationException, IOException, SBOLConversionException {
  SBOLDocument doc=SBOLReader.read("String_Node_Str");
  doc=doc.createRecursiveCopy(doc.getTopLevel(URI.create("String_Node_Str")));
  doc.write(System.out);
}
Program: 12398
Project: 12398
Buggy source:
/** 
 * Copy all objects to an a new SBOL Document and change the URI prefix/version of each object
 * @param URIPrefix new URI prefix
 * @param version new version
 * @return new SBOL document with changed URI prefix
 * @throws SBOLValidationException if URIprefix or version provided is invalid
 */
public SBOLDocument changeURIPrefixVersion(String URIPrefix,String version) throws SBOLValidationException {
  SBOLDocument document=new SBOLDocument();
  SBOLDocument fixed=new SBOLDocument();
  fixed.setDefaultURIprefix(URIPrefix);
  this.fixDocumentURIPrefix();
  fixed.createCopy(this);
  String documentURIPrefix=fixed.extractDocumentURIPrefix();
  HashMap<URI,URI> uriMap=new HashMap<URI,URI>();
  for (  TopLevel topLevel : fixed.getTopLevels()) {
    fixed.rename(topLevel,URIPrefix,null,version);
    TopLevel newTL=document.createCopy(topLevel,URIPrefix,null,version);
    uriMap.put(topLevel.getIdentity(),newTL.getIdentity());
    uriMap.put(topLevel.getPersistentIdentity(),newTL.getPersistentIdentity());
  }
  document.updateReferences(uriMap);
  for (  TopLevel topLevel : document.getTopLevels()) {
    document.changeURIPrefixVersion(topLevel,URIPrefix,version,documentURIPrefix);
  }
  document.setDefaultURIprefix(URIPrefix);
  return document;
}

Fixed version (ground truth):
/** 
 * Copy all objects to an a new SBOL Document and change the URI prefix/version of each object
 * @param URIPrefix new URI prefix
 * @param version new version
 * @return new SBOL document with changed URI prefix
 * @throws SBOLValidationException if URIprefix or version provided is invalid
 */
public SBOLDocument changeURIPrefixVersion(String URIPrefix,String version) throws SBOLValidationException {
  SBOLDocument document=new SBOLDocument();
  SBOLDocument fixed=new SBOLDocument();
  fixed.setDefaultURIprefix(URIPrefix);
  this.fixDocumentURIPrefix();
  fixed.createCopy(this);
  String documentURIPrefix=fixed.extractDocumentURIPrefix();
  HashMap<URI,URI> uriMap=new HashMap<URI,URI>();
  for (  TopLevel topLevel : fixed.getTopLevels()) {
    fixed.rename(topLevel,URIPrefix,null,version);
    TopLevel newTL=document.createCopy(topLevel,URIPrefix,null,version);
    uriMap.put(topLevel.getIdentity(),newTL.getIdentity());
    if (!topLevel.getIdentity().equals(topLevel.getPersistentIdentity())) {
      uriMap.put(topLevel.getPersistentIdentity(),newTL.getPersistentIdentity());
    }
  }
  document.updateReferences(uriMap);
  for (  TopLevel topLevel : document.getTopLevels()) {
    document.changeURIPrefixVersion(topLevel,URIPrefix,version,documentURIPrefix);
  }
  document.setDefaultURIprefix(URIPrefix);
  return document;
}
Program: 12400
Project: 12400
Buggy source:
/** 
 * Sets the template property to the given one.
 * @param template the given template URI to set to
 * @throws SBOLValidationException if either of the following SBOL validation rules was violated: TODO: 10602, 10604.
 */
public void setTemplate(URI template) throws SBOLValidationException {
  this.template=template;
  if (template == null) {
    throw new SBOLValidationException("String_Node_Str",this);
  }
  if (this.getSBOLDocument() != null && this.getSBOLDocument().isComplete()) {
    if (this.getSBOLDocument().getComponentDefinition(template) == null) {
      throw new SBOLValidationException("String_Node_Str",this);
    }
  }
  this.template=template;
}

Fixed version (ground truth):
/** 
 * Sets the template property to the given one.
 * @param template the given template URI to set to
 * @throws SBOLValidationException if either of the following SBOL validation rules was violated: TODO: 10602, 10604.
 */
public void setTemplate(URI template) throws SBOLValidationException {
  if (template == null) {
    throw new SBOLValidationException("String_Node_Str",this);
  }
  if (this.getSBOLDocument() != null && this.getSBOLDocument().isComplete()) {
    if (this.getSBOLDocument().getComponentDefinition(template) == null) {
      throw new SBOLValidationException("String_Node_Str",this);
    }
  }
  this.template=template;
}
Program: 12401
Project: 12401
Buggy source:
/** 
 * Returns the top-level matching the given identity URI from this SBOL document's lists of top-levels.
 * @param topLevelURI the identity URI of the top-level to be retrieved
 * @return the matching top-level if present, or {@code null} otherwise.
 */
public TopLevel getTopLevel(URI topLevelURI){
  TopLevel topLevel=getTopLevelLocalOnly(topLevelURI);
  if (topLevel == null) {
    for (    SynBioHubFrontend frontend : getRegistries()) {
      try {
        SBOLDocument document=frontend.getSBOL(topLevelURI);
        if (document != null) {
          topLevel=document.getTopLevel(topLevelURI);
          createCopy(document);
        }
      }
 catch (      SynBioHubException|SBOLValidationException e) {
        topLevel=null;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the top-level matching the given identity URI from this SBOL document's lists of top-levels.
 * @param topLevelURI the identity URI of the top-level to be retrieved
 * @return the matching top-level if present, or {@code null} otherwise.
 */
public TopLevel getTopLevel(URI topLevelURI){
  TopLevel topLevel=getTopLevelLocalOnly(topLevelURI);
  if (topLevel == null) {
    for (    SynBioHubFrontend frontend : getRegistries()) {
      try {
        SBOLDocument document=frontend.getSBOL(topLevelURI);
        if (document != null) {
          topLevel=document.getTopLevel(topLevelURI);
          createCopy(document);
        }
      }
 catch (      SynBioHubException|SBOLValidationException e) {
        topLevel=null;
      }
    }
  }
  return topLevel;
}
Program: 12402
Project: 12402
Buggy source:
private static void formatCombinatorialDerivation(Set<CombinatorialDerivation> combinatorialDerivations,List<TopLevelDocument<QName>> topLevelDoc){
  for (  CombinatorialDerivation combinatorialDerivation : combinatorialDerivations) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonTopLevelData(list,combinatorialDerivation);
    list.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.template,combinatorialDerivation.getTemplateURI()));
    list.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.strategy,StrategyType.convertToURI(combinatorialDerivation.getStrategy())));
    formatVariableComponents(combinatorialDerivation.getVariableComponents(),list);
    topLevelDoc.add(TopLevelDocument(Sbol2Terms.CombinatorialDerivation.CombinatorialDerivation,combinatorialDerivation.getIdentity(),NamedProperties(list)));
  }
}

Fixed version (ground truth):
private static void formatCombinatorialDerivation(Set<CombinatorialDerivation> combinatorialDerivations,List<TopLevelDocument<QName>> topLevelDoc){
  for (  CombinatorialDerivation combinatorialDerivation : combinatorialDerivations) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonTopLevelData(list,combinatorialDerivation);
    list.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.template,combinatorialDerivation.getTemplateURI()));
    if (combinatorialDerivation.isSetStrategy()) {
      list.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.strategy,StrategyType.convertToURI(combinatorialDerivation.getStrategy())));
    }
    formatVariableComponents(combinatorialDerivation.getVariableComponents(),list);
    topLevelDoc.add(TopLevelDocument(Sbol2Terms.CombinatorialDerivation.CombinatorialDerivation,combinatorialDerivation.getIdentity(),NamedProperties(list)));
  }
}
Program: 12403
Project: 12403
Buggy source:
public static void main(String[] args){
  try {
    SynBioHubFrontend sbh=new SynBioHubFrontend("String_Node_Str","String_Node_Str");
    sbh.login("String_Node_Str","String_Node_Str");
    ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
    String filename=sbh.getAttachment(URI.create("String_Node_Str"),outputStream);
    File file=new File("String_Node_Str" + filename);
    FileOutputStream fileOutputStream=new FileOutputStream(file);
    fileOutputStream.write(outputStream.toByteArray());
    fileOutputStream.close();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    SBOLDocument doc=new SBOLDocument();
    doc.setDefaultURIprefix("String_Node_Str");
    ComponentDefinition cd=doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    ComponentDefinition variant=doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    ComponentDefinition variant2=doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    Component comp=cd.createComponent("String_Node_Str",AccessType.PUBLIC,"String_Node_Str");
    Component comp2=cd.createComponent("String_Node_Str",AccessType.PUBLIC,"String_Node_Str");
    CombinatorialDerivation combDeriv=doc.createCombinatorialDerivation("String_Node_Str",cd.getIdentity());
    VariableComponent vc=combDeriv.createVariableComponent("String_Node_Str",OperatorType.ONE,comp);
    vc.addVariant(variant.getIdentity());
    VariableComponent vc2=combDeriv.createVariableComponent("String_Node_Str",OperatorType.ONE,comp2);
    vc2.addVariant(variant2.getIdentity());
    SBOLDocument doc2=doc.createRecursiveCopy(combDeriv);
    doc2.write(System.out);
    SBOLValidate.compareDocuments("String_Node_Str",doc,"String_Node_Str",doc2);
    if (SBOLValidate.getNumErrors() > 0) {
      for (      String error : SBOLValidate.getErrors()) {
        System.out.println(error);
      }
    }
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12404
Project: 12404
Buggy source:
/** 
 * Adds the given variant collection to the list of variant collections.
 * @param uriPrefix TODO: change variable name
 * @param displayId
 * @param version
 * @throws SBOLValidationException 
 */
public void addVariantCollection(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  Collection collection=this.getSBOLDocument().getCollection(uri);
  variantCollections.add(collection.getIdentity());
}

Fixed version (ground truth):
/** 
 * Adds the given variant collection to the list of variant collections.
 * @param uriPrefix URI prefix for variant collection
 * @param displayId display id for variant collection
 * @param version version for variant collection
 * @throws SBOLValidationException if the following SBOL validation rule was violated: 
 */
public void addVariantCollection(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  Collection collection=this.getSBOLDocument().getCollection(uri);
  variantCollections.add(collection.getIdentity());
}
Program: 12405
Project: 12405
Buggy source:
/** 
 * Adds the given variant derivation to the list of variant derivations.
 * @param uriPrefix TODO: change variable name
 * @param displayId
 * @param version
 * @throws SBOLValidationException 
 */
public void addVariantDerivation(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  CombinatorialDerivation combinatorialDerivation=this.getSBOLDocument().getCombinatorialDerivation(uri);
  variants.add(combinatorialDerivation.getIdentity());
}

Fixed version (ground truth):
/** 
 * Adds the given variant derivation to the list of variant derivations.
 * @param uriPrefix URI prefix for variant derivation
 * @param displayId display id for variant derivation 
 * @param version version for variant derivation
 * @throws SBOLValidationException if the following SBOL validation rule was violated: 
 */
public void addVariantDerivation(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  CombinatorialDerivation combinatorialDerivation=this.getSBOLDocument().getCombinatorialDerivation(uri);
  variants.add(combinatorialDerivation.getIdentity());
}
Program: 12406
Project: 12406
Buggy source:
/** 
 * Adds the given variant to the list of variants.
 * @param uriPrefix TODO: change variable name
 * @param displayId display id for variant
 * @param version version for variant
 * @throws SBOLValidationException 
 */
public void addVariant(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  ComponentDefinition componentDefinition=this.getSBOLDocument().getComponentDefinition(uri);
  variants.add(componentDefinition.getIdentity());
}

Fixed version (ground truth):
/** 
 * Adds the given variant to the list of variants.
 * @param uriPrefix URI prefix for variant
 * @param displayId display id for variant
 * @param version version for variant
 * @throws SBOLValidationException if the following SBOL validation rule was violated:
 */
public void addVariant(String uriPrefix,String displayId,String version) throws SBOLValidationException {
  URI uri=URIcompliance.createCompliantURI(uriPrefix,displayId,version);
  ComponentDefinition componentDefinition=this.getSBOLDocument().getComponentDefinition(uri);
  variants.add(componentDefinition.getIdentity());
}
Program: 12407
Project: 12407
Buggy source:
public static void main(String[] args){
  try {
    SBOLDocument doc=new SBOLDocument();
    doc.setDefaultURIprefix("String_Node_Str");
    ComponentDefinition cd=doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    ComponentDefinition variant=doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    doc.createComponentDefinition("String_Node_Str",ComponentDefinition.DNA);
    Component comp=cd.createComponent("String_Node_Str",AccessType.PUBLIC,"String_Node_Str");
    CombinatorialDerivation combDeriv=doc.createCombinatorialDerivation("String_Node_Str",cd.getIdentity());
    VariableComponent vc=combDeriv.createVariableComponent("String_Node_Str",OperatorType.ONE,comp);
    vc.addVariant(variant.getIdentity());
    doc.write("String_Node_Str");
    SBOLDocument doc2=SBOLReader.read("String_Node_Str");
    SBOLValidate.compareDocuments("String_Node_Str",doc,"String_Node_Str",doc2);
    if (SBOLValidate.getNumErrors() > 0) {
      for (      String error : SBOLValidate.getErrors()) {
        System.out.println(error);
      }
    }
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    SynBioHubFrontend sbh=new SynBioHubFrontend("String_Node_Str","String_Node_Str");
    sbh.login("String_Node_Str","String_Node_Str");
    ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
    String filename=sbh.getAttachment(URI.create("String_Node_Str"),outputStream);
    File file=new File("String_Node_Str" + filename);
    FileOutputStream fileOutputStream=new FileOutputStream(file);
    fileOutputStream.write(outputStream.toByteArray());
    fileOutputStream.close();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12408
Project: 12408
Buggy source:
private static void formatVariableComponents(Set<VariableComponent> variableComponents,List<NamedProperty<QName>> properties){
  for (  VariableComponent variableComponent : variableComponents) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonIdentifiedData(list,variableComponent);
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariable,variableComponent.getVariable()));
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasOperator,OperatorType.convertToURI(variableComponent.getOperator())));
    for (    URI variant : variableComponent.getVariants()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariants,variant));
    }
    for (    URI variantCollection : variableComponent.getVariantCollections()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantCollections,variantCollection));
    }
    for (    URI variantDerivation : variableComponent.getVariantDerivations()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantDerivations,variantDerivation));
    }
    properties.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.hasVariableComponent,NestedDocument(Sbol2Terms.VariableComponent.VariableComponent,variableComponent.getIdentity(),NamedProperties(list))));
  }
}

Fixed version (ground truth):
private static void formatVariableComponents(Set<VariableComponent> variableComponents,List<NamedProperty<QName>> properties){
  for (  VariableComponent variableComponent : variableComponents) {
    List<NamedProperty<QName>> list=new ArrayList<>();
    formatCommonIdentifiedData(list,variableComponent);
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariable,variableComponent.getVariable().getIdentity()));
    list.add(NamedProperty(Sbol2Terms.VariableComponent.hasOperator,OperatorType.convertToURI(variableComponent.getOperator())));
    for (    URI variant : variableComponent.getVariantURIs()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariants,variant));
    }
    for (    URI variantCollection : variableComponent.getVariantCollections()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantCollections,variantCollection));
    }
    for (    URI variantDerivation : variableComponent.getVariantDerivations()) {
      list.add(NamedProperty(Sbol2Terms.VariableComponent.hasVariantDerivations,variantDerivation));
    }
    properties.add(NamedProperty(Sbol2Terms.CombinatorialDerivation.hasVariableComponent,NestedDocument(Sbol2Terms.VariableComponent.VariableComponent,variableComponent.getIdentity(),NamedProperties(list))));
  }
}
Program: 12411
Project: 12411
Buggy source:
/** 
 * @param variableComponents
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods: <ul> <li> {@link #clearVariableComponents()}</li> <li>  {@link #addVariableComponentNoCheck(VariableComponent)}, or</li> <li>  {@link #checkMapsTosLocalURIs()}.</li> </ul>
 */
public void setVariableComponents(Set<VariableComponent> variableComponents){
  this.variableComponents.clear();
  for (  VariableComponent variableComponent : variableComponents) {
    this.variableComponents.put(variableComponent.getIdentity(),variableComponent);
  }
}

Fixed version (ground truth):
/** 
 * @param variableComponents
 */
public void setVariableComponents(Set<VariableComponent> variableComponents){
  this.variableComponents.clear();
  for (  VariableComponent variableComponent : variableComponents) {
    this.variableComponents.put(variableComponent.getIdentity(),variableComponent);
  }
}
Program: 12412
Project: 12412
Buggy source:
/** 
 * @throws SBOLValidationException an SBOL validation rule violation occurred in either of the following methods: <ul> <li> {@link URIcompliance#isTopLevelURIformCompliant(URI)}, or</li> <li>  {@link URIcompliance#isChildURIcompliant(Identified,Identified)}.</li> </ul>
 */
@Override public void checkDescendantsURIcompliance() throws SBOLValidationException {
  if (!variableComponents.isEmpty()) {
    for (    VariableComponent variableComponent : variableComponents.values()) {
      try {
        isChildURIcompliant(this,variableComponent);
      }
 catch (      SBOLValidationException e) {
        throw new SBOLValidationException(e.getRule(),variableComponent);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @throws SBOLValidationException an SBOL validation rule violation occurred in either of the following methods: <ul> <li> {@link URIcompliance#isChildURIcompliant(Identified,Identified)}.</li> </ul>
 */
@Override public void checkDescendantsURIcompliance() throws SBOLValidationException {
  if (!variableComponents.isEmpty()) {
    for (    VariableComponent variableComponent : variableComponents.values()) {
      try {
        isChildURIcompliant(this,variableComponent);
      }
 catch (      SBOLValidationException e) {
        throw new SBOLValidationException(e.getRule(),variableComponent);
      }
    }
  }
}
Program: 12415
Project: 12415
Buggy source:
/** 
 * Adds the given variable component to the list of variable components.
 * @param variableComponent
 */
private void addVariableComponent(VariableComponent variableComponent){
  variableComponent.setSBOLDocument(this.getSBOLDocument());
  variableComponent.setCombinatorialDerivation(this);
  for (  CombinatorialDerivation cd : variableComponent.getVariants()) {
    Set<URI> visited=new HashSet<>();
    visited.add(this.getIdentity());
    try {
    }
 catch (    SBOLValidationException e) {
      throw new SBOLValidationException("String_Node_Str",variableComponent);
    }
  }
  addChildSafely(variableComponent,variableComponents,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds the given variable component to the list of variable components.
 * @param variableComponent
 */
private void addVariableComponent(VariableComponent variableComponent) throws SBOLValidationException {
  variableComponent.setSBOLDocument(this.getSBOLDocument());
  variableComponent.setCombinatorialDerivation(this);
  for (  CombinatorialDerivation cd : variableComponent.getVariants()) {
    Set<URI> visited=new HashSet<>();
    visited.add(this.getIdentity());
    try {
      SBOLValidate.checkCombinatorialDerivationCycle(this.getSBOLDocument(),cd,visited);
    }
 catch (    SBOLValidationException e) {
      throw new SBOLValidationException("String_Node_Str",variableComponent);
    }
  }
  addChildSafely(variableComponent,variableComponents,"String_Node_Str");
}
Program: 12416
Project: 12416
Buggy source:
public void setCombinatorialDerivation(CombinatorialDerivation combinatorialDerivation){
  this.CombinatorialDerivation=combinatorialDerivation;
}

Fixed version (ground truth):
public void setCombinatorialDerivation(CombinatorialDerivation combinatorialDerivation){
  this.combinatorialDerivation=combinatorialDerivation;
}
Program: 12417
Project: 12417
Buggy source:
/** 
 * @param componentDefinition
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following constructors or methods: <ul> <li> {@link TopLevel#TopLevel(TopLevel)},</li> <li>  {@link #addVariableComponent(VariableComponent)},</li> <li>  {@link VariableComponent#deepCopy()}</li> </ul>
 */
private CombinatorialDerivation(CombinatorialDerivation combinatorialDerivation) throws SBOLValidationException {
  super(combinatorialDerivation);
  this.variableComponents=new HashMap<>();
  for (  VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
    this.addVariableComponent(variableComponent.deepCopy());
  }
}

Fixed version (ground truth):
/** 
 * @param combinatorialDerivation
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following constructors or methods: <ul> <li> {@link TopLevel#TopLevel(TopLevel)},</li> <li>  {@link #addVariableComponent(VariableComponent)},</li> <li>  {@link VariableComponent#deepCopy()}</li> </ul>
 */
private CombinatorialDerivation(CombinatorialDerivation combinatorialDerivation) throws SBOLValidationException {
  super(combinatorialDerivation);
  this.variableComponents=new HashMap<>();
  for (  VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
    this.addVariableComponent(variableComponent.deepCopy());
  }
}
Program: 12418
Project: 12418
Buggy source:
/** 
 * Adds the given variable component to the list of variable components.
 * @param variableComponent
 */
private void addVariableComponent(VariableComponent variableComponent) throws SBOLValidationException {
  variableComponent.setSBOLDocument(this.getSBOLDocument());
  variableComponent.setCombinatorialDerivation(this);
  for (  CombinatorialDerivation cd : variableComponent.getVariants()) {
    Set<URI> visited=new HashSet<>();
    visited.add(this.getIdentity());
    try {
      SBOLValidate.checkCombinatorialDerivationCycle(this.getSBOLDocument(),cd,visited);
    }
 catch (    SBOLValidationException e) {
      throw new SBOLValidationException("String_Node_Str",variableComponent);
    }
  }
  addChildSafely(variableComponent,variableComponents,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds the given variable component to the list of variable components.
 * @param variableComponent
 */
private void addVariableComponent(VariableComponent variableComponent) throws SBOLValidationException {
  variableComponent.setSBOLDocument(this.getSBOLDocument());
  variableComponent.setCombinatorialDerivation(this);
  for (  URI cdURI : variableComponent.getVariantDerivationURIs()) {
    CombinatorialDerivation cd=this.getSBOLDocument().getCombinatorialDerivation(cdURI);
    Set<URI> visited=new HashSet<>();
    visited.add(this.getIdentity());
    try {
      SBOLValidate.checkCombinatorialDerivationCycle(this.getSBOLDocument(),cd,visited);
    }
 catch (    SBOLValidationException e) {
      throw new SBOLValidationException("String_Node_Str",variableComponent);
    }
  }
  addChildSafely(variableComponent,variableComponents,"String_Node_Str");
}