Inheritance: XMLToken
Example #1
0
 public void test_Node_clone()
 {
     XMLAttributes att = new XMLAttributes();
       XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       XMLToken token = new XMLToken(t,att,3,4);
       XMLNode node = new XMLNode(token);
       XMLNode child = new XMLNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getName() ==  "sarah" );
       assertTrue( node.getURI() ==  "http://foo.org/" );
       assertTrue( node.getPrefix() ==  "bar" );
       assertTrue( node.isEnd() == false );
       assertTrue( node.isEOF() == false );
       assertTrue( node.getLine() == 3 );
       assertTrue( node.getColumn() == 4 );
       XMLNode node2 = (XMLNode) node.clone();
       assertTrue( node2.getNumChildren() == 1 );
       assertTrue( node2.getName() ==  "sarah" );
       assertTrue( node2.getURI() ==  "http://foo.org/" );
       assertTrue( node2.getPrefix() ==  "bar" );
       assertTrue( node2.isEnd() == false );
       assertTrue( node2.isEOF() == false );
       assertTrue( node2.getLine() == 3 );
       assertTrue( node2.getColumn() == 4 );
       t = null;
       token = null;
       node = null;
       node2 = null;
 }
 public void test_XMLNode_addChild1()
 {
     XMLNode node = new XMLNode();
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       node = null;
       node2 = null;
 }
 public void test_XMLNode_addChild3()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLNode node = new XMLNode(triple);
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
       assertTrue( node.getNumChildren() == 0 );
       triple = null;
       node = null;
       node2 = null;
 }
Example #4
0
        internal static HandleRef getCPtrAndDisown(XMLNode obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
                ptr             = obj.swigCPtr;
                obj.swigCMemOwn = false;
            }

            return(ptr);
        }
Example #5
0
 public void test_ASTNode_addSemanticsAnnotation()
 {
     XMLNode ann = new XMLNode();
       ASTNode node = new  ASTNode();
       int i = 0;
       i = node.addSemanticsAnnotation(ann);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumSemanticsAnnotations() == 1 );
       i = node.addSemanticsAnnotation(null);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( node.getNumSemanticsAnnotations() == 1 );
       node = null;
 }
 public void test_XMLNode_addChild2()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       triple = null;
       attr = null;
       node = null;
       node2 = null;
 }
Example #7
0
 public void test_SyntaxChecker_validXHTML()
 {
     XMLToken token;
       XMLNode node;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken tt = new  XMLToken("This is my text");
       XMLNode n1 = new XMLNode(tt);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
       triple = new  XMLTriple("html", "", "");
       ns.clear();
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
 }
Example #8
0
 public void test_CVTerm_createFromNode()
 {
     XMLAttributes xa;
       XMLTriple qual_triple = new  XMLTriple("is", "", "bqbiol");
       XMLTriple bag_triple = new  XMLTriple();
       XMLTriple li_triple = new  XMLTriple();
       XMLAttributes att = new  XMLAttributes();
       att.add( "", "This is my resource");
       XMLAttributes att1 = new  XMLAttributes();
       XMLToken li_token = new  XMLToken(li_triple,att);
       XMLToken bag_token = new  XMLToken(bag_triple,att1);
       XMLToken qual_token = new  XMLToken(qual_triple,att1);
       XMLNode li = new XMLNode(li_token);
       XMLNode bag = new XMLNode(bag_token);
       XMLNode node = new XMLNode(qual_token);
       bag.addChild(li);
       node.addChild(bag);
       CVTerm term = new  CVTerm(node);
       assertTrue( term != null );
       assertTrue( term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER );
       assertTrue( term.getBiologicalQualifierType() == libsbml.BQB_IS );
       xa = term.getResources();
       assertTrue( xa.getLength() == 1 );
       assertTrue((  "rdf:resource" == xa.getName(0) ));
       assertTrue((  "This is my resource" == xa.getValue(0) ));
       qual_triple = null;
       bag_triple = null;
       li_triple = null;
       li_token = null;
       bag_token = null;
       qual_token = null;
       att = null;
       att1 = null;
       term = null;
       node = null;
       bag = null;
       li = null;
 }
 public void test_XMLNode_removeNamespaces()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNamespaces nms;
       int i = node.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.addNamespace( "http://test2.org/", "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(7);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace( "name7");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.removeNamespace( "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 0 );
       triple = null;
       attr = null;
       node = null;
 }
        static XMLNode deleteRDFHistoryAnnotation(XMLNode annotation)
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_deleteRDFHistoryAnnotation(XMLNode.getCPtr(annotation));
            XMLNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNode(cPtr, false);

            return(ret);
        }
