Package org.sbml.jsbml

Examples of org.sbml.jsbml.Creator


    // tag.
    if (elementName != null) {
      // A VCardParser can only modify a contextObject which is a
      // Creator instance.
      if (contextObject instanceof Creator) {
        Creator creator = (Creator) contextObject;

        // Sets the familyName String of modelCreator.
        if (elementName.equals("Family") && hasReadFamilyName) {
          creator.setFamilyName(characters);
        }
        // Sets the givenName String of modelCreator.
        else if (elementName.equals("Given") && hasReadGivenName) {
          creator.setGivenName(characters);
        }
        // Sets the email String of modelCreator.
        else if (elementName.equals("EMAIL") && hasReadEMAIL) {
          creator.setEmail(characters);
        }
        // Sets the orgname String of modelCreator.
        else if (elementName.equals("Orgname") && hasReadOrgName) {
          creator.setOrganisation(characters);
        } else if (!elementName.equals("ORG") && !elementName.equals("N")) {
          // Storing additional VCard elements in a map to write them back
         
          creator.setOtherAttribute(elementName, characters);
        }
      } else {
        logger.warn("Lost Information: the characters '" + characters + "' on the element '" + elementName + "' might be lost"
            + " as the context object is not a Creator.");
      }
View Full Code Here


  }

  @Test
  public void test_Model_setgetModelHistory() {
    History history = new History();
    Creator mc = new Creator();
    Date date = Calendar.getInstance().getTime();
    mc.setFamilyName("Keating");
    mc.setGivenName("Sarah");
    mc.setEmail("sbml-team@caltech.edu");
    mc.setOrganisation("UH");
    history.addCreator(mc);
    history.setCreatedDate(date);
    history.setModifiedDate(date);
    assertTrue(M.isSetHistory() == false);
    M.setHistory(history);
    assertTrue(M.isSetHistory() == true);
    Creator newMC = history.getCreator(0);
    assertTrue(newMC != null);
    assertTrue(newMC.getFamilyName().equals("Keating"));
    assertTrue(newMC.getGivenName().equals("Sarah"));
    assertTrue(newMC.getEmail().equals("sbml-team@caltech.edu"));
    assertTrue(newMC.getOrganisation().equals("UH"));
    M.unsetHistory();
    assertTrue(M.isSetHistory() == false);
    history = null;
    mc = null;
  }
View Full Code Here

    // 'li' subelement of the 'Bag' subelement of the 'creator' node.
    // When this parser is parsing the model history, some rdf attributes can appear. Try to
    // read them.
    else if (contextObject instanceof Creator && previousElements.containsKey("creator")) {
      if (previousElements.get("creator").equals("li")) {
        Creator modelCreator = (Creator) contextObject;
        isReadAttribute = modelCreator.readAttribute(elementName, attributeName, prefix, value);
      }
    }
    // A RDFAnnotationParser can modify a contextObject which is an CVTerm instance.
    // If the contextObject is a CVTerm instance, the rdf attributes should appear in the
    // 'li' subelement of the 'Bag' subelement of the 'Miriam-Qualifier' node.
