Package org.sbml.jsbml

Examples of org.sbml.jsbml.CVTerm


    String rdfPrefix = rdfNamespaces.get(Annotation.URI_RDF_SYNTAX_NS);
    String whiteSpace = createIndentationString(indent);

    for (int i = 0; i < listOfCVTerms.size(); i++)
    {
      CVTerm cvTerm = listOfCVTerms.get(i);
      String namespaceURI = null;
      String prefix = null;
      String elementName = null;
   
      if (cvTerm == null || cvTerm.getResourceCount() == 0)
      {
        // No need to write a CVTerm without any resources/uris
        continue;
      }
     
      if (cvTerm.getQualifierType().equals(CVTerm.Type.BIOLOGICAL_QUALIFIER)) {
        namespaceURI = CVTerm.Type.BIOLOGICAL_QUALIFIER.getNamespaceURI();
        prefix = rdfNamespaces.get(namespaceURI);
        elementName = cvTerm.getBiologicalQualifierType()
            .getElementNameEquivalent();
      } else if (cvTerm.getQualifierType().equals(CVTerm.Type.MODEL_QUALIFIER)) {
        namespaceURI = cvTerm.getQualifierType().getNamespaceURI();
        prefix = rdfNamespaces.get(namespaceURI);
        elementName = Annotation
            .getElementNameEquivalentToQualifier(cvTerm
                .getModelQualifierType());
      }
      if ((namespaceURI != null) && (elementName != null)
          && (prefix != null))
      {
        writer.writeCharacters(whiteSpace + createIndentationString(indentCount));
        writer.writeStartElement(prefix, elementName, namespaceURI);
        writer.writeCharacters("\n");
       
        if (cvTerm.getResourceCount() > 0) {
          writer.writeCharacters(whiteSpace + createIndentationString(2 * indentCount));
          writer.writeStartElement(rdfPrefix, "Bag",
              Annotation.URI_RDF_SYNTAX_NS);
          writer.writeCharacters("\n");
         
          for (int j = 0; j < cvTerm.getResourceCount(); j++) {
            writer.writeCharacters(whiteSpace + createIndentationString(3 * indentCount));
            writer.writeStartElement(rdfPrefix, "li",
                Annotation.URI_RDF_SYNTAX_NS);
            writer.writeAttribute(rdfPrefix,
                Annotation.URI_RDF_SYNTAX_NS, "resource",
                cvTerm.getResourceURI(j));
            writer.writeEndElement();
            writer.writeCharacters("\n");
          }
          writer.writeCharacters(whiteSpace + createIndentationString(2 * indentCount));
          writer.writeEndElement();
 
View Full Code Here


  @Test public void checkHashCode() throws ParseException {
    SBMLDocument doc1 = new SBMLDocument(3, 1);
    Model model = doc1.createModel("test_model");
    Compartment c = model.createCompartment("c1");
    Species s = model.createSpecies("s1", c);
    s.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001"));
    Rule r = model.createAlgebraicRule();
    r.setMath(ASTNode.parseFormula("sin(3) + 1"));
   
    SBMLDocument doc2 = doc1.clone();
    try {
      (new SBMLWriter()).write(doc1, System.out);
      System.out.println("\n==================");
      (new SBMLWriter()).write(doc2, System.out);
    } catch (SBMLException e) {
      e.printStackTrace();
    } catch (XMLStreamException e) {
      e.printStackTrace();
    }
    assertTrue(doc1.hashCode() == doc2.hashCode());
    assertTrue(model.hashCode() != doc2.hashCode());
    assertTrue(s.getCVTerm(0).equals(new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")));
    assertTrue(s.getCVTerm(0).hashCode() == (new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:kegg.compound:C00001")).hashCode());
    assertTrue(doc1.equals(doc2));
    assertTrue(doc2.equals(doc1));
  }
View Full Code Here

    Parameter k2 = model.createParameter("k2");
   
    k1.setConstant(false);
    k2.setConstant(false);
   
    k1.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "test"));
   
    Event event = model.createEvent("test_event");
   
    Trigger trigger = event.createTrigger();
//    trigger.setMath(ASTNode.geq(new ASTNode(ASTNode.Type.NAME_TIME),
View Full Code Here

    SBMLDocument doc = new SBMLDocument(2, 4);
    doc.setNotes("<body>Senseless test commentar</body>");

    Model m = doc.createModel("model");

    CVTerm term = new CVTerm();
    term.setQualifierType(Type.MODEL_QUALIFIER);
    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");
View Full Code Here

  }
 
  /** Public get SBOTerm string */
  private String getSBOTermString(String sboTerm){
    String text = "<p>";
    CVTerm term = new CVTerm(CVTerm.Qualifier.BQB_IS, "urn:miriam:biomodels.sbo:" + sboTerm);
    text += String.format("<b><span color=\"green\">%s</span></b><br>", sboTerm);
    for (String rURI : term.getResources()){
      text += MiriamResourceInfo.getInfoFromMiriamResource(link, rURI);
    }
    text += "</p>";
    return text;
  }
View Full Code Here

  }

  @Test
  public void test_CVTerm_addResource()
  {
    CVTerm term = new  CVTerm(); // TODO : difference to document => CVTerm term = new  CVTerm(CVTerm.Type.MODEL_QUALIFIER); constructor does not exist
    term.setQualifierType(CVTerm.Type.MODEL_QUALIFIER);   
    String resource =  "GO6666";
    assertTrue( term != null );
    assertTrue( term.getQualifierType() == CVTerm.Type.MODEL_QUALIFIER ); // TODO : difference to document ==> CVTerm.Type.MODEL_QUALIFIER
    term.addResource(resource);
    List<String> xa = term.getResources(); // TODO : difference to document ==> term.getResources(); does not return XMLAttributes but a List<String>
    assertTrue( xa.size() == 1 );
    // assertTrue(xa.getName(0).equals( "rdf:resource"));
    assertTrue(xa.get(0).equals( "GO6666"));
    term = null;
  }
View Full Code Here

    term = null;
  }

  @Test public void test_CVTerm_create()
  {
    CVTerm term = new  CVTerm();
    term.setQualifierType(CVTerm.Type.MODEL_QUALIFIER)
    assertTrue( term != null );
    assertTrue( term.getQualifierType() == CVTerm.Type.MODEL_QUALIFIER );
    term = null;
  }
View Full Code Here

  }
  */

  @Test public void test_CVTerm_getResources()
  {
    CVTerm term = new  CVTerm();
    term.setQualifierType(CVTerm.Type.MODEL_QUALIFIER);
    String resource =  "GO6666";
    String resource1 =  "OtherURI";
    long number;
    term.addResource(resource);
    term.addResource(resource1);
    number = term.getNumResources();
    assertTrue( number == 2 );
    assertTrue(term.getResourceURI(0).equals( "GO6666"));
    assertTrue(term.getResourceURI(1).equals( "OtherURI"));
    term = null;
  }
View Full Code Here

    term = null;
  }

  @Test public void test_CVTerm_set_get()
  {
    CVTerm term = new  CVTerm();
    term.setQualifierType(CVTerm.Type.MODEL_QUALIFIER);
    assertTrue( term != null );
    assertTrue( term.getQualifierType() == CVTerm.Type.MODEL_QUALIFIER );
    term.setModelQualifierType(CVTerm.Qualifier.BQM_IS); // TODO : difference to document ==> libsbml.BQM_IS become
    assertTrue( term != null );
    assertTrue( term.getQualifierType() == CVTerm.Type.MODEL_QUALIFIER );
    assertTrue( term.getModelQualifierType() == CVTerm.Qualifier.BQM_IS );
    term.setQualifierType(CVTerm.Type.BIOLOGICAL_QUALIFIER);
    term.setBiologicalQualifierType(CVTerm.Qualifier.BQB_IS);
    assertTrue( term.getQualifierType() == CVTerm.Type.BIOLOGICAL_QUALIFIER );
    assertTrue( term.getBiologicalQualifierType() == CVTerm.Qualifier.BQB_IS );
    term = null;
  }
View Full Code Here

    Species s1 = model.createSpecies("s1", model.createCompartment("c1"));
    s1.setMetaId("meta_" + s1.getId());
    // Not necessary anymore.
    // s1.getAnnotation().addRDFAnnotationNamespace("bqbiol", "",
    // "http://biomodels.net/biology-qualifiers/");
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        CVTerm.Qualifier.BQB_HAS_PART, "urn:miriam:obo.chebi:CHEBI:15422"));
    System.out.println("==================================");
    new SBMLWriter().write(doc, System.out);
    new JTreeOfSBML(doc);
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.CVTerm

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.