use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class ParticipationTest method test_ParticipantMethods.
@Test
public void test_ParticipantMethods() throws SBOLValidationException {
TetR.addRole(SystemsBiologyOntology.INHIBITOR);
Interaction TetR_Interaction = TetRInverter_MD.createInteraction("TetR_Interaction", SystemsBiologyOntology.NON_COVALENT_BINDING);
Participation TetR_part = TetR_Interaction.createParticipation("TetR", "TetR", SystemsBiologyOntology.PRODUCT);
assertTrue(TetR_Interaction.getParticipation("TetR").equals(TetR_part));
assertTrue(TetR_part.addRole(SystemsBiologyOntology.COMPETITIVE_INHIBITOR));
assertTrue(TetR_part.containsRole(SystemsBiologyOntology.COMPETITIVE_INHIBITOR));
assertTrue(TetR_part.getRoles().size() == 2);
assertTrue(TetR_part.removeRole(SystemsBiologyOntology.COMPETITIVE_INHIBITOR));
assertFalse(TetR_part.containsRole(SystemsBiologyOntology.COMPETITIVE_INHIBITOR));
assertTrue(TetR_part.getParticipantDefinition().getIdentity().equals(TetR.getIdentity()));
assertTrue(TetR_part.getParticipant().getIdentity().equals(TetRInverter_MD.getFunctionalComponent("TetR").getIdentity()));
assertNotNull(TetR_part);
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class AnnotationTest method test_pubConstructors.
@Test
public void test_pubConstructors() throws SBOLValidationException, URISyntaxException {
Annotation CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), true);
assertTrue(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getBooleanValue());
assertTrue(gRNA_b_gene.getAnnotations().size() == 1);
assertTrue(CD_annot.isBooleanValue());
CD_annot.setBooleanValue(false);
assertFalse(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getBooleanValue());
gRNA_b_gene.removeAnnotation(CD_annot);
assertTrue(gRNA_b_gene.getAnnotations().size() == 0);
// test constructor with double
CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), 1.0);
assertTrue(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getDoubleValue() == 1.0);
assertTrue(gRNA_b_gene.getAnnotations().size() == 1);
assertTrue(CD_annot.isDoubleValue());
CD_annot.setDoubleValue(5.0);
assertTrue(CD_annot.getDoubleValue() == 5.0);
gRNA_b_gene.removeAnnotation(CD_annot);
assertTrue(gRNA_b_gene.getAnnotations().size() == 0);
// test constructor with int
CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), 2);
assertTrue(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getIntegerValue() == 2);
assertTrue(gRNA_b_gene.getAnnotations().size() == 1);
assertTrue(CD_annot.isIntegerValue());
CD_annot.setIntegerValue(7);
assertTrue(CD_annot.getIntegerValue() == 7);
gRNA_b_gene.removeAnnotation(CD_annot);
assertTrue(gRNA_b_gene.getAnnotations().size() == 0);
// test constructor with string
CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), "protein");
assertTrue(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getStringValue().equals("protein"));
assertTrue(gRNA_b_gene.getAnnotations().size() == 1);
assertTrue(CD_annot.isStringValue());
CD_annot.setStringValue("notAProtein");
assertTrue(CD_annot.getStringValue().equals("notAProtein"));
gRNA_b_gene.removeAnnotation(CD_annot);
assertTrue(gRNA_b_gene.getAnnotations().size() == 0);
// test constructor with URI
CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), new URI("http://www.sbolstandard.org/protein"));
assertTrue(gRNA_b_gene.getAnnotation(CD_annot.getQName()).getURIValue().equals(new URI("http://www.sbolstandard.org/protein")));
assertTrue(gRNA_b_gene.getAnnotations().size() == 1);
assertTrue(CD_annot.isURIValue());
CD_annot.setURIValue(new URI("http://www.sbolstandard.org/gene"));
assertTrue(CD_annot.getURIValue().equals(new URI("http://www.sbolstandard.org/gene")));
gRNA_b_gene.removeAnnotation(CD_annot);
assertTrue(gRNA_b_gene.getAnnotations().size() == 0);
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class SequenceTest method test_deep_copy.
@Test
public void test_deep_copy() throws SBOLValidationException {
Sequence gen_seq = doc.createSequence("CRa_U6_seq", CRa_U6_seq, Sequence.IUPAC_DNA);
Sequence copy_seq = (Sequence) doc.createCopy(gen_seq, "copy_seq");
// assertTrue(copy_seq.equals(gen_seq));
assertTrue(copy_seq.getElements().equals(CRa_U6_seq));
}
use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.
the class ComponentTest method test_ComponentMapsTo.
@Test
public void test_ComponentMapsTo() throws SBOLValidationException {
MapsTo geneMapsTo = gene.createMapsTo("local_gene", RefinementType.USELOCAL, target_gene.getDisplayId(), protein.getDisplayId());
assertTrue(gene.getMapsTos().size() == 1);
assertNotNull(gene.getMapsTo("local_gene"));
assertEquals(gene.getMapsTo("local_gene"), geneMapsTo);
gene.removeMapsTo(geneMapsTo);
assertTrue(gene.getMapsTos().size() == 0);
geneMapsTo = gene.createMapsTo("local_gene", RefinementType.USELOCAL, target_gene.getIdentity(), protein.getIdentity());
assertNotNull(gene.getMapsTo(geneMapsTo.getIdentity()));
assertTrue(gene.getMapsTos().size() == 1);
gene.clearMapsTos();
assertTrue(gene.getMapsTos().size() == 0);
}
use of org.sbolstandard.core2.SBOLValidationException 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;
}
Aggregations