Example #11
0
 public ModelCreator(XMLNode creator)
     : this(libsbmlPINVOKE.new_ModelCreator__SWIG_1(XMLNode.getCPtr(creator)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Example #12
0
        XMLNode getChild(string name)
        {
            XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_2(swigCPtr, name), false);

            return(ret);
        }
Example #13
0
        static bool hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns)
        {
            bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_0(XMLNode.getCPtr(xhtml), SBMLNamespaces.getCPtr(sbmlns));

            return(ret);
        }
Example #14
0
 /**
    * Replaces the given top-level element within the 'annotation'
    * subelement of this SBML object and with the annotation element supplied.
    *
    * SBML places a few restrictions on the organization of the content of
    * annotations; these are intended to help software tools read and write
    * the data as well as help reduce conflicts between annotations added by
    * different tools.  Please see the SBML specifications for more details.
    *
    * This method determines the name of the element to be replaced from the
    * annotation argument. Functionally it is equivalent to calling <code>
    * removeTopLevelAnnotationElement(name)</code> followed by calling
    * <code>appendAnnotation(annotation_with_name)</code>, with the exception
    * that the placement of the annotation element remains the same.
    *
    * @param annotation XMLNode representing the replacement top level annotation
    *
    *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    *
    * @see removeTopLevelAnnotationElement(string elementName, string elementURI, bool removeEmpty)
    * @see replaceTopLevelAnnotationElement(string)
    */
 public int replaceTopLevelAnnotationElement(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.SBase_replaceTopLevelAnnotationElement__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
Example #15
0
        XMLNode insertChild(long n, XMLNode node)
        {
            XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_insertChild(swigCPtr, n, XMLNode.getCPtr(node)), false);

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId, XMLInputStream stream)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_4(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId, XMLInputStream.getCPtr(stream));
 }
Example #17
0
 public void test_SBase_appendNotes()
 {
     XMLToken token;
       XMLNode node;
       XMLToken token1;
       XMLNode node1;
       XMLNode node2;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken token4 = new  XMLToken("This is my text");
       XMLNode node4 = new XMLNode(token4);
       XMLToken token5 = new  XMLToken("This is additional text");
       XMLNode node5 = new XMLNode(token5);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(node4);
       S.setNotes(node);
       assertTrue( S.isSetNotes() == true );
       token1 = new  XMLToken(triple,att,ns);
       node1 = new XMLNode(token1);
       node1.addChild(node5);
       S.appendNotes(node1);
       assertTrue( S.isSetNotes() == true );
       node2 = S.getNotes();
       assertTrue( node2.getNumChildren() == 2 );
       assertTrue((  "p" == node2.getChild(0).getName() ));
       assertTrue( node2.getChild(0).getNumChildren() == 1 );
       assertTrue((  "p" == node2.getChild(1).getName() ));
       assertTrue( node2.getChild(1).getNumChildren() == 1 );
       string chars1 = node2.getChild(0).getChild(0).getCharacters();
       string chars2 = node2.getChild(1).getChild(0).getCharacters();
       assertTrue((  "This is my text" == chars1 ));
       assertTrue((  "This is additional text" == chars2 ));
       node = null;
       node1 = null;
 }
 /**
    * Deletes any SBML MIRIAM RDF 'History' annotation found in the given
    * XMLNode tree and returns
    * any remaining annotation content.
    *
    * The name of the XMLNode given as parameter @p annotation must be
    * 'annotation', or else this method returns @c null.  The method will
    * walk down the XML structure looking for elements that are in the
    * RDF XML namespace, and remove any that conform to the syntax of a
    * History element.
    *
    * @param annotation the XMLNode tree within which the RDF annotation is
    * to be found and deleted
    *
    * @return the XMLNode structure that is left after RDF annotations are
    * deleted.
    *
    * @if notclike @note Because this is a @em static method, the non-C++
    * language interfaces for libSBML will contain two variants.  One will
    * be a static method on the class (i.e., RDFAnnotationParser), and the
    * other will be a standalone top-level function with the name
    * RDFAnnotationParser_deleteRDFAnnotation(). They are functionally
    * identical. @endif
    */
 public static XMLNode deleteRDFHistoryAnnotation(XMLNode annotation)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_deleteRDFHistoryAnnotation(XMLNode.getCPtr(annotation));
     XMLNode ret = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, false);
     return ret;
 }
 /**
    * Parses an annotation into a ModelHistory class instance.
    *
    * This is used to take an annotation that has been read into an SBML
    * model, identify the RDF elements representing model history
    * information, and create a list of corresponding CVTerm objects.
    *
    * @param annotation XMLNode containing the annotation.
    * @param stream optional XMLInputStream that facilitates error logging
    * @param metaId optional metaId, if set only the rdf annotation for this metaId will be returned.
    *
    * @if notclike @note Because this is a @em static method, the non-C++
    * language interfaces for libSBML will contain two variants.  One will
    * be a static method on the class (i.e., RDFAnnotationParser), and the
    * other will be a standalone top-level function with the name
    * RDFAnnotationParser_parseRDFAnnotation(). They are functionally
    * identical. @endif
    *
    * @return a pointer to the ModelHistory created.
    */
 public static ModelHistory parseRDFAnnotation(XMLNode annotation, string metaId, XMLInputStream stream)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_0(XMLNode.getCPtr(annotation), metaId, XMLInputStream.getCPtr(stream));
     ModelHistory ret = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);
     return ret;
 }
