Package org.sbml.jsbml

Examples of org.sbml.jsbml.Annotation


    // an AnnotationParser can only be used for the annotations of a SBML
    // component. If the contextObject is not
    // an Annotation instance, this parser doesn't process any texts.
    if (contextObject instanceof Annotation) {
      Annotation annotation = (Annotation) contextObject;
      annotation.appendNoRDFAnnotation(characters);

    } else if (characters.trim().length() > 0) {
      // There is a syntax error, the text can't be read?
      logger.warn("some characters migth be lost !! (element name = " + elementName + ", characters = " + characters + ", context = " + contextObject);      
    } else {
View Full Code Here


   
    // an AnnotationParser can only be used for the annotations of a SBML
    // component. If the contextObject is not
    // an Annotation instance, this parser doesn't process any elements.
    if (contextObject instanceof Annotation) {
      Annotation annotation = (Annotation) contextObject;
      StringBuilder builder = annotation.getAnnotationBuilder();

      // If the element is nested, we need to remove the default ending
      // tag of the element.
      if (isNested && annotation.getNonRDFannotation().endsWith(">")) {
        int builderLength = builder.length();
        builder.delete(builderLength - 3, builderLength);
      }

      // If the element is nested, we need to add a nested element ending
      // tag.
      if (isNested) {
        annotation.appendNoRDFAnnotation("/>");
      }
      // else, write a entire ending tag with the name of the element
      // (Store the prefix too into the String).
      else {
        if (!prefix.equals("")) {
          annotation.appendNoRDFAnnotation("</" + prefix + ":"
              + elementName + ">");
        } else {
          annotation.appendNoRDFAnnotation("</" + elementName
              + ">");
        }
      }
    } else {
      // There is a syntax error, the node can't be read?
View Full Code Here

    // If the element is an annotation and the contextObject is an
    // Annotation instance,
    // we need to add the namespace to the 'annotationNamespaces' HashMap of
    // annotation.
    if (contextObject instanceof Annotation) {
      Annotation annotation = (Annotation) contextObject;

      if (prefix.trim().length() == 0) {
        annotation.appendNoRDFAnnotation(" " + localName + "=\"" + URI + "\"");
      } else {
        annotation.appendNoRDFAnnotation(" " + prefix + ":" + localName + "=\"" + URI + "\"");
      }
      annotation.appendNoRDFAnnotation("");
     
     
      // If the attribute is the last attribute of its element, we need to
      // close the element tag.
      if (isLastNamespace && !hasAttributes) {
        annotation.appendNoRDFAnnotation(">");
      }
    }
    // If the namespaces are declared in the sbml node, we need to add the
    // namespace to
    // the 'SBMLDocumentNamespaces' map of the SBMLDocument instance.
View Full Code Here

    // an AnnotationParser can only be used for the annotations of a SBML
    // component. If the contextObject is not
    // an Annotation instance, this parser doesn't process any elements.
    if (contextObject instanceof Annotation) {

      Annotation annotation = (Annotation) contextObject;

      // If there is a prefix, the AnnotationParser will also store the
      // prefix within the key
      // and appends the element to the 'otherAnnotation' String of
      // annotation.
      if (!prefix.equals("")) {
        annotation.appendNoRDFAnnotation("<" + prefix + ":"
            + elementName);
      } else {
        annotation.appendNoRDFAnnotation("<" + elementName);
      }

      // If the element has no attributes and namespaces, we need to close
      // the element tag.
      if (!hasAttributes && !hasNamespaces) {
        annotation.appendNoRDFAnnotation(">");
      }
      return annotation;
    } else {
      // There is a syntax error, the node can't be read ?
      logger.error(String.format("Cannot read the element %s as the context object is not of the type Annotation", elementName));
View Full Code Here

    boolean isReadAttribute = false;

    // A RDFAnnotationParser can modify a contextObject which is an Annotation instance.
    // The annotation element can contain other attributes. Try to read them.
    if (contextObject instanceof Annotation){
      Annotation modelAnnotation = (Annotation) contextObject;
      isReadAttribute = modelAnnotation.readAttribute(attributeName, prefix, value);
    }
    // A RDFAnnotationParser can modify a contextObject which is an ModelHistory instance.
    // When this parser is parsing the model history, some rdf attributes can appear. Try to
    // read them.
    else if (contextObject instanceof History){
View Full Code Here

      String localName, boolean hasAttributes, boolean isLastNamespace,
      Object contextObject) {

    // Adds the namespace to the RDFAnnotationNamespaces HashMap of annotation.
    if (elementName.equals("RDF") && contextObject instanceof Annotation){
      Annotation annotation = (Annotation) contextObject;
      annotation.addRDFAnnotationNamespace(localName, prefix, URI);;
    }
  }
View Full Code Here

    // The namespace of this parser should be declared in a 'RDF' subnode of
    // annotation.
    // Adds the namespace to RDFAnnotationNamespaces HashMap of annotation.
    if (elementName.equals("RDF") && contextObject instanceof Annotation) {
      Annotation annotation = (Annotation) contextObject;

      annotation.addRDFAnnotationNamespace(localName, prefix, URI);
    }
  }
View Full Code Here

      Object contextObject) {
   
    // The namespace of this parser should be declared in the RDF subnode of the annotation.
    // Adds the namespace to the RDFAnnotationNamespaces HashMap of annotation.
    if (elementName.equals("RDF") && contextObject instanceof Annotation){
      Annotation annotation = (Annotation) contextObject;
     
      annotation.addRDFAnnotationNamespace(localName, prefix, URI);
    }
  }
View Full Code Here

      boolean hasAttributes, boolean hasNamespaces,
      Object contextObject) {

    // A ModelQualifierParser can only modify a contextObject which is an instance of Annotation.
    if (contextObject instanceof Annotation){
      Annotation annotation = (Annotation) contextObject;
     
      // 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 {
        // TODO : SBML syntax error, throw an exception?
      }
View Full Code Here

      Object contextObject) {
   
    // The namespace of this parser is declared in a RDF subnode of an annotation.
    // adds the namespace to the RDFAnnotationNamespaces HashMap of annotation.
    if (elementName.equals("RDF") && contextObject instanceof Annotation){
      Annotation annotation = (Annotation) contextObject;
     
      annotation.addRDFAnnotationNamespace(localName, prefix, URI);
    }
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Annotation

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.