nus-yam/ex-repair huggingface dataset:
Program: 12695
Project: 12695
Buggy source:
@Override Collection copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Collection cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override Collection copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Collection cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12696
Project: 12696
Buggy source:
ComponentDefinition copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    ComponentDefinition cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    if (!cloned.getSequenceConstraints().isEmpty()) {
      for (      SequenceConstraint sequenceConstraint : cloned.getSequenceConstraints()) {
        sequenceConstraint.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getSequenceAnnotations().isEmpty()) {
      for (      SequenceAnnotation SequenceAnnotation : cloned.getSequenceAnnotations()) {
        SequenceAnnotation.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getComponents().isEmpty()) {
      for (      Component component : cloned.getComponents()) {
        component.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
ComponentDefinition copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    ComponentDefinition cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    if (!cloned.getSequenceConstraints().isEmpty()) {
      for (      SequenceConstraint sequenceConstraint : cloned.getSequenceConstraints()) {
        sequenceConstraint.updateCompliantURI(cloned.getPersistentIdentity().toString(),sequenceConstraint.getDisplayId(),version);
      }
    }
    if (!cloned.getSequenceAnnotations().isEmpty()) {
      for (      SequenceAnnotation SequenceAnnotation : cloned.getSequenceAnnotations()) {
        SequenceAnnotation.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getComponents().isEmpty()) {
      for (      Component component : cloned.getComponents()) {
        component.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12698
Project: 12698
Buggy source:
protected ComponentInstance(ComponentInstance component){
  super(component);
  setAccess(component.getAccess());
  setDefinition(component.getDefinitionURI());
  if (!component.getMapsTos().isEmpty()) {
    List<MapsTo> mapsTos=new ArrayList<>();
    for (    MapsTo mapsTo : component.getMapsTos()) {
      mapsTos.add(mapsTo.deepCopy());
    }
    this.setMapsTo(mapsTos);
  }
}

Fixed version (ground truth):
protected ComponentInstance(ComponentInstance component){
  super(component);
  this.mapsTos=new HashMap<>();
  setAccess(component.getAccess());
  setDefinition(component.getDefinitionURI());
  if (!component.getMapsTos().isEmpty()) {
    List<MapsTo> mapsTos=new ArrayList<>();
    for (    MapsTo mapsTo : component.getMapsTos()) {
      mapsTos.add(mapsTo.deepCopy());
    }
    this.setMapsTo(mapsTos);
  }
}
Program: 12699
Project: 12699
Buggy source:
@Override GenericTopLevel copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    GenericTopLevel cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override GenericTopLevel copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    GenericTopLevel cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12700
Project: 12700
Buggy source:
/** 
 * This copy constructor creates a new   {@link Identified} class and copies all fields specified by the <code>identified</code> object.
 */
protected Identified(Identified identified){
  this.setIdentity(identified.getIdentity());
  if (identified.hasAnnotations()) {
    List<Annotation> clonedAnnotations=new ArrayList<>();
    for (    Annotation annotation : identified.getAnnotations()) {
      clonedAnnotations.add(annotation.copy());
    }
    this.setAnnotations(clonedAnnotations);
  }
  if (identified.isSetVersion()) {
    this.setVersion(identified.getVersion());
  }
  if (identified.isSetPersistentIdentity()) {
    this.setPersistentIdentity(URI.create(identified.getPersistentIdentity().toString()));
  }
  if (identified.isSetWasDerivedFrom()) {
    this.setWasDerivedFrom(URI.create(identified.getWasDerivedFrom().toString()));
  }
  if (identified.isSetName()) {
    this.setName(identified.getName());
  }
  if (identified.isSetDescription()) {
    this.setDescription(identified.getDescription());
  }
}

Fixed version (ground truth):
/** 
 * This copy constructor creates a new   {@link Identified} class and copies all fields specified by the <code>identified</code> object.
 */
protected Identified(Identified identified){
  this.setIdentity(identified.getIdentity());
  this.annotations=new ArrayList<>();
  if (identified.hasAnnotations()) {
    List<Annotation> clonedAnnotations=new ArrayList<>();
    for (    Annotation annotation : identified.getAnnotations()) {
      clonedAnnotations.add(annotation.copy());
    }
    this.setAnnotations(clonedAnnotations);
  }
  if (identified.isSetVersion()) {
    this.setVersion(identified.getVersion());
  }
  if (identified.isSetPersistentIdentity()) {
    this.setPersistentIdentity(URI.create(identified.getPersistentIdentity().toString()));
  }
  if (identified.isSetWasDerivedFrom()) {
    this.setWasDerivedFrom(URI.create(identified.getWasDerivedFrom().toString()));
  }
  if (identified.isSetName()) {
    this.setName(identified.getName());
  }
  if (identified.isSetDescription()) {
    this.setDescription(identified.getDescription());
  }
}
Program: 12701
Project: 12701
Buggy source:
Interaction(Interaction interaction){
  super(interaction);
  Set<URI> type=new HashSet<>();
  for (  URI typeElement : interaction.getTypes()) {
    type.add(URI.create(typeElement.toString()));
  }
  this.setTypes(type);
  List<Participation> participations=new ArrayList<>();
  for (  Participation participation : interaction.getParticipations()) {
    participations.add(participation.deepCopy());
  }
  this.setParticipations(participations);
}

Fixed version (ground truth):
Interaction(Interaction interaction){
  super(interaction);
  this.types=new HashSet<>();
  this.participations=new HashMap<>();
  Set<URI> type=new HashSet<>();
  for (  URI typeElement : interaction.getTypes()) {
    type.add(URI.create(typeElement.toString()));
  }
  this.setTypes(type);
  List<Participation> participations=new ArrayList<>();
  for (  Participation participation : interaction.getParticipations()) {
    participations.add(participation.deepCopy());
  }
  this.setParticipations(participations);
}
Program: 12702
Project: 12702
Buggy source:
@Override Model copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Model cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override Model copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Model cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12703
Project: 12703
Buggy source:
/** 
 * Check if the specified key exists in any hash maps in this class other than the one with the specified keySet. This method constructs a set of key sets for other hash maps first, and then checks if the key exists.
 * @return <code>true</code> if the specified key exists in other hash maps.
 */
@Override ModuleDefinition copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    ModuleDefinition cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    if (!cloned.getModules().isEmpty()) {
      for (      Module module : cloned.getModules()) {
        module.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getInteractions().isEmpty()) {
      for (      Interaction SequenceAnnotation : cloned.getInteractions()) {
        SequenceAnnotation.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getFunctionalComponents().isEmpty()) {
      for (      FunctionalComponent component : cloned.getFunctionalComponents()) {
        component.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Check if the specified key exists in any hash maps in this class other than the one with the specified keySet. This method constructs a set of key sets for other hash maps first, and then checks if the key exists.
 * @return <code>true</code> if the specified key exists in other hash maps.
 */
@Override ModuleDefinition copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    ModuleDefinition cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    if (!cloned.getModules().isEmpty()) {
      for (      Module module : cloned.getModules()) {
        module.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getInteractions().isEmpty()) {
      for (      Interaction SequenceAnnotation : cloned.getInteractions()) {
        SequenceAnnotation.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    if (!cloned.getFunctionalComponents().isEmpty()) {
      for (      FunctionalComponent component : cloned.getFunctionalComponents()) {
        component.updateCompliantURI(URIprefix,displayId,version);
      }
    }
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12704
Project: 12704
Buggy source:
private ModuleDefinition(ModuleDefinition moduleDefinition){
  super(moduleDefinition);
  Set<URI> roles=new HashSet<>();
  for (  URI role : moduleDefinition.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  if (!moduleDefinition.getModules().isEmpty()) {
    List<Module> subModules=new ArrayList<>();
    for (    Module subModule : moduleDefinition.getModules()) {
      subModules.add(subModule.deepCopy());
    }
    this.setModules(subModules);
  }
  if (!moduleDefinition.getInteractions().isEmpty()) {
    List<Interaction> interactions=new ArrayList<>();
    for (    Interaction interaction : moduleDefinition.getInteractions()) {
      interactions.add(interaction.deepCopy());
    }
    this.setInteractions(interactions);
  }
  if (!moduleDefinition.getFunctionalComponents().isEmpty()) {
    List<FunctionalComponent> components=new ArrayList<>();
    for (    FunctionalComponent component : moduleDefinition.getFunctionalComponents()) {
      components.add(component.deepCopy());
    }
    this.setFunctionalComponents(components);
  }
  if (!moduleDefinition.getModels().isEmpty()) {
    Set<URI> models=new HashSet<>();
    for (    URI model : moduleDefinition.getModelURIs()) {
      models.add(model);
    }
    this.setModels(models);
  }
}

Fixed version (ground truth):
private ModuleDefinition(ModuleDefinition moduleDefinition){
  super(moduleDefinition);
  this.roles=new HashSet<>();
  this.modules=new HashMap<>();
  this.interactions=new HashMap<>();
  this.functionalComponents=new HashMap<>();
  this.models=new HashSet<>();
  for (  URI role : moduleDefinition.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  if (!moduleDefinition.getModules().isEmpty()) {
    List<Module> subModules=new ArrayList<>();
    for (    Module subModule : moduleDefinition.getModules()) {
      subModules.add(subModule.deepCopy());
    }
    this.setModules(subModules);
  }
  if (!moduleDefinition.getInteractions().isEmpty()) {
    List<Interaction> interactions=new ArrayList<>();
    for (    Interaction interaction : moduleDefinition.getInteractions()) {
      interactions.add(interaction.deepCopy());
    }
    this.setInteractions(interactions);
  }
  if (!moduleDefinition.getFunctionalComponents().isEmpty()) {
    List<FunctionalComponent> components=new ArrayList<>();
    for (    FunctionalComponent component : moduleDefinition.getFunctionalComponents()) {
      components.add(component.deepCopy());
    }
    this.setFunctionalComponents(components);
  }
  if (!moduleDefinition.getModels().isEmpty()) {
    Set<URI> models=new HashSet<>();
    for (    URI model : moduleDefinition.getModelURIs()) {
      models.add(model);
    }
    this.setModels(models);
  }
}
Program: 12705
Project: 12705
Buggy source:
private Participation(Participation participation){
  super(participation);
  Set<URI> roles=new HashSet<>();
  for (  URI role : participation.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  this.setParticipant(participation.getParticipantURI());
}

Fixed version (ground truth):
private Participation(Participation participation){
  super(participation);
  roles=new HashSet<>();
  for (  URI role : participation.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  this.setParticipant(participation.getParticipantURI());
}
Program: 12706
Project: 12706
Buggy source:
/** 
 * Assume this Range object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link MultiRange#updateCompliantURI(String,String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String greatGrandparentDisplayId,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + greatGrandparentDisplayId+ '/'+ grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Range object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12708
Project: 12708
Buggy source:
@Override protected Sequence copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Sequence cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(URI.create(URIprefix + '/' + displayId));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=URI.create(URIprefix + '/' + displayId+ '/'+ version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override protected Sequence copy(String URIprefix,String displayId,String version){
  if (this.checkDescendantsURIcompliance() && isURIprefixCompliant(URIprefix) && isDisplayIdCompliant(displayId)&& isVersionCompliant(version)) {
    Sequence cloned=this.deepCopy();
    cloned.setWasDerivedFrom(this.getIdentity());
    cloned.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
    cloned.setDisplayId(displayId);
    cloned.setVersion(version);
    URI newIdentity=createCompliantURI(URIprefix,displayId,version);
    cloned.setIdentity(newIdentity);
    return cloned;
  }
 else {
    return null;
  }
}
Program: 12709
Project: 12709
Buggy source:
private SequenceAnnotation(SequenceAnnotation sequenceAnnotation){
  super(sequenceAnnotation.getIdentity());
  if (!sequenceAnnotation.getLocations().isEmpty()) {
    List<Location> locations=new ArrayList<>();
    for (    Location location : sequenceAnnotation.getLocations()) {
      locations.add(location.deepCopy());
    }
    this.setLocations(locations);
  }
  if (sequenceAnnotation.isSetComponent()) {
    this.setComponent(sequenceAnnotation.getComponentURI());
  }
}

Fixed version (ground truth):
private SequenceAnnotation(SequenceAnnotation sequenceAnnotation){
  super(sequenceAnnotation.getIdentity());
  this.locations=new HashMap<>();
  if (!sequenceAnnotation.getLocations().isEmpty()) {
    List<Location> locations=new ArrayList<>();
    for (    Location location : sequenceAnnotation.getLocations()) {
      locations.add(location.deepCopy());
    }
    this.setLocations(locations);
  }
  if (sequenceAnnotation.isSetComponent()) {
    this.setComponent(sequenceAnnotation.getComponentURI());
  }
}
Program: 12710
Project: 12710
Buggy source:
/** 
 * Assume this SequenceConstraint object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this SequenceConstraint object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  URI newIdentity=createCompliantURI(URIprefix,displayId,version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12711
Project: 12711
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
    String localId=extractDisplayId(mapsTo.getLocalURI());
    mapsTo.setLocal(createCompliantURI(URIprefix,localId,version));
  }
}
Program: 12712
Project: 12712
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
    String localId=extractDisplayId(mapsTo.getLocalURI());
    mapsTo.setLocal(createCompliantURI(URIprefix,localId,version));
  }
}
Program: 12713
Project: 12713
Buggy source:
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
  }
}

Fixed version (ground truth):
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String displayId,String version){
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(createCompliantURI(URIprefix,displayId,version));
  this.setPersistentIdentity(createCompliantURI(URIprefix,displayId,"String_Node_Str"));
  this.setDisplayId(displayId);
  this.setVersion(version);
  for (  MapsTo mapsTo : this.getMapsTos()) {
    mapsTo.updateCompliantURI(this.getPersistentIdentity().toString(),mapsTo.getDisplayId(),version);
    this.removeChildSafely(mapsTo,this.mapsTos);
    this.addMapsTo(mapsTo);
    String localId=extractDisplayId(mapsTo.getLocalURI());
    mapsTo.setLocal(createCompliantURI(URIprefix,localId,version));
  }
}
Program: 12714
Project: 12714
Buggy source:
private Module(Module module){
  super(module);
  this.setDefinition(module.getDefinitionURI());
  if (!module.getMapsTos().isEmpty()) {
    List<MapsTo> mappings=new ArrayList<>();
    for (    MapsTo mapping : module.getMapsTos()) {
      mappings.add(mapping.deepCopy());
    }
    this.setMapsTos(mappings);
  }
}

Fixed version (ground truth):
private Module(Module module){
  super(module);
  this.mapsTos=new HashMap<>();
  this.setDefinition(module.getDefinitionURI());
  for (  MapsTo mapping : module.getMapsTos()) {
    this.addMapsTo(mapping.deepCopy());
  }
}
Program: 12716
Project: 12716
Buggy source:
/** 
 * Set the specified authority as the prefix to all member's identity
 */
public static void setURIPrefix(String authority){
  SBOLReader.setURIPrefix=authority;
}

Fixed version (ground truth):
/** 
 * Set the specified authority as the prefix to all member's identity
 */
public static void setURIPrefix(String URIprefix){
  SBOLReader.URIPrefix=URIprefix;
}
Program: 12721
Project: 12721
Buggy source:
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument document1=SBOLReader.read(file);
    document1=SBOLTestUtils.writeAndRead(document1);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLReader.setVersion("String_Node_Str");
    SBOLReader.setTypesInURI(true);
    SBOLDocument document1=SBOLReader.read(file);
    document1=SBOLTestUtils.writeAndRead(document1);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12722
Project: 12722
Buggy source:
/** 
 * Top level types
 */
public static void main(String[] args) throws XMLStreamException, FactoryConfigurationError, CoreIoException {
  get_myParts(SBOL2Doc_test);
  SBOLDocument sbolDoc=new SBOLDocument();
  sbolDoc.setDefaultURIprefix("String_Node_Str");
  ComponentDefinition cd=SBOL2Doc_test.getComponentDefinition("String_Node_Str","String_Node_Str");
  sbolDoc.createCopy(cd,"String_Node_Str","String_Node_Str");
  cd=SBOL2Doc_test.getComponentDefinition("String_Node_Str","String_Node_Str");
  sbolDoc.createCopy(cd,"String_Node_Str","String_Node_Str");
  ModuleDefinition md=SBOL2Doc_test.getModuleDefinition("String_Node_Str","String_Node_Str");
  sbolDoc.createCopy(md,"String_Node_Str","String_Node_Str");
  writeRdfOutputStream(sbolDoc);
}

Fixed version (ground truth):
/** 
 * Top level types
 */
public static void main(String[] args) throws XMLStreamException, FactoryConfigurationError, CoreIoException {
  get_myParts(SBOL2Doc_test);
  writeRdfOutputStream(SBOL2Doc_test);
}
Program: 12741
Project: 12741
Buggy source:
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_11);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_11);
    SBOLDocument document1=SBOLReader.read(file);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_11);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_11);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument document1=SBOLReader.read(file);
    document1=SBOLTestUtils.writeAndRead(document1);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12742
Project: 12742
Buggy source:
private Collection(Collection collection){
  super(collection.getIdentity());
  Set<URI> newMembers=new HashSet<>();
  for (  URI member : collection.getMemberURIs()) {
    newMembers.add(member);
  }
}

Fixed version (ground truth):
private Collection(Collection collection){
  super(collection.getIdentity());
  Set<URI> newMembers=new HashSet<>();
  for (  URI member : collection.getMemberURIs()) {
    newMembers.add(member);
  }
  this.setMembers(newMembers);
}
Program: 12743
Project: 12743
Buggy source:
private ModuleDefinition(ModuleDefinition moduleDefinition){
  super(moduleDefinition);
  Set<URI> roles=new HashSet<>();
  for (  URI role : moduleDefinition.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  if (!moduleDefinition.getModules().isEmpty()) {
    List<Module> subModules=new ArrayList<>();
    for (    Module subModule : moduleDefinition.getModules()) {
      subModules.add(subModule.deepCopy());
    }
    this.setModules(subModules);
  }
  if (!moduleDefinition.getInteractions().isEmpty()) {
    List<Interaction> interactions=new ArrayList<>();
    for (    Interaction interaction : moduleDefinition.getInteractions()) {
      interactions.add(interaction.deepCopy());
    }
    this.setInteractions(interactions);
  }
  if (!moduleDefinition.getFunctionalComponents().isEmpty()) {
    List<FunctionalComponent> components=new ArrayList<>();
    for (    FunctionalComponent component : moduleDefinition.getFunctionalComponents()) {
      components.add(component.deepCopy());
    }
    this.setFunctionalComponents(components);
  }
  if (!moduleDefinition.getModels().isEmpty()) {
    Set<URI> models=new HashSet<>();
    for (    URI model : moduleDefinition.getModelURIs()) {
      models.add(model);
    }
  }
}

Fixed version (ground truth):
private ModuleDefinition(ModuleDefinition moduleDefinition){
  super(moduleDefinition);
  Set<URI> roles=new HashSet<>();
  for (  URI role : moduleDefinition.getRoles()) {
    roles.add(role);
  }
  this.setRoles(roles);
  if (!moduleDefinition.getModules().isEmpty()) {
    List<Module> subModules=new ArrayList<>();
    for (    Module subModule : moduleDefinition.getModules()) {
      subModules.add(subModule.deepCopy());
    }
    this.setModules(subModules);
  }
  if (!moduleDefinition.getInteractions().isEmpty()) {
    List<Interaction> interactions=new ArrayList<>();
    for (    Interaction interaction : moduleDefinition.getInteractions()) {
      interactions.add(interaction.deepCopy());
    }
    this.setInteractions(interactions);
  }
  if (!moduleDefinition.getFunctionalComponents().isEmpty()) {
    List<FunctionalComponent> components=new ArrayList<>();
    for (    FunctionalComponent component : moduleDefinition.getFunctionalComponents()) {
      components.add(component.deepCopy());
    }
    this.setFunctionalComponents(components);
  }
  if (!moduleDefinition.getModels().isEmpty()) {
    Set<URI> models=new HashSet<>();
    for (    URI model : moduleDefinition.getModelURIs()) {
      models.add(model);
    }
    this.setModels(models);
  }
}
Program: 12753
Project: 12753
Buggy source:
public static URI createCompliantURI(String prefix,String type,String displayId,String version){
  return URI.create(prefix + '/' + type+ '/'+ displayId+ '/'+ version);
}

Fixed version (ground truth):
public static URI createCompliantURI(String prefix,String type,String displayId,String version){
  if (version == null || version.equals("String_Node_Str")) {
    return URI.create(prefix + '/' + type+ '/'+ displayId);
  }
  return URI.create(prefix + '/' + type+ '/'+ displayId+ '/'+ version);
}
Program: 12754
Project: 12754
Buggy source:
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument document1=SBOLReader.read(file);
    SBOLWriter.writeRDF(document1,(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    InputStream file=readTester.class.getResourceAsStream(path + filenameV1_1);
    if (file == null)     file=readTester.class.getResourceAsStream("String_Node_Str" + path + filenameV1_1);
    SBOLReader.setURIPrefix("String_Node_Str");
    SBOLDocument document1=SBOLReader.read(file);
    SBOLWriter.writeRDF(SBOLTestUtils.writeAndRead(document1),(System.out));
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
}
Program: 12755
Project: 12755
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),1);
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12756
Project: 12756
Buggy source:
/** 
 * Assume this Cut object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),2);
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Cut object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12757
Project: 12757
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),1);
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12758
Project: 12758
Buggy source:
/** 
 * Assume this GenericLocation object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),2);
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this GenericLocation object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12759
Project: 12759
Buggy source:
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),1);
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getParticipations().isEmpty()) {
    for (    Participation participation : this.getParticipations()) {
      participation.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Component object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ComponentDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getParticipations().isEmpty()) {
    for (    Participation participation : this.getParticipations()) {
      participation.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12760
Project: 12760
Buggy source:
/** 
 * Assume this MapsTo object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link Component#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),2);
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this MapsTo object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link Component#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12761
Project: 12761
Buggy source:
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),1);
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this Module object and all its descendants (children, grand children, etc) have compliant URI, and all given parameters have compliant forms. This method is called by   {@link ModuleDefinition#copy(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getMapsTos().isEmpty()) {
    for (    MapsTo mapsTo : this.getMapsTos()) {
      mapsTo.updateCompliantURI(URIprefix,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}
Program: 12762
Project: 12762
Buggy source:
/** 
 * Assume this MultiRange object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity(),2);
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getRanges().isEmpty()) {
    for (    Range range : this.getRanges()) {
      range.updateCompliantURI(URIprefix,grandparentDisplayId,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}

Fixed version (ground truth):
/** 
 * Assume this MultiRange object has compliant URI, and all given parameters have compliant forms. This method is called by   {@link SequenceAnnotation#updateCompliantURI(String,String,String)}.
 */
void updateCompliantURI(String URIprefix,String grandparentDisplayId,String parentDisplayId,String version){
  String thisObjDisplayId=extractDisplayId(this.getIdentity());
  URI newIdentity=URI.create(URIprefix + '/' + grandparentDisplayId+ '/'+ parentDisplayId+ '/'+ thisObjDisplayId+ '/'+ version);
  if (!this.getRanges().isEmpty()) {
    for (    Range range : this.getRanges()) {
      range.updateCompliantURI(URIprefix,grandparentDisplayId,parentDisplayId,thisObjDisplayId,version);
    }
  }
  this.setWasDerivedFrom(this.getIdentity());
  this.setIdentity(newIdentity);
}