Example #20
0
 public void test_WriteSBML_Constraint_full()
 {
     D.setLevelAndVersion(2,2,false);
       string expected = "<constraint sboTerm=\"SBO:0000064\">\n" +
     "  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "    <apply>\n" +
     "      <leq/>\n" +
     "      <ci> P1 </ci>\n" +
     "      <ci> t </ci>\n" +
     "    </apply>\n" +
     "  </math>\n" +
     "  <message>\n" +
     "    <p xmlns=\"http://www.w3.org/1999/xhtml\"> Species P1 is out of range </p>\n" +
     "  </message>\n" +
     "</constraint>";
       Constraint c = D.createModel().createConstraint();
       ASTNode node = libsbml.parseFormula("leq(P1,t)");
       c.setMath(node);
       c.setSBOTerm(64);
       XMLNode text = XMLNode.convertStringToXMLNode(" Species P1 is out of range ");
       XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", "");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces xmlns = new XMLNamespaces();
       xmlns.add("http://www.w3.org/1999/xhtml");
       XMLNode p = new XMLNode(triple,att,xmlns);
       p.addChild(text);
       XMLTriple triple1 = new XMLTriple("message", "", "");
       XMLAttributes att1 = new XMLAttributes();
       XMLNode message = new XMLNode(triple1,att1);
       message.addChild(p);
       c.setMessage(message);
       assertEquals( true, equals(expected,c.toSBML()) );
 }
Example #21
0
 /**
    * Appends the given @p notes to the 'notes' subelement of this object.
    *
    * The content of @p notes is copied.
    *
    * The optional SBML element named 'notes', present on every major SBML
    * component type, is intended as a place for storing optional
    * information intended to be seen by humans.  An example use of the
    * 'notes' element would be to contain formatted user comments about the
    * model element in which the 'notes' element is enclosed.  Every object
    * derived directly or indirectly from type SBase can have a separate
    * value for 'notes', allowing users considerable freedom when adding
    * comments to their models.
    *
    * The format of 'notes' elements must be <a target='_blank'
    * href='http://www.w3.org/TR/xhtml1/'>XHTML&nbsp;1.0</a>.  To help
    * verify the formatting of 'notes' content, libSBML provides the static
    * utility method SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif); however,
    * readers are urged to consult the appropriate <a target='_blank'
    * href='http://sbml.org/Documents/Specifications'>SBML specification
    * document</a> for the Level and Version of their model for more
    * in-depth explanations.  The SBML Level&nbsp;2 and &nbsp;3
    * specifications have considerable detail about how 'notes' element
    * content must be structured.
    *
    * @param notes an XML node structure that is to appended to the content
    * of the 'notes' subelement of this object
    *
    *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
    *
    * @see getNotesString()
    * @see isSetNotes()
    * @see setNotes(XMLNode notes)
    * @see setNotes(string notes, bool addXHTMLMarkup)
    * @see appendNotes(string notes)
    * @see unsetNotes()
    * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif)
    */
 public int appendNotes(XMLNode notes)
 {
     int ret = libsbmlPINVOKE.SBase_appendNotes__SWIG_0(swigCPtr, XMLNode.getCPtr(notes));
     return ret;
 }
