Search in sources :

Example 26 with Model

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

the class ModuleDefinitionTest method test_modelMethods.

@Test
public void test_modelMethods() 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(geneticToggleSwitch.addModel("pIKE_Toggle_1"));
    assertTrue(doc.getModuleDefinition("geneticToggleSwitch", "").getModels().contains(model));
    assertTrue(geneticToggleSwitch.removeModel(model.getPersistentIdentity()));
    assertTrue(geneticToggleSwitch.addModel("pIKE_Toggle_1", "1.0"));
    assertTrue(doc.getModuleDefinition("geneticToggleSwitch", "").getModels().contains(model));
    assertTrue(geneticToggleSwitch.containsModel(model.getIdentity()));
}
Also used : Model(org.sbolstandard.core2.Model) Test(org.junit.Test)

Example 27 with Model

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

the class SBOLReader method parseModuleDefinition.

/**
 * @param SBOLDoc
 * @param topLevel
 * @param nested
 * @return
 *
 * @throws SBOLValidationException if either of the following conditions is satisfied:
 * <ul>
 * <li>any of the following SBOL validation rules was violated:
 * 10202, 10203, 10204, 10206, 10208, 10212, 10213, 11602, 11607 or</li>
 * <li>an SBOL validation rule violation occurred in the following constructor or methods:
 * 	<ul>
 * 		<li>{@link #parseModule(NestedDocument, Map)},</li>
 * 		<li>{@link #parseInteraction(NestedDocument, Map)},</li>
 * 		<li>{@link #parseFunctionalComponent(NestedDocument, Map)},</li>
 * 		<li>{@link ModuleDefinition#ModuleDefinition(URI)}, </li>
 * 		<li>{@link ModuleDefinition#setDisplayId(String)}, </li>
 * 		<li>{@link ModuleDefinition#setVersion(String)}, </li>
 * 		<li>{@link ModuleDefinition#setFunctionalComponents(Set)}, </li>
 * 		<li>{@link ModuleDefinition#setInteractions(Set)}, </li>
 * 		<li>{@link ModuleDefinition#setModels(Set)}, </li>
 * 		<li>{@link ModuleDefinition#setModules(Set)}, </li>
 * 		<li>{@link ModuleDefinition#setWasDerivedFrom(URI)}, </li>
 * 		<li>{@link ModuleDefinition#setAnnotations(List)}, or</li>
 * 		<li>{@link SBOLDocument#addModuleDefinition(ModuleDefinition)}.</li>
 * 	</ul>
 * </li>
 * </ul>
 */
