Search in sources :

Example 6 with org.sbolstandard.core2

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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 7 with org.sbolstandard.core2

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

the class ModuleDefinition 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 one 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)},</li>
 * <li>{@link #setIdentity(URI)},</li>
 * <li>{@link FunctionalComponent#setDisplayId(String)}</li>
 * <li>{@link FunctionalComponent#updateCompliantURI(String, String, String)},</li>
 * <li>{@link #addFunctionalComponent(FunctionalComponent)},</li>
 * <li>{@link Module#setDisplayId(String)}</li>
 * <li>{@link Module#updateCompliantURI(String, String, String)},</li>
 * <li>{@link #addModule(Module)},</li>
 * <li>{@link Interaction#setDisplayId(String)},</li>
 * <li>{@link Interaction#updateCompliantURI(String, String, String)}, or</li>
 * <li>{@link #addInteraction(Interaction)}.</li>
 * </ul>
 */
@Override
ModuleDefinition copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
    ModuleDefinition 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 (FunctionalComponent component : cloned.getFunctionalComponents()) {
        if (!component.isSetDisplayId())
            component.setDisplayId("functionalComponent" + ++count);
        component.updateCompliantURI(cloned.getPersistentIdentity().toString(), component.getDisplayId(), version);
        cloned.removeChildSafely(component, cloned.functionalComponents);
        cloned.addFunctionalComponent(component);
    }
    count = 0;
    for (Module module : cloned.getModules()) {
        if (!module.isSetDisplayId())
            module.setDisplayId("module" + ++count);
        module.updateCompliantURI(cloned.getPersistentIdentity().toString(), module.getDisplayId(), version);
        cloned.removeChildSafely(module, cloned.modules);
        cloned.addModule(module);
    }
    count = 0;
    for (Interaction interaction : cloned.getInteractions()) {
        if (!interaction.isSetDisplayId())
            interaction.setDisplayId("interaction" + ++count);
        interaction.updateCompliantURI(cloned.getPersistentIdentity().toString(), interaction.getDisplayId(), version);
        cloned.removeChildSafely(interaction, cloned.interactions);
        cloned.addInteraction(interaction);
    }
    return cloned;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 8 with org.sbolstandard.core2

use of org.sbolstandard.core2 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;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI)

Example 9 with org.sbolstandard.core2

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

the class Collection 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
Collection copy(String URIprefix, String displayId, String version) throws SBOLValidationException {
    Collection 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)

Aggregations

URI (java.net.URI)8 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)8 QName (javax.xml.namespace.QName)1 org.sbolstandard.core2 (org.sbolstandard.core2)1