Search in sources :

Example 86 with SBOLValidationException

use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.

the class Implementation method copy.

/**
 * @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>
 *             </ul>
 */
@Override
Implementation copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
    Implementation 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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 87 with SBOLValidationException

use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.

the class SBOLDocumentTest method test_createTLmethods.

@Test
public void test_createTLmethods() throws SBOLValidationException {
    ComponentDefinition gRNA_b_gene = doc.createComponentDefinition("http://partsregistry.org", "gRNA_b_gene", "", ComponentDefinition.DNA);
    assertNotNull(gRNA_b_gene);
    assertTrue(doc.getComponentDefinition("gRNA_b_gene", "").equals(gRNA_b_gene));
}
Also used : ComponentDefinition(org.sbolstandard.core2.ComponentDefinition) Test(org.junit.Test)

Example 88 with SBOLValidationException

use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.

the class SBOLDocumentTest method test_createCopy.

@Test
public void test_createCopy() throws SBOLValidationException, IOException, SBOLConversionException {
    SBOLDocument repression_doc = new SBOLDocument();
    repression_doc.setDefaultURIprefix(prURI);
    repression_doc.setTypesInURIs(false);
    // repression_doc.setComplete(true);
    SBOLDocument copied_doc = new SBOLDocument();
    copied_doc.setDefaultURIprefix(prURI);
    copied_doc.setTypesInURIs(false);
    // copied_doc.setComplete(true);
    // /core2/src/test/java/org/sbolstandard/core2/Testing/RepressionModel.xml"
    InputStream docAsStream = SequenceConstraintTest.class.getResourceAsStream("/SBOLTestSuite/SBOL2/RepressionModel.xml");
    repression_doc.read(docAsStream);
    // repression_doc.read("C:/Users/meher/Documents/workspace/libSBOLj/core2/src/test/resources/SBOL2/RepressionModel.xml");
    copied_doc.createCopy(repression_doc);
    assertTrue(repression_doc.equals(copied_doc));
}
Also used : InputStream(java.io.InputStream) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Test(org.junit.Test)

Example 89 with SBOLValidationException

use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.

the class SBOLDocumentTest method test_docModelMethods.

@Test
public void test_docModelMethods() throws SBOLValidationException {
    Model model = doc.createModel("pIKE_Toggle_1", "1.0", URI.create("http://virtualparts.org/part/pIKE_Toggle_1"), URI.create("http://identifiers.org/edam/format_2585"), SystemsBiologyOntology.CONTINUOUS_FRAMEWORK);
    assertTrue(doc.getModels().size() == 1);
    assertTrue(doc.getModel("pIKE_Toggle_1", "").equals(model));
    doc.clearModels();
    assertTrue(doc.getModels().size() == 0);
}
Also used : Model(org.sbolstandard.core2.Model) Test(org.junit.Test)

Example 90 with SBOLValidationException

use of org.sbolstandard.core2.SBOLValidationException in project libSBOLj by SynBioDex.

the class AnnotationTest method test_toString.

@Test
public void test_toString() throws SBOLValidationException {
    Annotation CD_annot = gRNA_b_gene.createAnnotation(new QName(prURI, "protein", "pr"), true);
    // System.out.println(CD_annot.toString());
    assertTrue(CD_annot.toString().contains("value=" + true));
}
Also used : QName(javax.xml.namespace.QName) Annotation(org.sbolstandard.core2.Annotation) Test(org.junit.Test)

Aggregations

URI (java.net.URI)81 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)75 QName (javax.xml.namespace.QName)36 HashSet (java.util.HashSet)35 ArrayList (java.util.ArrayList)31 Literal (org.sbolstandard.core.datatree.Literal)30 StringifyQName (org.sbolstandard.core.io.json.StringifyQName)30 IdentifiableDocument (org.sbolstandard.core.datatree.IdentifiableDocument)17 Test (org.junit.Test)16 NestedDocument (org.sbolstandard.core.datatree.NestedDocument)13 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)9 SBOLDocument (org.sbolstandard.core2.SBOLDocument)9 ModuleDefinition (org.sbolstandard.core2.ModuleDefinition)6 Sequence (org.sbolstandard.core2.Sequence)5 Interaction (org.sbolstandard.core2.Interaction)4 GenericTopLevel (org.sbolstandard.core2.GenericTopLevel)3 MapsTo (org.sbolstandard.core2.MapsTo)3 Set (java.util.Set)2 Annotation (org.sbolstandard.core2.Annotation)2 GenericLocation (org.sbolstandard.core2.GenericLocation)2