Example #22
0
 /**
    * Sets the value of the 'annotation' subelement of this SBML object.
    *
    * The content of @p annotation is copied, and any previous content of
    * this object's 'annotation' subelement is deleted.
    *
    * Whereas the SBase 'notes' subelement is a container for content to be
    * shown directly to humans, the 'annotation' element is a container for
    * optional software-generated content @em not meant to be shown to
    * humans.  Every object derived from SBase can have its own value for
    * 'annotation'.  The element's content type is <a target='_blank'
    * href='http://www.w3.org/TR/2004/REC-xml-20040204/#elemdecls'>XML type
    * 'any'</a>, allowing essentially arbitrary well-formed XML data
    * content.
    *
    * SBML places a few restrictions on the organization of the content of
    * annotations; these are intended to help software tools read and write
    * the data as well as help reduce conflicts between annotations added by
    * different tools.  Please see the SBML specifications for more details.
    *
    * Call this method will result in any existing content of the
    * 'annotation' subelement to be discarded.  Unless you have taken steps
    * to first copy and reconstitute any existing annotations into the @p
    * annotation that is about to be assigned, it is likely that performing
    * such wholesale replacement is unfriendly towards other software
    * applications whose annotations are discarded.  An alternative may be
    * to use SBase::appendAnnotation(XMLNode annotation) or
    * SBase::appendAnnotation(string annotation).
    *
    * @param annotation an XML structure that is to be used as the new content
    * of the 'annotation' subelement of this object
    *
    *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    *
    * @see getAnnotationString()
    * @see isSetAnnotation()
    * @see setAnnotation(string annotation)
    * @see appendAnnotation(XMLNode annotation)
    * @see appendAnnotation(string annotation)
    * @see unsetAnnotation()
    */
 public new int setAnnotation(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.SBase_setAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
        static ModelHistory parseRDFAnnotation(XMLNode annotation, string metaId)
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_1(XMLNode.getCPtr(annotation), metaId);
            ModelHistory          ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
Example #24
0
 public void test_SBase_appendNotes8()
 {
     XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLTriple body_triple = new  XMLTriple("body", "", "");
       XMLTriple p_triple = new  XMLTriple("p", "", "");
       XMLToken body_token = new  XMLToken(body_triple,att,ns);
       XMLToken p_token = new  XMLToken(p_triple,att);
       XMLToken text_token = new  XMLToken("This is my text");
       XMLNode body_node = new XMLNode(body_token);
       XMLNode p_node = new XMLNode(p_token);
       XMLNode text_node = new XMLNode(text_token);
       XMLToken p_token1 = new  XMLToken(p_triple,att,ns);
       XMLToken text_token1 = new  XMLToken("This is more text");
       XMLNode p_node1 = new XMLNode(p_token1);
       XMLNode text_node1 = new XMLNode(text_token1);
       XMLNode notes;
       XMLNode child, child1;
       p_node.addChild(text_node);
       body_node.addChild(p_node);
       p_node1.addChild(text_node1);
       S.setNotes(body_node);
       S.appendNotes(p_node1);
       notes = S.getNotes();
       assertTrue((  "notes" == notes.getName() ));
       assertTrue( notes.getNumChildren() == 1 );
       child = notes.getChild(0);
       assertTrue((  "body" == child.getName() ));
       assertTrue( child.getNumChildren() == 2 );
       child1 = child.getChild(0);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is my text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       child1 = child.getChild(1);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is more text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       att = null;
       ns = null;
       body_triple = null;
       p_triple = null;
       body_token = null;
       p_token = null;
       text_token = null;
       text_token1 = null;
       p_token1 = null;
       body_node = null;
       p_node = null;
       text_node = null;
       p_node1 = null;
       text_node1 = null;
 }
 /**
    * Parses an annotation into a ModelHistory class instance.
    *
    * This is used to take an annotation that has been read into an SBML
    * model, identify the RDF elements representing model history
    * information, and create a list of corresponding CVTerm objects.
    *
    * @param annotation XMLNode containing the annotation.
    * @param stream optional XMLInputStream that facilitates error logging
    * @param metaId optional metaId, if set only the rdf annotation for this metaId will be returned.
    *
    * @if notclike @note Because this is a @em static method, the non-C++
    * language interfaces for libSBML will contain two variants.  One will
    * be a static method on the class (i.e., RDFAnnotationParser), and the
    * other will be a standalone top-level function with the name
    * RDFAnnotationParser_parseRDFAnnotation(). They are functionally
    * identical. @endif
    *
    * @return a pointer to the ModelHistory created.
    */
 public static ModelHistory parseRDFAnnotation(XMLNode annotation)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_2(XMLNode.getCPtr(annotation));
     ModelHistory ret = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);
     return ret;
 }
