use of org.sbolstandard.core2 in project libSBOLj by SynBioDex.
the class Activity method copy.
/* (non-Javadoc)
* @see org.sbolstandard.core2.abstract_classes.TopLevel#copy(java.lang.String, java.lang.String, java.lang.String)
*/
/**
* @throws SBOLValidationException if an SBOL validation rule violation occurred in
* any of the following methods:
* <ul>
* <li>{@link #deepCopy()},</li>
* <li>{@link URIcompliance#createCompliantURI(String, String, String)},</li>
* <li>{@link #setDisplayId(String)},</li>
* <li>{@link #setVersion(String)},</li>
* <li>{@link #setWasDerivedFrom(URI)}, or</li>
* <li>{@link #setIdentity(URI)}.</li>
* </ul>
*/
@Override
Activity copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
Activity cloned = this.deepCopy();
cloned.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
cloned.setDisplayId(displayId);
cloned.setVersion(version);
URI newIdentity = createCompliantURI(URIprefix, displayId, version);
if (!this.getIdentity().equals(newIdentity)) {
cloned.addWasDerivedFrom(this.getIdentity());
} else {
cloned.setWasDerivedFroms(this.getWasDerivedFroms());
}
cloned.setIdentity(newIdentity);
return cloned;
}
use of org.sbolstandard.core2 in project libSBOLj by SynBioDex.
the class Agent method copy.
/* (non-Javadoc)
* @see org.sbolstandard.core2.abstract_classes.TopLevel#copy(java.lang.String, java.lang.String, java.lang.String)
*/
/**
* @throws SBOLValidationException if an SBOL validation rule violation occurred in
* any of the following methods:
* <ul>
* <li>{@link #deepCopy()},</li>
* <li>{@link URIcompliance#createCompliantURI(String, String, String)},</li>
* <li>{@link #setDisplayId(String)},</li>
* <li>{@link #setVersion(String)},</li>
* <li>{@link #setWasDerivedFrom(URI)}, or</li>
* <li>{@link #setIdentity(URI)}.</li>
* </ul>
*/
@Override
Agent copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
Agent cloned = this.deepCopy();
cloned.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
cloned.setDisplayId(displayId);
cloned.setVersion(version);
URI newIdentity = createCompliantURI(URIprefix, displayId, version);
if (!this.getIdentity().equals(newIdentity)) {
cloned.addWasDerivedFrom(this.getIdentity());
} else {
cloned.setWasDerivedFroms(this.getWasDerivedFroms());
}
cloned.setIdentity(newIdentity);
return cloned;
}
use of org.sbolstandard.core2 in project libSBOLj by SynBioDex.
the class ComponentDefinition method copy.
/* (non-Javadoc)
* @see org.sbolstandard.core2.abstract_classes.TopLevel#copy(java.lang.String, java.lang.String, java.lang.String)
*/
/**
* @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following constructors or methods:
* <ul>
* <li>{@link #deepCopy()},</li>
* <li>{@link URIcompliance#createCompliantURI(String, String, String)},</li>
* <li>{@link #setDisplayId(String)},</li>
* <li>{@link #setVersion(String)},</li>
* <li>{@link #setWasDerivedFrom(URI)},</li>
* <li>{@link #setIdentity(URI)}</li>
* <li>{@link Component#setDisplayId(String)}</li>
* <li>{@link Component#updateCompliantURI(String, String, String)},</li>
* <li>{@link #addComponent(Component)},</li>
* <li>{@link SequenceConstraint#setDisplayId(String)}</li>
* <li>{@link SequenceConstraint#updateCompliantURI(String, String, String)},</li>
* <li>{@link #addSequenceConstraint(SequenceConstraint)},</li>
* <li>{@link SequenceAnnotation#setDisplayId(String)}</li>
* <li>{@link SequenceAnnotation#updateCompliantURI(String, String, String)}, or</li>
* <li>{@link #addSequenceAnnotation(SequenceAnnotation)},</li>
* </ul>
*/
@Override
ComponentDefinition copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
ComponentDefinition cloned = this.deepCopy();
cloned.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
cloned.setDisplayId(displayId);
cloned.setVersion(version);
URI newIdentity = createCompliantURI(URIprefix, displayId, version);
if (!this.getIdentity().equals(newIdentity)) {
cloned.addWasDerivedFrom(this.getIdentity());
} else {
cloned.setWasDerivedFroms(this.getWasDerivedFroms());
}
cloned.setIdentity(newIdentity);
int count = 0;
for (Component component : cloned.getComponents()) {
if (!component.isSetDisplayId())
component.setDisplayId("component" + ++count);
component.updateCompliantURI(cloned.getPersistentIdentity().toString(), component.getDisplayId(), version);
cloned.removeChildSafely(component, cloned.components);
cloned.addComponent(component);
}
count = 0;
for (SequenceConstraint sequenceConstraint : cloned.getSequenceConstraints()) {
if (!sequenceConstraint.isSetDisplayId())
sequenceConstraint.setDisplayId("sequenceConstraint" + ++count);
sequenceConstraint.updateCompliantURI(cloned.getPersistentIdentity().toString(), sequenceConstraint.getDisplayId(), version);
cloned.removeChildSafely(sequenceConstraint, cloned.sequenceConstraints);
cloned.addSequenceConstraint(sequenceConstraint);
}
count = 0;
for (SequenceAnnotation sequenceAnnotation : cloned.getSequenceAnnotations()) {
if (!sequenceAnnotation.isSetDisplayId())
sequenceAnnotation.setDisplayId("sequenceAnnotation" + ++count);
sequenceAnnotation.updateCompliantURI(cloned.getPersistentIdentity().toString(), sequenceAnnotation.getDisplayId(), version);
cloned.removeChildSafely(sequenceAnnotation, cloned.sequenceAnnotations);
cloned.addSequenceAnnotation(sequenceAnnotation);
}
return cloned;
}
use of org.sbolstandard.core2 in project libSBOLj by SynBioDex.
the class Model method copy.
/* (non-Javadoc)
* @see org.sbolstandard.core2.abstract_classes.TopLevel#copy(java.lang.String, java.lang.String, java.lang.String)
*/
/**
* @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods:
* <ul>
* <li>{@link #deepCopy()},</li>
* <li>{@link URIcompliance#createCompliantURI(String, String, String)},</li>
* <li>{@link #setDisplayId(String)},</li>
* <li>{@link #setVersion(String)},</li>
* <li>{@link #setWasDerivedFrom(URI)}, or</li>
* <li>{@link #setIdentity(URI)}.</li>
* </ul>
*/
@Override
Model copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
Model cloned = this.deepCopy();
cloned.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
cloned.setDisplayId(displayId);
cloned.setVersion(version);
URI newIdentity = createCompliantURI(URIprefix, displayId, version);
if (!this.getIdentity().equals(newIdentity)) {
cloned.addWasDerivedFrom(this.getIdentity());
} else {
cloned.setWasDerivedFroms(this.getWasDerivedFroms());
}
cloned.setIdentity(newIdentity);
return cloned;
}
use of org.sbolstandard.core2 in project libSBOLj by SynBioDex.
the class GenericTopLevel method copy.
// /**
// * @param newDisplayId
// * @return
// */
// public GenericTopLevel copy(String newDisplayId) {
// GenericTopLevel cloned = (GenericTopLevel) this.deepCopy();
// cloned.updateCompliantURI(newDisplayId);
// return cloned;
// }
//
// /**
// * Get a deep copy of the object first, and set its major version to the specified value, and minor version to "0".
// * @param newVersion
// * @return the copied {@link ComponentDefinition} instance with the specified major version.
// */
// public GenericTopLevel newVersion(String newVersion) {
// GenericTopLevel cloned = (GenericTopLevel) super.newVersion(newVersion);
// cloned.updateVersion(newVersion);
// return cloned;
// }
/* (non-Javadoc)
* @see org.sbolstandard.core2.abstract_classes.TopLevel#copy(java.lang.String, java.lang.String, java.lang.String)
*/
/**
* @throws SBOLValidationException if an SBOL validation rule violation occurred in
* any of the following methods:
* <ul>
* <li>{@link #deepCopy()},</li>
* <li>{@link URIcompliance#createCompliantURI(String, String, String)},</li>
* <li>{@link #setDisplayId(String)},</li>
* <li>{@link #setVersion(String)},</li>
* <li>{@link #setWasDerivedFrom(URI)}, or</li>
* <li>{@link #setIdentity(URI)}.</li>
* </ul>
*/
@Override
GenericTopLevel copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
GenericTopLevel cloned = this.deepCopy();
cloned.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
cloned.setDisplayId(displayId);
cloned.setVersion(version);
URI newIdentity = createCompliantURI(URIprefix, displayId, version);
if (!this.getIdentity().equals(newIdentity)) {
cloned.addWasDerivedFrom(this.getIdentity());
} else {
cloned.setWasDerivedFroms(this.getWasDerivedFroms());
}
cloned.setIdentity(newIdentity);
return cloned;
}
Aggregations