Examples of CvTerm


Examples of org.sbml.jsbml.CVTerm

   *
   * @see org.sbml.jsbml.util.Filter#accepts(java.lang.Object)
   */
  public boolean accepts(Object o) {
    if (o instanceof CVTerm) {
      CVTerm cvt = (CVTerm) o;
      if (qualifier != null) {
        if (cvt.isBiologicalQualifier()
            && (cvt.getBiologicalQualifierType() == qualifier)) {
          return pattern != null ? cvt.filterResources(pattern)
              .size() > 0 : true;
        } else if (cvt.isModelQualifier()
            && cvt.getModelQualifierType() == qualifier) {
          return pattern != null ? cvt.filterResources(pattern)
              .size() > 0 : true;
        }
      } else if (pattern != null) {
        return cvt.filterResources(pattern).size() > 0;
      }
    } else if (o instanceof SBase) {
      SBase sbase = (SBase) o;
      if (qualifier != null) {
        if (pattern != null) {
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

    // 'li' subelement of the 'Bag' subelement of the 'Miriam-Qualifier' node.
    // When this parser is parsing the rdf annotation, some rdf attributes can appear. Try to
    // read them.
    else if (contextObject instanceof CVTerm && previousElements.containsKey("CVTerm")){
      if (previousElements.get("CVTerm").equals("li")){
        CVTerm cvterm = (CVTerm) contextObject;
        isReadAttribute = cvterm.readAttribute(elementName, attributeName, prefix, value);
      }
    }
   
    if (!isReadAttribute){
      logger.warn("RDFAnnotationParser : processAttribute : found an unknown attribute '" +
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

    Compartment c = model.createCompartment("c");
    c.setSize(4.3);
    c.setSBOTerm(SBO.getPhysicalCompartment());

    Species s1 = model.createSpecies("s1", c);
    s1.addCVTerm(new CVTerm(CVTerm.Type.BIOLOGICAL_QUALIFIER,
        Qualifier.BQB_IS, "urn:miriam:kegg.compound:C12345"));
    s1.setValue(23.7);
    model.removeSpecies(s1);

    try {
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

      // This parser can parse only model Miriam qualifiers. This element should not have attributes or namespace declarations.
      // Creates a new CVTerm and
      // sets the qualifierType and modelQualifierType of this CVTerm. Then, adds the
      // initialised CVTerm to annotation.
      if (modelQualifierMap.containsKey(elementName) && !hasNamespaces && !hasAttributes){
        CVTerm cvTerm = new CVTerm();
        cvTerm.setQualifierType(Type.MODEL_QUALIFIER);
        cvTerm.setModelQualifierType(modelQualifierMap.get(elementName));
       
        annotation.addCVTerm(cvTerm);
        return cvTerm;
      }
      else {
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

    Model model = doc.createModel("test_model");
   
    Parameter k1 = model.createParameter("k1");
    Parameter k2 = model.createParameter("k2");

    k1.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "test"));
   
    k1.setConstant(false);
    k2.setConstant(false);
   
    Event event = model.createEvent("test_event");
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

    // 'li' subelement of the 'Bag' subelement of the 'Miriam-Qualifier' node.
    // When this parser is parsing the rdf annotation, some rdf attributes can appear. Try to
    // read them.
    else if (contextObject instanceof CVTerm && previousElements.containsKey("CVTerm")){
      if (previousElements.get("CVTerm").equals("li")){
        CVTerm cvterm = (CVTerm) contextObject;
        isReadAttribute = cvterm.readAttribute(elementName, attributeName, prefix, value);
      }
    }
   
    if (!isReadAttribute){
      logger.warn("RDFAnnotationParser : processAttribute : found an unknown attribute '" +
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

      Model m2 = new Model("model1", 2, 4);
     
      Species s1 = m.createSpecies("id1");
     
      Annotation annotation = new Annotation();
      CVTerm cvterm = new CVTerm();
      cvterm.addResource("urn.miriam.obo.go#GO%3A1234567");
      cvterm.setQualifierType(Type.BIOLOGICAL_QUALIFIER);
      cvterm.setBiologicalQualifierType(Qualifier.BQB_IS);
     
      annotation.addCVTerm(cvterm);
     
      System.out.println("The Annotation is still empty as there is no metaid defined on the species !!");
      System.out.println("@" + s1.getAnnotationString() + "@");
     
      s1.setMetaId("meta4");
      s1.setAnnotation(annotation);
     
      System.out.println("After adding a metaid on the species, the Annotation String get generated as it should.");
      System.out.println("@" + s1.getAnnotationString() + "@");
     


      String urn_id = "C00001";
     
      Species specie = m2.createSpecies();
      specie.setId("S2");
      specie.setName("S2");
      // specie.setCompartment(compartment);
      specie.setInitialAmount(1);

      annotation = new Annotation();
      CVTerm cvTerm = new CVTerm(Qualifier.BQB_IS);
      cvTerm.setQualifierType(Type.BIOLOGICAL_QUALIFIER);
     
      if(urn_id.startsWith("C"))
      {
      cvTerm.addResource("urn:miriam:kegg.compound:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("http://www.genome.jp/dbget-bin/www_bget?cpd:"+urn_id);
      }
     
      if(urn_id.startsWith("G"))
      {
      cvTerm.addResource("urn:miriam:kegg.glycan:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("<myApp:xxx>http://www.genome.jp/dbget-bin/www_bget?gl:"+urn_id + "</myApp:xxx>");
      }
     
      if (urn_id.contains("."))
      {
      cvTerm.addResource("urn:miriam:ec-code:" + urn_id);
      annotation.addCVTerm(cvTerm);
      annotation.appendNoRDFAnnotation("http://www.genome.jp/dbget-bin/www_bget?ec:"+urn_id);
      }

      System.out.println("The Annotation is still empty as there is no metaid defined on the species !!");
View Full Code Here

Examples of org.sbml.jsbml.CVTerm

      int indent) throws XMLStreamException {
    String rdfPrefix = rdfNamespaces.get(Annotation.URI_RDF_SYNTAX_NS);
    String whiteSpace = createIndentationString(indent);
    if (listOfCVTerms.size() > 0) {
      for (int i = 0; i < listOfCVTerms.size(); i++) {
        CVTerm cvTerm = listOfCVTerms.get(i);
        String namespaceURI = null;
        String prefix = null;
        String elementName = null;
        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.getNumResources() > 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.getNumResources(); 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

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.getNumResources() == 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.getNumResources() > 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.getNumResources(); 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

Examples of org.sbml.jsbml.CVTerm

      // This parser can parse only model Miriam qualifiers. This element should not have attributes or namespace declarations.
      // Creates a new CVTerm and
      // sets the qualifierType and modelQualifierType of this CVTerm. Then, adds the
      // initialised CVTerm to annotation.
      if (modelQualifierMap.containsKey(elementName) && !hasNamespaces && !hasAttributes){
        CVTerm cvTerm = new CVTerm();
        cvTerm.setQualifierType(Type.MODEL_QUALIFIER);
        cvTerm.setModelQualifierType(modelQualifierMap.get(elementName));
       
        annotation.addCVTerm(cvTerm);
        return cvTerm;
      }
      else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.