Example #26
0
 /**
    * Sets the message of this Constraint.
    *
    * The XMLNode tree passed in @p xhtml is copied.
    *
    * @param xhtml an XML tree containing XHTML content.
    *
    *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    */
 public int setMessage(XMLNode xhtml)
 {
     int ret = libsbmlPINVOKE.Constraint_setMessage__SWIG_0(swigCPtr, XMLNode.getCPtr(xhtml));
     return ret;
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_5(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId);
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_3(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms));
 }
Example #29
0
 public void test_SBase_setNotes()
 {
     SBase c = new Model(1,2);
       XMLToken token;
       XMLNode node;
       token = new  XMLToken("This is a test note");
       node = new XMLNode(token);
       c.setNotes(node);
       assertTrue( c.isSetNotes() == true );
       if (c.getNotes() == node);
       {
       }
       XMLNode t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       assertTrue((  "This is a test note" == t1.getChild(0).getCharacters() ));
       c.setNotes(c.getNotes());
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string chars = t1.getChild(0).getCharacters();
       assertTrue((  "This is a test note" == chars ));
       c.setNotes((XMLNode)null);
       assertTrue( c.isSetNotes() == false );
       if (c.getNotes() != null);
       {
       }
       c.setNotes(node);
       assertTrue( c.isSetNotes() == true );
       token = new  XMLToken("(CR) &#0168; &#x00a8; &#x00A8; (NOT CR) &#; &#x; &#00a8; &#0168 &#x00a8");
       node = new XMLNode(token);
       c.setNotes(node);
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string s = t1.getChild(0).toXMLString();
       string expected =  "(CR) &#0168; &#x00a8; &#x00A8; (NOT CR) &amp;#; &amp;#x; &amp;#00a8; &amp;#0168 &amp;#x00a8";
       assertTrue(( expected == s ));
       token = new  XMLToken("& ' > < \" &amp; &apos; &gt; &lt; &quot;");
       node = new XMLNode(token);
       c.setNotes(node);
       t1 = c.getNotes();
       assertTrue( t1.getNumChildren() == 1 );
       string s2 = t1.getChild(0).toXMLString();
       string expected2 =  "&amp; &apos; &gt; &lt; &quot; &amp; &apos; &gt; &lt; &quot;";
       assertTrue(( expected2 == s2 ));
       token = null;
       node = null;
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId, XMLInputStream stream)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_4(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId, XMLInputStream.getCPtr(stream));
 }
Example #31
0
 internal static HandleRef getCPtr(XMLNode obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms, string metaId)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_5(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms), metaId);
 }
Example #33
0
        XMLNode getChild(long n)
        {
            XMLNode ret = new XMLNode(libsbmlPINVOKE.XMLNode_getChild__SWIG_0(swigCPtr, n), false);

            return(ret);
        }
Example #34
0
        internal static HandleRef getCPtrAndDisown(XMLNode obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Example #35
0
        static string convertXMLNodeToString(XMLNode node)
        {
            string ret = libsbmlPINVOKE.XMLNode_convertXMLNodeToString(XMLNode.getCPtr(node));

            return(ret);
        }
Example #36
0
 public static bool hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns)
 {
     bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_0(XMLNode.getCPtr(xhtml), SBMLNamespaces.getCPtr(sbmlns));
     return ret;
 }
Example #37
0
        static bool hasExpectedXHTMLSyntax(XMLNode xhtml)
        {
            bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_1(XMLNode.getCPtr(xhtml));

            return(ret);
        }
Example #38
0
 public static bool hasExpectedXHTMLSyntax(XMLNode xhtml)
 {
     bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_1(XMLNode.getCPtr(xhtml));
     return ret;
 }