View Full Code Here

            // If the SBML specifications are respected, a new ModelCreator will be created
            // and added to the listOfCreators of modelHistory. In this case, it will return the new ModelCreator instance.
            else if (elementName.equals("li") && previousElements.containsKey("creator")) {
              if (previousElements.get("creator").equals("Bag")) {
                this.previousElements.put("creator", "li");
                Creator modelCreator = new Creator();
                modelHistory.addCreator(modelCreator)
                return modelCreator;
              }
              else {
                logger.warn("Syntax error in your RDF annotation");
View Full Code Here

      writer.writeStartElement(rdfPrefix, "Bag",
          Annotation.URI_RDF_SYNTAX_NS);
      writer.writeCharacters("\n");

      for (int i = 0; i < history.getCreatorCount(); i++) {
        Creator creator = history.getCreator(i);
        writer.writeCharacters(whiteSpace + createIndentationString(2 * indentCount));
        writer.writeStartElement(rdfPrefix, "li",
            Annotation.URI_RDF_SYNTAX_NS);
        writer.writeAttribute(rdfPrefix, Annotation.URI_RDF_SYNTAX_NS,
            "parseType", "Resource");
        String vCardPrefix = rdfNamespaces.get(Creator.URI_RDF_VCARD_NS);

        if (creator.isSetFamilyName()
            || creator.isSetGivenName()) {
          writer.writeCharacters("\n");
          writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
          writer.writeStartElement(vCardPrefix, "N",
              Creator.URI_RDF_VCARD_NS);
          writer.writeAttribute(Annotation.URI_RDF_SYNTAX_NS,
              "parseType", "Resource");
          writer.writeCharacters("\n");

          if (creator.isSetFamilyName()) {
            writer.writeCharacters(whiteSpace + createIndentationString(4 * indentCount));
            writer.writeStartElement(vCardPrefix, "Family",
                Creator.URI_RDF_VCARD_NS);
            writer.writeCharacters(creator.getFamilyName());
            writer.writeEndElement();
            writer.writeCharacters("\n");
          }
          if (creator.isSetGivenName()) {
            writer.writeCharacters(whiteSpace + createIndentationString(4 * indentCount));
            writer.writeStartElement(vCardPrefix, "Given",
                Creator.URI_RDF_VCARD_NS);
            writer.writeCharacters(creator.getGivenName());
            writer.writeEndElement();
            writer.writeCharacters("\n");
          }
          writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
          writer.writeEndElement();
        }
        writer.writeCharacters("\n");

        if (creator.isSetEmail()) {
          writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
          writer.writeStartElement(vCardPrefix, "EMAIL",
              Creator.URI_RDF_VCARD_NS);
          writer.writeCharacters(creator.getEmail());
          writer.writeEndElement();
          writer.writeCharacters("\n");
        }
        if (creator.isSetOrganisation()) {
          writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
          writer.writeStartElement(vCardPrefix, "ORG",
              Creator.URI_RDF_VCARD_NS);
          writer.writeAttribute(rdfPrefix,
              Annotation.URI_RDF_SYNTAX_NS, "parseType",
              "Resource");
          writer.writeCharacters("\n");
          writer.writeCharacters(whiteSpace + createIndentationString(4 * indentCount));
          writer.writeStartElement(vCardPrefix, "Orgname",
              Creator.URI_RDF_VCARD_NS);
          writer.writeCharacters(creator.getOrganisation());
          writer.writeEndElement();
          writer.writeCharacters("\n");
          writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
          writer.writeEndElement();
          writer.writeCharacters("\n");
        }
        // adding any additional element/value
        if (creator.isSetOtherAttributes()) {
          for (String elementName : creator.getOtherAttributes().keySet()) {
            String characters = creator.getOtherAttribute(elementName);
           
            writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
            writer.writeStartElement(vCardPrefix, elementName, Creator.URI_RDF_VCARD_NS);
            writer.writeCharacters(characters);
            writer.writeEndElement();
View Full Code Here

       
    SBMLDocument doc = new SBMLDocument(2, 4);
    doc.addTreeNodeChangeListener(new SimpleTreeNodeChangeListener());
    Model model = doc.createModel("test_model");
   
    Creator c = new Creator("Hans", "Wurst",
      "Institute for Interesting Biology", "ovidiu.radulescu@univ-rennes1.fr");
    History h = new History();
    h.addCreator(c);
    model.setHistory(h);
//    model.appendNotes("This is a very interesting model.");
View Full Code Here

    term.setModelQualifierType(Qualifier.BQM_IS);
    term.addResource("urn:miriam:kegg.pathway:hsa00010");
    m.addCVTerm(term);

    History history = new History();
    Creator creator = new Creator();
    creator.setFamilyName("Dr\u00e4ger");
    creator.setGivenName("Andreas");
    creator.setEmail("andreas.draeger@uni-tuebingen.de");
    creator.setOrganization("Universit\u00e4t T\u00fcbingen");
    history.addCreator(creator);
    history.setCreatedDate(Calendar.getInstance().getTime());
    history.addModifiedDate(Calendar.getInstance().getTime());
    m.setHistory(history);
View Full Code Here

  }

  @Test
  public void test_Model_setgetModelHistory() {
    History history = new History();
    Creator mc = new Creator();
    Date date = Calendar.getInstance().getTime();
    mc.setFamilyName("Keating");
    mc.setGivenName("Sarah");
    mc.setEmail("sbml-team@caltech.edu");
    mc.setOrganisation("UH");
    history.addCreator(mc);
    history.setCreatedDate(date);
    history.setModifiedDate(date);
    assertTrue(M.isSetHistory() == false);
    M.setHistory(history);
    assertTrue(M.isSetHistory() == true);
    Creator newMC = history.getCreator(0);
    assertTrue(newMC != null);
    assertTrue(newMC.getFamilyName().equals("Keating"));
    assertTrue(newMC.getGivenName().equals("Sarah"));
    assertTrue(newMC.getEmail().equals("sbml-team@caltech.edu"));
    assertTrue(newMC.getOrganisation().equals("UH"));
    M.unsetHistory();
    assertTrue(M.isSetHistory() == false);
    history = null;
    mc = null;
  }
View Full Code Here

    term.setModelQualifierType(Qualifier.BQM_IS);
    term.addResource("urn:miriam:kegg.pathway:hsa00010");
    m.addCVTerm(term);

    History history = new History();
    Creator creator = new Creator();
    creator.setFamilyName("Dr\u00e4ger");
    creator.setGivenName("Andreas");
    creator.setEmail("andreas.draeger@uni-tuebingen.de");
    creator.setOrganization("Universit\u00e4t T\u00fcbingen");
    history.addCreator(creator);
    history.setCreatedDate(Calendar.getInstance().getTime());
    history.addModifiedDate(Calendar.getInstance().getTime());
    m.setHistory(history);
View Full Code Here

    // tag.
    if (elementName != null) {
      // A VCardParser can only modify a contextObject which is a
      // ModelCreator instance.
      if (contextObject instanceof Creator) {
        Creator modelCreator = (Creator) contextObject;

        // Sets the familyName String of modelCreator.
        if (elementName.equals("Family") && hasReadFamilyName) {
          modelCreator.setFamilyName(characters);
        }
        // Sets the givenName String of modelCreator.
        else if (elementName.equals("Given") && hasReadGivenName) {
          modelCreator.setGivenName(characters);
        }
        // Sets the email String of modelCreator.
        else if (elementName.equals("EMAIL") && hasReadEMAIL) {
          modelCreator.setEmail(characters);
        }
        // Sets the orgname String of modelCreator.
        else if (elementName.equals("Orgname") && hasReadOrgName) {
          modelCreator.setOrganisation(characters);
        } else {
          // TODO : SBML syntax error, throw an exception?
        }
      } else {
        // TODO : SBML syntax error, throw an exception?
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Creator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.