use of org.sbolstandard.core2.SBOLDocument in project libSBOLj by SynBioDex.
the class FunctionalComponent method createMapsTo.
/**
* Creates a child MapsTo instance for this module with the given arguments, and then adds to this module's list of mapsTos.
* <p>
* This method creates compliant local and remote URIs first.
* The compliant local URI is created with this module's persistent identity URI, followed by
* the given local component's display ID, followed by this module's version.
* The compliant remote URI is created following the same pattern.
* It then calls {@link #createMapsTo(String, RefinementType, URI, URI)} to create
* a MapsTo instance.
* <p>
* This method automatically creates a local functional component if all of the following conditions are satisfied:
* <ul>
* <li>the associated SBOLDocument instance for this module is not {@code null};</li>
* <li>if default functional components should be automatically created when not present for the associated SBOLDocument instance,
* i.e., {@link SBOLDocument#isCreateDefaults} returns {@code true};</li>
* <li>if this module's parent module definition exists; and</li>
* <li>if this module's parent module definition does not already have a functional component
* with the created compliant local functional component URI.</li>
* </ul>
* @param displayId the display ID of the mapsTo to be created
* @param refinement the relationship between the local and remote functional components
* @param localId the display ID of the local functional component
* @param remoteId the display ID of the remote functional component
* @return the created mapsTo
* @throws SBOLValidationException if any of the following conditions is satisfied:
* <ul>
* <li>if either of the following SBOL validation rules was violated: 10204, 10206;</li>
* <li>an SBOL validation rule violation occurred in {@link ModuleDefinition#createFunctionalComponent(String, AccessType, String, String, DirectionType)}; or</li>
* <li>an SBOL validation rule violation occurred in {@link #createMapsTo(String, RefinementType, URI, URI)}.</li>
* </ul>
*/
public MapsTo createMapsTo(String displayId, RefinementType refinement, String localId, String remoteId) throws SBOLValidationException {
URI localURI = URIcompliance.createCompliantURI(moduleDefinition.getPersistentIdentity().toString(), localId, moduleDefinition.getVersion());
if (this.getSBOLDocument() != null && this.getSBOLDocument().isCreateDefaults() && moduleDefinition != null && moduleDefinition.getFunctionalComponent(localURI) == null) {
moduleDefinition.createFunctionalComponent(localId, AccessType.PUBLIC, localId, "", DirectionType.INOUT);
}
URI remoteURI = URIcompliance.createCompliantURI(getDefinition().getPersistentIdentity().toString(), remoteId, getDefinition().getVersion());
return createMapsTo(displayId, refinement, localURI, remoteURI);
}
use of org.sbolstandard.core2.SBOLDocument in project libSBOLj by SynBioDex.
the class SBOLDocumentTest method setUp.
@Before
public void setUp() throws Exception {
doc = new SBOLDocument();
doc.setDefaultURIprefix(prURI);
doc.setTypesInURIs(false);
doc.setComplete(true);
doc.createComponentDefinition("http://partsregistry.org", "gRNA_promoter", "", ComponentDefinition.DNA);
doc.createComponentDefinition(prURI, "CRa_promoter", "", ComponentDefinition.DNA);
doc.createComponentDefinition(prURI, "TetR_promoter", "", ComponentDefinition.DNA);
}
use of org.sbolstandard.core2.SBOLDocument 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));
}
use of org.sbolstandard.core2.SBOLDocument in project libSBOLj by SynBioDex.
the class AnnotationTest method setUp.
@Before
public void setUp() throws Exception {
doc = new SBOLDocument();
doc.setDefaultURIprefix(prURI);
doc.setTypesInURIs(false);
doc.setComplete(true);
gRNA_b_gene = doc.createComponentDefinition("gRNA_b_gene", ComponentDefinition.DNA);
gRNA_b_gene.addRole(SequenceOntology.ENGINEERED_GENE);
gRNA_b_gene.setName("gRNA_b_gene");
gRNA_b_gene.setDescription("protein");
}
use of org.sbolstandard.core2.SBOLDocument in project libSBOLj by SynBioDex.
the class SequenceConstraintTest method setUp.
@Before
public void setUp() throws Exception {
repression_doc = new SBOLDocument();
repression_doc.setDefaultURIprefix(prURI);
repression_doc.setTypesInURIs(false);
repression_doc.setComplete(true);
InputStream docAsStream = SequenceConstraintTest.class.getResourceAsStream("/SBOLTestSuite/SBOL2/RepressionModel.xml");
repression_doc.read(docAsStream);
}
Aggregations