@SuppressWarnings("unchecked")
private static ModuleDefinition parseModuleDefinition(SBOLDocument SBOLDoc, IdentifiableDocument<QName> topLevel, Map<URI, NestedDocument<QName>> nested) throws SBOLValidationException {
    // URIcompliance.extractDisplayId(topLevel.getIdentity());
    String displayId = null;
    String name = null;
    String description = null;
    // URI.create(URIcompliance.extractPersistentId(topLevel.getIdentity()));
    URI persistentIdentity = null;
    String version = null;
    Set<URI> wasDerivedFroms = new HashSet<>();
    Set<URI> wasGeneratedBys = new HashSet<>();
    Set<URI> attachments = new HashSet<>();
    Set<URI> roles = new HashSet<>();
    Set<URI> models = new HashSet<>();
    Set<FunctionalComponent> functionalComponents = new HashSet<>();
    Set<Interaction> interactions = new HashSet<>();
    Set<Module> subModules = new HashSet<>();
    List<Annotation> annotations = new ArrayList<>();
    for (NamedProperty<QName> namedProperty : topLevel.getProperties()) {
        if (namedProperty.getName().equals(Sbol2Terms.Identified.persistentIdentity)) {
            if (!(namedProperty.getValue() instanceof Literal) || persistentIdentity != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                throw new SBOLValidationException("sbol-10203", topLevel.getIdentity());
            }
            persistentIdentity = URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString());
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.version)) {
            if (!(namedProperty.getValue() instanceof Literal) || version != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-10206", topLevel.getIdentity());
            }
            version = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.displayId)) {
            if (!(namedProperty.getValue() instanceof Literal) || displayId != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-10204", topLevel.getIdentity());
            }
            displayId = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
        } else if (namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.roles)) {
            if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                throw new SBOLValidationException("sbol-11602", topLevel.getIdentity());
            }
            roles.add(URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString()));
        } else if (namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.hasModule) || namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.hasSubModule)) {
            if (namedProperty.getValue() instanceof NestedDocument) {
                NestedDocument<QName> nestedDocument = ((NestedDocument<QName>) namedProperty.getValue());
                if (nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.Module.Module)) {
                    throw new SBOLValidationException("sbol-11604", topLevel.getIdentity());
                }
                subModules.add(parseModule(SBOLDoc, ((NestedDocument<QName>) namedProperty.getValue()), nested));
            } else {
                URI uri = (URI) ((Literal<QName>) namedProperty.getValue()).getValue();
                NestedDocument<QName> nestedDocument = nested.get(uri);
                if (nestedDocument == null || nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.Module.Module)) {
                    throw new SBOLValidationException("sbol-11604", topLevel.getIdentity());
                }
                subModules.add(parseModule(SBOLDoc, nested.get(uri), nested));
            }
        } else if (namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.hasInteractions)) {
            if (namedProperty.getValue() instanceof NestedDocument) {
                NestedDocument<QName> nestedDocument = ((NestedDocument<QName>) namedProperty.getValue());
                if (nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.Interaction.Interaction)) {
                    throw new SBOLValidationException("sbol-11605", topLevel.getIdentity());
                }
                interactions.add(parseInteraction((NestedDocument<QName>) namedProperty.getValue(), nested));
            } else {
                URI uri = (URI) ((Literal<QName>) namedProperty.getValue()).getValue();
                NestedDocument<QName> nestedDocument = nested.get(uri);
                if (nestedDocument == null || nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.Interaction.Interaction)) {
                    throw new SBOLValidationException("sbol-11605", topLevel.getIdentity());
                }
                interactions.add(parseInteraction(nested.get(uri), nested));
            }
        } else if (namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.hasfunctionalComponent) || namedProperty.getName().equals(Sbol2Terms.ComponentDefinition.hasComponent)) {
            if (namedProperty.getValue() instanceof NestedDocument) {
                NestedDocument<QName> nestedDocument = ((NestedDocument<QName>) namedProperty.getValue());
                if (nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.FunctionalComponent.FunctionalComponent)) {
                    throw new SBOLValidationException("sbol-11606", topLevel.getIdentity());
                }
                functionalComponents.add(parseFunctionalComponent(SBOLDoc, (NestedDocument<QName>) namedProperty.getValue(), nested));
            } else {
                URI uri = (URI) ((Literal<QName>) namedProperty.getValue()).getValue();
                NestedDocument<QName> nestedDocument = nested.get(uri);
                if (nestedDocument == null || nestedDocument.getType() == null || !nestedDocument.getType().equals(Sbol2Terms.FunctionalComponent.FunctionalComponent)) {
                    throw new SBOLValidationException("sbol-11606", topLevel.getIdentity());
                }
                functionalComponents.add(parseFunctionalComponent(SBOLDoc, nested.get(uri), nested));
            }
        } else if (namedProperty.getName().equals(Sbol2Terms.ModuleDefinition.hasModels)) {
            if (namedProperty.getValue() instanceof Literal) {
                if (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI)) {
                    throw new SBOLValidationException("sbol-11607", topLevel.getIdentity());
                }
                models.add(URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString()));
            } else if (namedProperty.getValue() instanceof IdentifiableDocument) {
                if (((IdentifiableDocument<QName>) namedProperty).getType().equals(Sbol2Terms.Model.Model)) {
                    Model model = parseModel(SBOLDoc, (IdentifiableDocument<QName>) namedProperty.getValue());
                    models.add(model.getIdentity());
                } else {
                    throw new SBOLValidationException("sbol-11607", topLevel.getIdentity());
                }
            } else {
                throw new SBOLValidationException("sbol-11607", topLevel.getIdentity());
            }
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.title)) {
            if (!(namedProperty.getValue() instanceof Literal) || name != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-10212", topLevel.getIdentity());
            }
            name = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.description)) {
            if (!(namedProperty.getValue() instanceof Literal) || description != null || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof String))) {
                throw new SBOLValidationException("sbol-10213", topLevel.getIdentity());
            }
            description = ((Literal<QName>) namedProperty.getValue()).getValue().toString();
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.wasDerivedFrom)) {
            if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                throw new SBOLValidationException("sbol-10208", topLevel.getIdentity());
            }
            wasDerivedFroms.add(URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString()));
        } else if (namedProperty.getName().equals(Sbol2Terms.Identified.wasGeneratedBy)) {
            if (!(namedProperty.getValue() instanceof Literal) || (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI))) {
                throw new SBOLValidationException("sbol-10221", topLevel.getIdentity());
            }
            wasGeneratedBys.add(URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString()));
        } else if (namedProperty.getName().equals(Sbol2Terms.TopLevel.hasAttachment)) {
            if (namedProperty.getValue() instanceof Literal) {
                if (!(((Literal<QName>) namedProperty.getValue()).getValue() instanceof URI)) {
                    throw new SBOLValidationException("sbol-XXXXX", topLevel.getIdentity());
                }
                attachments.add(URI.create(((Literal<QName>) namedProperty.getValue()).getValue().toString()));
            } else if (namedProperty.getValue() instanceof IdentifiableDocument) {
                if (((IdentifiableDocument<QName>) namedProperty).getType().equals(Sbol2Terms.Attachment.Attachment)) {
                    Attachment attachment = parseAttachment(SBOLDoc, (IdentifiableDocument<QName>) namedProperty.getValue());
                    attachments.add(attachment.getIdentity());
                } else {
                    throw new SBOLValidationException("sbol-XXXXX", topLevel.getIdentity());
                }
            } else {
                throw new SBOLValidationException("sbol-XXXXX", topLevel.getIdentity());
            }
        } else {
            annotations.add(new Annotation(namedProperty));
        }
    }
    // ModuleDefinition moduleDefinition = SBOLDoc.createModuleDefinition(topLevel.getIdentity());
    ModuleDefinition moduleDefinition = new ModuleDefinition(topLevel.getIdentity());
    if (!roles.isEmpty())
        moduleDefinition.setRoles(roles);
    if (persistentIdentity != null)
        moduleDefinition.setPersistentIdentity(persistentIdentity);
    if (version != null)
        moduleDefinition.setVersion(version);
    if (displayId != null)
        moduleDefinition.setDisplayId(displayId);
    if (!functionalComponents.isEmpty())
        moduleDefinition.setFunctionalComponents(functionalComponents);
    if (!interactions.isEmpty())
        moduleDefinition.setInteractions(interactions);
    if (!models.isEmpty())
        moduleDefinition.setModels(models);
    if (!subModules.isEmpty())
        moduleDefinition.setModules(subModules);
    if (name != null)
        moduleDefinition.setName(name);
    if (description != null)
        moduleDefinition.setDescription(description);
    moduleDefinition.setWasDerivedFroms(wasDerivedFroms);
    moduleDefinition.setWasGeneratedBys(wasGeneratedBys);
    moduleDefinition.setAttachments(attachments);
    if (!annotations.isEmpty())
        moduleDefinition.setAnnotations(annotations);
    ModuleDefinition oldM = SBOLDoc.getModuleDefinition(topLevel.getIdentity());
    if (oldM == null) {
        SBOLDoc.addModuleDefinition(moduleDefinition);
    } else {
        if (!moduleDefinition.equals(oldM)) {
            throw new SBOLValidationException("sbol-10202", moduleDefinition);
        }
    }
    return moduleDefinition;
}
Also used : StringifyQName(org.sbolstandard.core.io.json.StringifyQName) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI) URI(java.net.URI) NestedDocument(org.sbolstandard.core.datatree.NestedDocument) IdentifiableDocument(org.sbolstandard.core.datatree.IdentifiableDocument) Literal(org.sbolstandard.core.datatree.Literal) HashSet(java.util.HashSet)

