use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class ModuleDefinition method createInteraction.
/**
* Creates a child interaction for this module definition with
* the given arguments, and then adds to this module definition's list of interactions.
* <p>
* This method first creates a compliant interaction URI. It starts with this module definition's
* persistent identity, followed by the given display ID of the interaction to be created, and
* ends with the version of this module definition.
*
* @param displayId The displayId identifier for this interaction
* @param types The set of types to be added to the Interaction
* @return the created Interaction instance
* @throws SBOLValidationException if any of the following SBOL validation rules was violated:
* 10201, 10202, 10204, 10206, 11902, 12003.
*/
public Interaction createInteraction(String displayId, Set<URI> types) throws SBOLValidationException {
String URIprefix = this.getPersistentIdentity().toString();
String version = this.getVersion();
URI interactionURI = createCompliantURI(URIprefix, displayId, version);
Interaction i = createInteraction(interactionURI, types);
i.setPersistentIdentity(createCompliantURI(URIprefix, displayId, ""));
i.setDisplayId(displayId);
i.setVersion(version);
return i;
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class Plan 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
Plan copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
Plan 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.SBOLValidationException in project libSBOLj by SynBioDex.
the class Activity method copy.
void copy(Activity activity) throws SBOLValidationException {
((TopLevel) this).copy((TopLevel) activity);
if (activity.isSetStartedAtTime()) {
this.setStartedAtTime(activity.getStartedAtTime());
}
if (activity.isSetEndedAtTime()) {
this.setEndedAtTime(activity.getEndedAtTime());
}
for (Association association : activity.getAssociations()) {
String displayId = URIcompliance.findDisplayId(association);
Association newAssociation = this.createAssociation(displayId, association.getAgentURI());
newAssociation.copy(association);
}
for (Usage usage : activity.getUsages()) {
String displayId = URIcompliance.findDisplayId(usage);
Usage newUsage = this.createUsage(displayId, usage.getEntityURI());
newUsage.copy(usage);
}
for (URI wasInformedBy : activity.getWasInformedByURIs()) {
this.addWasInformedBy(URI.create(wasInformedBy.toString()));
}
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class Activity method setWasInformedBys.
/**
* @param wasInformedBys the wasInformedBys to set
* @throws SBOLValidationException if an SBOL validation rule violation occurred in {@link #addWasInformedBy(URI)}
*/
public void setWasInformedBys(Set<URI> wasInformedBys) throws SBOLValidationException {
clearWasInformedBys();
if (wasInformedBys == null)
return;
for (URI wasInformedBy : wasInformedBys) {
addWasInformedBy(wasInformedBy);
}
this.wasInformedBys = wasInformedBys;
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class Association method copy.
void copy(Association association) throws SBOLValidationException {
((Identified) this).copy((Identified) association);
this.setPlan(association.getPlanURI());
for (URI role : association.getRoles()) {
this.addRole(URI.create(role.toString()));
}
}
Aggregations