public ConcentrationOntology(PMFUnitDefinition unitDefinition, PmfCompartment compartment, PmfSpecies species) { this.unitDefinition = unitDefinition; this.compartment = compartment; this.species = species; }
public SpeciesNuMLNode(PmfSpecies species, XmlDocument doc) { element = doc.CreateElement(NuMLTags.SPECIES); element.SetAttribute(NuMLTags.BOUNDARY_CONDITION_ATTR, PmfSpecies.BOUNDARY_CONDITION.ToString()); element.SetAttribute(NuMLTags.HAS_ONLY_SUBSTANCE_ATTR, PmfSpecies.ONLY_SUBSTANCE_UNITS.ToString()); element.SetAttribute(NuMLTags.COMPARTMENT_ATTR, species.getCompartment()); element.SetAttribute(NuMLTags.ID_ATTR, species.getId()); element.SetAttribute(NuMLTags.NAME_ATTR, species.getName()); element.SetAttribute(NuMLTags.SUBSTANCE_UNITS_ATTR, species.getUnits()); if (!string.IsNullOrEmpty(species.combaseCode) || !string.IsNullOrEmpty(species.detail) || !string.IsNullOrEmpty(species.description)) { XmlElement annotation = doc.CreateElement(NuMLTags.ANNOTATION); element.AppendChild(annotation); XmlElement metadata = doc.CreateElement(SbmlTags.PMF_NS, SbmlTags.METADATA, ""); annotation.AppendChild(metadata); if (!string.IsNullOrEmpty(species.combaseCode)) { XmlElement combaseCodeNode = doc.CreateElement(SbmlTags.PMF_NS, SbmlTags.SOURCE, ""); combaseCodeNode.InnerText = species.combaseCode; metadata.AppendChild(combaseCodeNode); } if (!string.IsNullOrEmpty(species.detail)) { XmlElement detailNode = doc.CreateElement(SbmlTags.PMMLAB_NS, SbmlTags.DETAIL, ""); detailNode.InnerText = species.detail; metadata.AppendChild(detailNode); } if (!string.IsNullOrEmpty(species.description)) { XmlElement descriptionNode = doc.CreateElement(SbmlTags.PMMLAB_NS, SbmlTags.DESCRIPTION, ""); descriptionNode.InnerText = species.description; metadata.AppendChild(descriptionNode); } } }
public PmfSpecies toPMFSpecies() { string id = element.GetAttribute(NuMLTags.ID_ATTR); string name = element.GetAttribute(NuMLTags.NAME_ATTR); string compartment = element.GetAttribute(NuMLTags.COMPARTMENT_ATTR); string substanceUnits = element.GetAttribute(NuMLTags.SUBSTANCE_UNITS_ATTR); PmfSpecies species = SBMLFactory.createPMFSpecies(compartment, id, name, substanceUnits); XmlElement annotationNode = (XmlElement)element.SelectSingleNode(NuMLTags.ANNOTATION); if (annotationNode != null) { // metadata XmlElement metadataNode = (XmlElement)annotationNode.SelectSingleNode(SbmlTags.PMF_NS + ":" + SbmlTags.METADATA); // combase code XmlElement combaseCodeNode = (XmlElement)metadataNode.SelectSingleNode(SbmlTags.PMF_NS + ":" + SbmlTags.SOURCE); if (combaseCodeNode != null) { species.combaseCode = combaseCodeNode.InnerText; } // detail XmlElement detailNode = (XmlElement)metadataNode.SelectSingleNode(SbmlTags.PMMLAB_NS + ":" + SbmlTags.DETAIL); if (detailNode != null) { species.detail = detailNode.InnerText; } // description XmlElement descriptionNode = (XmlElement)metadataNode.SelectSingleNode(SbmlTags.PMMLAB_NS + ":" + SbmlTags.DESCRIPTION); if (descriptionNode != null) { species.description = descriptionNode.InnerText; } } return(species); }
public ConcentrationOntology(XmlNode node) { XmlNode annotationNode = node.SelectSingleNode(NuMLTags.ANNOTATION); // retrieves unitDefinition XmlElement unitNode = (XmlElement)annotationNode.SelectSingleNode(NuMLTags.UNIT_DEFINITION); UnitDefinitionNuMLNode unitNuMLNode = new UnitDefinitionNuMLNode(unitNode); unitDefinition = unitNuMLNode.ToPMFUnitDefinition(); // retrieves compartment XmlElement compartmentNode = (XmlElement)annotationNode.SelectSingleNode(NuMLTags.COMPARTMENT); CompartmentNuMLNode compartmentNuMLNode = new CompartmentNuMLNode(compartmentNode); compartment = compartmentNuMLNode.ToPMFCompartment(); // retrieves species XmlElement speciesNode = (XmlElement)annotationNode.SelectSingleNode(NuMLTags.SPECIES); SpeciesNuMLNode speciesNuMLNode = new SpeciesNuMLNode(speciesNode); species = speciesNuMLNode.toPMFSpecies(); }