Example 28 with Model

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

the class SBOLDocument method updateReferences.

// TODO: need to update persistentIdentities too
private void updateReferences(HashMap<URI, URI> uriMap) throws SBOLValidationException {
    for (TopLevel topLevel : getTopLevels()) {
        for (URI wasDerivedFrom : topLevel.getWasDerivedFroms()) {
            if (uriMap.get(wasDerivedFrom) != null) {
                topLevel.removeWasDerivedFrom(wasDerivedFrom);
                topLevel.addWasDerivedFrom(uriMap.get(wasDerivedFrom));
            }
        }
        for (URI wasGeneratedBy : topLevel.getWasGeneratedBys()) {
            if (uriMap.get(wasGeneratedBy) != null) {
                topLevel.removeWasGeneratedBy(wasGeneratedBy);
                topLevel.addWasGeneratedBy(uriMap.get(wasGeneratedBy));
            }
        }
        for (URI attachmentURI : topLevel.getAttachmentURIs()) {
            if (uriMap.get(attachmentURI) != null) {
                topLevel.removeAttachment(attachmentURI);
                topLevel.addAttachment(uriMap.get(attachmentURI));
            }
        }
    }
    for (Collection collection : getCollections()) {
        for (URI memberURI : collection.getMemberURIs()) {
            if (uriMap.get(memberURI) != null) {
                collection.removeMember(memberURI);
                collection.addMember(uriMap.get(memberURI));
            }
        }
        updateReferences(collection, uriMap);
    }
    for (ComponentDefinition componentDefinition : getComponentDefinitions()) {
        updateReferences(componentDefinition, uriMap);
        for (Component component : componentDefinition.getComponents()) {
            if (uriMap.get(component.getDefinitionURI()) != null) {
                component.setDefinition(uriMap.get(component.getDefinitionURI()));
                for (MapsTo mapsTo : component.getMapsTos()) {
                    ComponentDefinition cd = getComponentDefinition(component.getDefinitionURI());
                    if (cd != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(component, uriMap);
            for (MapsTo mapsTo : component.getMapsTos()) {
                updateReferences(mapsTo, uriMap);
            }
        }
        for (SequenceAnnotation sa : componentDefinition.getSequenceAnnotations()) {
            for (Location loc : sa.getLocations()) {
                updateReferences(loc, uriMap);
            }
            updateReferences(sa, uriMap);
        }
        for (SequenceConstraint sc : componentDefinition.getSequenceConstraints()) {
            updateReferences(sc, uriMap);
        }
        for (URI sequenceURI : componentDefinition.getSequenceURIs()) {
            if (uriMap.get(sequenceURI) != null) {
                componentDefinition.removeSequence(sequenceURI);
                componentDefinition.addSequence(uriMap.get(sequenceURI));
            }
        }
    }
    for (ModuleDefinition moduleDefinition : getModuleDefinitions()) {
        updateReferences(moduleDefinition, uriMap);
        for (FunctionalComponent functionalComponent : moduleDefinition.getFunctionalComponents()) {
            if (uriMap.get(functionalComponent.getDefinitionURI()) != null) {
                functionalComponent.setDefinition(uriMap.get(functionalComponent.getDefinitionURI()));
                for (MapsTo mapsTo : functionalComponent.getMapsTos()) {
                    ComponentDefinition cd = getComponentDefinition(functionalComponent.getDefinitionURI());
                    if (cd != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(functionalComponent, uriMap);
            for (MapsTo mapsTo : functionalComponent.getMapsTos()) {
                updateReferences(mapsTo, uriMap);
            }
        }
        for (Module module : moduleDefinition.getModules()) {
            if (uriMap.get(module.getDefinitionURI()) != null) {
                module.setDefinition(uriMap.get(module.getDefinitionURI()));
                for (MapsTo mapsTo : module.getMapsTos()) {
                    ModuleDefinition md = getModuleDefinition(module.getDefinitionURI());
                    if (md != null) {
                        String displayId = URIcompliance.extractDisplayId(mapsTo.getRemoteURI());
                        URI newURI = URIcompliance.createCompliantURI(md.getPersistentIdentity().toString(), displayId, md.getVersion());
                        mapsTo.setRemote(newURI);
                    }
                }
            }
            updateReferences(module, uriMap);
            for (MapsTo mapsTo : module.getMapsTos()) {
                updateReferences(mapsTo, uriMap);
            }
        }
        for (Interaction interaction : moduleDefinition.getInteractions()) {
            updateReferences(interaction, uriMap);
            for (Participation participation : interaction.getParticipations()) {
                updateReferences(participation, uriMap);
            }
        }
        for (URI modelURI : moduleDefinition.getModelURIs()) {
            if (uriMap.get(modelURI) != null) {
                moduleDefinition.removeModel(modelURI);
                moduleDefinition.addModel(uriMap.get(modelURI));
            }
        }
    }
    for (Model model : getModels()) {
        updateReferences(model, uriMap);
    }
    for (Sequence sequence : getSequences()) {
        updateReferences(sequence, uriMap);
    }
    for (Attachment attachment : getAttachments()) {
        updateReferences(attachment, uriMap);
    }
    for (Implementation implementation : getImplementations()) {
        if (implementation.isSetBuilt()) {
            URI built = implementation.getBuiltURI();
            if (uriMap.get(built) != null) {
                implementation.setBuilt(uriMap.get(built));
            }
        }
        updateReferences(implementation, uriMap);
    }
    for (GenericTopLevel genericTopLevel : getGenericTopLevels()) {
        updateReferences(genericTopLevel, uriMap);
    }
    for (CombinatorialDerivation combinatorialDerivation : getCombinatorialDerivations()) {
        updateReferences(combinatorialDerivation, uriMap);
        if (uriMap.get(combinatorialDerivation.getTemplateURI()) != null) {
            combinatorialDerivation.setTemplate(uriMap.get(combinatorialDerivation.getTemplateURI()));
            ComponentDefinition cd = getComponentDefinition(combinatorialDerivation.getTemplateURI());
            if (cd != null) {
                for (VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
                    String displayId = URIcompliance.extractDisplayId(variableComponent.getVariableURI());
                    URI newURI = URIcompliance.createCompliantURI(cd.getPersistentIdentity().toString(), displayId, cd.getVersion());
                    variableComponent.setVariable(newURI);
                }
            }
        }
        for (VariableComponent variableComponent : combinatorialDerivation.getVariableComponents()) {
            updateReferences(variableComponent, uriMap);
        }
    }
    for (Activity activity : getActivities()) {
        updateReferences(activity, uriMap);
        for (Association association : activity.getAssociations()) {
            if (uriMap.get(association.getAgentURI()) != null) {
                association.setAgent(uriMap.get(association.getAgentURI()));
            }
            if (uriMap.get(association.getPlanURI()) != null) {
                association.setPlan(uriMap.get(association.getPlanURI()));
            }
            updateReferences(association, uriMap);
        }
        for (Usage usage : activity.getUsages()) {
            if (uriMap.get(usage.getEntityURI()) != null) {
                usage.setEntity(uriMap.get(usage.getEntityURI()));
            }
            updateReferences(usage, uriMap);
        }
    }
    for (Agent agent : getAgents()) {
        updateReferences(agent, uriMap);
    }
    for (Plan plan : getPlans()) {
        updateReferences(plan, uriMap);
    }
}
Also used : URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI) URI(java.net.URI)

Example 29 with Model

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

the class ModuleDefinition method getModelIdentities.

/**
 * Returns the set of models identities referenced by this module definition.
 *
 * @return the set of models identities referenced by this module definition
 */
public Set<URI> getModelIdentities() {
    Set<URI> result = new HashSet<>();
    for (URI modelURI : models) {
        Model model = this.getSBOLDocument().getModel(modelURI);
        result.add(model.getIdentity());
    }
    return result;
}
Also used : URI(java.net.URI) URIcompliance.createCompliantURI(org.sbolstandard.core2.URIcompliance.createCompliantURI) HashSet(java.util.HashSet)

Example 30 with Model

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

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

Test (org.junit.Test)45 Model (org.eclipse.xtext.valueconverter.bug250313.Model)30 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)16 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)11 Model (org.eclipse.xtext.parsetree.reconstr.bug299395.Model)9 SubModel (org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel)9 URI (java.net.URI)8 BoolExpr (com.microsoft.z3.BoolExpr)7 Model (com.microsoft.z3.Model)7 URIcompliance.createCompliantURI (org.sbolstandard.core2.URIcompliance.createCompliantURI)7 HashSet (java.util.HashSet)6 EPackage (org.eclipse.emf.ecore.EPackage)6 Action (org.eclipse.xtext.Action)6 Parameter (org.eclipse.xtext.Parameter)6 ParserRule (org.eclipse.xtext.ParserRule)6 QName (javax.xml.namespace.QName)4 Status (com.microsoft.z3.Status)3 ArrayList (java.util.ArrayList)3 Model (org.sbolstandard.core2.Model)3 SBOLDocument (org.sbolstandard.core2.SBOLDocument)3