Example #39
0
        int appendAnnotation(XMLNode annotation)
        {
            int ret = libsbmlPINVOKE.SpeciesReference_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));

            return(ret);
        }
        static ModelHistory parseRDFAnnotation(XMLNode annotation, string metaId, XMLInputStream stream)
        {
            IntPtr       cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_0(XMLNode.getCPtr(annotation), metaId, XMLInputStream.getCPtr(stream));
            ModelHistory ret  = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
Example #41
0
 /**
    * Creates a new CVTerm from the given XMLNode.
    *
    *
  *
  * The SBML Level&nbsp;2 and Level&nbsp;3 specifications define a simple
  * format for annotating models when (a) referring to controlled
  * vocabulary terms and database identifiers that define and describe
  * biological and other entities, and (b) describing the creator of a
  * model and the model's modification history.  The annotation content is
  * stored in <code>&lt;annotation&gt;</code> elements attached to
  * individual SBML elements.  The format for storing the content inside
  * SBML <code>&lt;annotation&gt;</code> elements is a subset of W3C RDF
  * (<a target='_blank' href='http://www.w3.org/RDF/'>Resource Description
  * Format</a>) expressed in XML.  The CVTerm class provides a programming
  * interface for working directly with controlled vocabulary term ('CV
  * term') objects without having to deal directly with the XML form.
  * When libSBML reads in an SBML model containing RDF annotations, it
  * parses those annotations into a list of CVTerm objects, and when
  * writing a model, it parses the CVTerm objects back into the
  * appropriate SBML <code>&lt;annotation&gt;</code> structure.
  *
  *
    *
    * This method creates a CVTerm object from the given XMLNode object @p
    * node.  XMLNode is libSBML's representation of a node in an XML tree of
    * elements, and each such element can be placed in a namespace.  This
    * constructor looks for the element to be in the XML namespaces
    * <code>'http://biomodels.net/model-qualifiers'</code> (for
    * model qualifiers) and
    * <code>'http://biomodels.net/biology-qualifiers'</code> (for
    * biological qualifier), and if they are, creates CVTerm objects for
    * the result.
    *
    * @param node an %XMLNode representing a CVTerm.
    *
    * @note This method assumes that the given XMLNode object @p node is of
    * the correct structural form.
    */
 public CVTerm(XMLNode node)
     : this(libsbmlPINVOKE.new_CVTerm__SWIG_2(XMLNode.getCPtr(node)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_XMLNode_clearAttributes()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLTriple xt2 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1 = new  XMLTriple("name5", "http://name5.org/", "p5");
       int i = node.addAttr( "name1", "val1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 1 );
       i = node.addAttr( "name2", "val2", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 2 );
       i = node.addAttr(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 3 );
       i = node.addAttr( "name4", "val4");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 4 );
       i = node.clearAttributes();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 0 );
       xt1 = null;
       xt2 = null;
       triple = null;
       attr = null;
       node = null;
 }
Example #43
0
 internal static HandleRef getCPtr(XMLNode obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public static void parseRDFAnnotation(XMLNode annotation, CVTermList CVTerms)
 {
     libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_3(XMLNode.getCPtr(annotation), CVTermList.getCPtr(CVTerms));
 }
        static ModelHistory parseRDFAnnotation(XMLNode annotation)
        {
            IntPtr       cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseRDFAnnotation__SWIG_2(XMLNode.getCPtr(annotation));
            ModelHistory ret  = (cPtr == IntPtr.Zero) ? null : new ModelHistory(cPtr, false);

            return(ret);
        }
Example #46
0
 public virtual int appendAnnotation(XMLNode annotation)
 {
     int ret = libsbmlPINVOKE.SBase_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
     return ret;
 }
Example #47
0
        int setMessage(XMLNode xhtml)
        {
            int ret = libsbmlPINVOKE.Constraint_setMessage(swigCPtr, XMLNode.getCPtr(xhtml));

            return(ret);
        }
        static XMLNode deleteRDFCVTermAnnotation(XMLNode annotation)
        {
            IntPtr  cPtr = libsbmlPINVOKE.RDFAnnotationParser_deleteRDFCVTermAnnotation(XMLNode.getCPtr(annotation));
            XMLNode ret  = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, false);

            return(ret);
        }