Ejemplo n.º 1
0
        public CVTerm remove(uint n)
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.CVTermList_remove(swigCPtr, n);
            CVTerm ret = (cPtr == global::System.IntPtr.Zero) ? null : new CVTerm(cPtr, false);

            return(ret);
        }
Ejemplo n.º 2
0
        public void test_CVTerm_setModelQualifierType()
        {
            CVTerm term = new  CVTerm(libsbml.MODEL_QUALIFIER);

            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            assertTrue(term.getModelQualifierType() == libsbml.BQM_UNKNOWN);
            assertTrue(term.getBiologicalQualifierType() == libsbml.BQB_UNKNOWN);
            int i = term.setModelQualifierType(libsbml.BQM_IS);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            assertTrue(term.getModelQualifierType() == libsbml.BQM_IS);
            assertTrue(term.getBiologicalQualifierType() == libsbml.BQB_UNKNOWN);
            i = term.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(term.getModelQualifierType() == libsbml.BQM_UNKNOWN);
            assertTrue(term.getBiologicalQualifierType() == libsbml.BQB_UNKNOWN);
            i = term.setModelQualifierType(libsbml.BQM_IS);
            assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE);
            assertTrue(term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(term.getBiologicalQualifierType() == libsbml.BQB_UNKNOWN);
            assertTrue(term.getModelQualifierType() == libsbml.BQM_UNKNOWN);
            term = null;
        }
Ejemplo n.º 3
0
        public void test_RDFAnnotation2_modelWithHistoryAndCVTerms()
        {
            ModelHistory h = new ModelHistory();
            ModelCreator c = new ModelCreator();

            c.setFamilyName("Keating");
            c.setGivenName("Sarah");
            h.addCreator(c);
            Date d = new Date(2008, 11, 17, 18, 37, 0, 0, 0, 0);

            h.setCreatedDate(d);
            h.setModifiedDate(d);
            m2.unsetModelHistory();
            m2.setModelHistory(h);
            CVTerm cv = new CVTerm();

            cv.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
            cv.setBiologicalQualifierType(libsbml.BQB_IS_VERSION_OF);
            cv.addResource("http://www.geneontology.org/#GO:0005892");
            m2.addCVTerm(cv);
            XMLNode ann      = RDFAnnotationParser.parseModelHistory(m2);
            string  expected = "<annotation>\n" +
                               "  <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n" +
                               "    <rdf:Description rdf:about=\"#_000001\">\n" +
                               "      <dc:creator rdf:parseType=\"Resource\">\n" +
                               "        <rdf:Bag>\n" +
                               "          <rdf:li rdf:parseType=\"Resource\">\n" +
                               "            <vCard:N rdf:parseType=\"Resource\">\n" +
                               "              <vCard:Family>Keating</vCard:Family>\n" +
                               "              <vCard:Given>Sarah</vCard:Given>\n" +
                               "            </vCard:N>\n" +
                               "          </rdf:li>\n" +
                               "        </rdf:Bag>\n" +
                               "      </dc:creator>\n" +
                               "      <dcterms:created rdf:parseType=\"Resource\">\n" +
                               "        <dcterms:W3CDTF>2008-11-17T18:37:00Z</dcterms:W3CDTF>\n" +
                               "      </dcterms:created>\n" +
                               "      <dcterms:modified rdf:parseType=\"Resource\">\n" +
                               "        <dcterms:W3CDTF>2008-11-17T18:37:00Z</dcterms:W3CDTF>\n" +
                               "      </dcterms:modified>\n" +
                               "      <bqbiol:isVersionOf>\n" +
                               "        <rdf:Bag>\n" +
                               "          <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0005892\"/>\n" +
                               "        </rdf:Bag>\n" +
                               "      </bqbiol:isVersionOf>\n" +
                               "    </rdf:Description>\n" +
                               "  </rdf:RDF>\n" +
                               "</annotation>";

            if (ann != null)
            {
                ;
            }
            {
                assertEquals(true, equals(expected, ann.toXMLString()));
            }
            {
            }
        }
Ejemplo n.º 4
0
        public void test_CVTerm_create()
        {
            CVTerm term = new  CVTerm(libsbml.MODEL_QUALIFIER);

            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            term = null;
        }
Ejemplo n.º 5
0
        public void test_Validation_CVTerm1()
        {
            CVTerm cv = new CVTerm();

            assertTrue(cv != null);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.setQualifierType(libsbml.MODEL_QUALIFIER);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.setModelQualifierType(libsbml.BQM_IS);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.addResource("ggg");
            assertEquals(true, (cv.hasRequiredAttributes()));
            cv = null;
        }
Ejemplo n.º 6
0
        public void test_Validation_CVTerm2()
        {
            CVTerm cv = new CVTerm();

            assertTrue(cv != null);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.setBiologicalQualifierType(libsbml.BQB_IS);
            assertEquals(false, (cv.hasRequiredAttributes()));
            cv.addResource("ggg");
            assertEquals(true, (cv.hasRequiredAttributes()));
            cv = null;
        }
Ejemplo n.º 7
0
        public void test_CVTerm_addResource()
        {
            CVTerm        term     = new  CVTerm(libsbml.MODEL_QUALIFIER);
            string        resource = "GO6666";
            XMLAttributes xa;

            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            term.addResource(resource);
            xa = term.getResources();
            assertTrue(xa.getLength() == 1);
            assertTrue(("rdf:resource" == xa.getName(0)));
            assertTrue(("GO6666" == xa.getValue(0)));
            term = null;
        }
 public void test_RDFAnnotation_testMissingMetaId()
 {
   SBMLDocument doc = new SBMLDocument ( 3,1 );
   Model model = doc.createModel();
   assertTrue( model != null );
   model.setId("test1");
   CVTerm term = new CVTerm ( libsbml.MODEL_QUALIFIER );
   term.addResource("testResource");
   term.setModelQualifierType(libsbml.BQM_IS);
   model.setMetaId("t1");
   model.addCVTerm(term);
   model.setMetaId("");
   string test = model.toSBML();
   assertTrue( test ==  "<model id=\"test1\"/>" );
 }
Ejemplo n.º 9
0
        public void test_CVTerm_getResources()
        {
            CVTerm term      = new  CVTerm(libsbml.MODEL_QUALIFIER);
            string resource  = "GO6666";
            string resource1 = "OtherURI";
            long   number;

            term.addResource(resource);
            term.addResource(resource1);
            number = term.getNumResources();
            assertTrue(number == 2);
            assertTrue(("GO6666" == term.getResourceURI(0)));
            assertTrue(("OtherURI" == term.getResourceURI(1)));
            term = null;
        }
Ejemplo n.º 10
0
        public void test_CVTerm_copyConstructor()
        {
            CVTerm CVTerm1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);

            CVTerm1.addResource("http://www.geneontology.org/#GO:0005892");
            assertTrue(CVTerm1.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(CVTerm1.getResources().getLength() == 1);
            assertTrue(CVTerm1.getResources().getValue(0) == "http://www.geneontology.org/#GO:0005892");
            CVTerm CVTerm2 = new CVTerm(CVTerm1);

            assertTrue(CVTerm2.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(CVTerm2.getResources().getLength() == 1);
            assertTrue(CVTerm2.getResources().getValue(0) == "http://www.geneontology.org/#GO:0005892");
            CVTerm2 = null;
            CVTerm1 = null;
        }
Ejemplo n.º 11
0
        public void test_CVTerm_set_get()
        {
            CVTerm term = new  CVTerm(libsbml.MODEL_QUALIFIER);

            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            term.setModelQualifierType(libsbml.BQM_IS);
            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            assertTrue(term.getModelQualifierType() == libsbml.BQM_IS);
            term.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
            term.setBiologicalQualifierType(libsbml.BQB_IS);
            assertTrue(term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER);
            assertTrue(term.getBiologicalQualifierType() == libsbml.BQB_IS);
            term = null;
        }
Ejemplo n.º 12
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;
        }
Ejemplo n.º 13
0
        public void test_CVTerm_removeResource()
        {
            CVTerm        term     = new  CVTerm(libsbml.MODEL_QUALIFIER);
            string        resource = "GO6666";
            XMLAttributes xa;

            assertTrue(term != null);
            assertTrue(term.getQualifierType() == libsbml.MODEL_QUALIFIER);
            term.addResource(resource);
            xa = term.getResources();
            assertTrue(xa.getLength() == 1);
            int i = term.removeResource("CCC");

            assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE);
            xa = term.getResources();
            assertTrue(xa.getLength() == 1);
            i = term.removeResource(resource);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            xa = term.getResources();
            assertTrue(xa.getLength() == 0);
            term = null;
        }
Ejemplo n.º 14
0
    public static int Main(string[] args)
    {
        SBMLDocument d;
        long         errors, n;
        Species      s;

        if (args.Length != 2)
        {
            Console.WriteLine("  usage: addCVTerms <input-filename> <output-filename>");
            Console.WriteLine("  Adds controlled vocabulary term to a species");
            return(2);
        }


        d      = libsbml.readSBML(args[0]);
        errors = d.getNumErrors();

        if (errors > 0)
        {
            Console.WriteLine("Read Error(s):");
            d.printErrors();

            Console.WriteLine("Correct the above and re-run.");
        }
        else
        {
            n = d.getModel().getNumSpecies();

            if (n <= 0)
            {
                Console.WriteLine("Model has no species.\n Cannot add CV terms\n");
            }
            else
            {
                s = d.getModel().getSpecies(0);

                CVTerm cv = new CVTerm();
                cv.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
                cv.setBiologicalQualifierType(libsbml.BQB_IS_VERSION_OF);
                cv.addResource("http://www.geneontology.org/#GO:0005892");

                CVTerm cv2 = new CVTerm();
                cv2.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
                cv2.setBiologicalQualifierType(libsbml.BQB_IS);
                cv2.addResource("http://www.geneontology.org/#GO:0005895");

                CVTerm cv1 = new CVTerm();
                cv1.setQualifierType(libsbml.BIOLOGICAL_QUALIFIER);
                cv1.setBiologicalQualifierType(libsbml.BQB_IS_VERSION_OF);
                cv1.addResource("http://www.ebi.ac.uk/interpro/#IPR002394");

                s.addCVTerm(cv);
                s.addCVTerm(cv2);
                s.addCVTerm(cv1);

                libsbml.writeSBML(d, args[1]);
            }
        }

        return((int)errors);
    }
Ejemplo n.º 15
0
    public static int Main(string[] args)
    {
        SBMLDocument d;

        long     errors, n;
        Reaction r;

        if (args.Length != 2)
        {
            Console.Write(Environment.NewLine
                          + "  usage: addingEvidenceCodes_1 <input-filename> <output-filename>" + Environment.NewLine
                          + "  Adds controlled vocabulary term to a reaction" + Environment.NewLine
                          + Environment.NewLine);
            return(2);
        }


        d      = libsbml.readSBML(args[1]);
        errors = d.getNumErrors();

        if (errors > 0)
        {
            Console.Write("Read Error(s):" + Environment.NewLine);
            d.printErrors();

            Console.Write("Correct the above and re-run." + Environment.NewLine);
        }
        else
        {
            n = d.getModel().getNumReactions();

            if (n <= 0)
            {
                Console.Write("Model has no reactions.\n Cannot add CV terms\n");
            }
            else
            {
                r = d.getModel().getReaction(0);

                /* check that the reaction has a metaid
                 * no CVTerms will be added if there is no metaid to reference
                 */
                if (!r.isSetMetaId())
                {
                    r.setMetaId("metaid_0000052");
                }

                CVTerm cv1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
                cv1.setBiologicalQualifierType(libsbml.BQB_IS_DESCRIBED_BY);
                cv1.addResource("urn:miriam:obo.eco:ECO%3A0000183");

                r.addCVTerm(cv1);

                CVTerm cv2 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
                cv2.setBiologicalQualifierType(libsbml.BQB_IS);
                cv2.addResource("urn:miriam:kegg.reaction:R00756");
                cv2.addResource("urn:miriam:reactome:REACT_736");

                r.addCVTerm(cv2);

                libsbml.writeSBML(d, args[1]);
            }
        }

        return((int)errors);
    }
Ejemplo n.º 16
0
        public void test_RDFAnnotation_parseCVTerms()
        {
            XMLNode node = RDFAnnotationParser.parseCVTerms(m.getCompartment(0));

            assertTrue(node.getNumChildren() == 1);
            XMLNode rdf = node.getChild(0);

            assertTrue(("RDF" == rdf.getName()));
            assertTrue(("rdf" == rdf.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == rdf.getURI()));
            assertTrue(rdf.getNumChildren() == 1);
            XMLNode desc = rdf.getChild(0);

            assertTrue(("Description" == desc.getName()));
            assertTrue(("rdf" == desc.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == desc.getURI()));
            assertTrue(desc.getNumChildren() == 1);
            XMLNode is1 = desc.getChild(0);

            assertTrue(("is" == is1.getName()));
            assertTrue(("bqbiol" == is1.getPrefix()));
            assertTrue(is1.getNumChildren() == 1);
            XMLNode Bag = is1.getChild(0);

            assertTrue(("Bag" == Bag.getName()));
            assertTrue(("rdf" == Bag.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == Bag.getURI()));
            assertTrue(Bag.getNumChildren() == 4);
            XMLNode li = Bag.getChild(0);

            assertTrue(("li" == li.getName()));
            assertTrue(("rdf" == li.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li.getURI()));
            assertTrue(li.getNumChildren() == 0);
            XMLNode li1 = Bag.getChild(1);

            assertTrue(("li" == li1.getName()));
            assertTrue(("rdf" == li1.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li1.getURI()));
            assertTrue(li1.getNumChildren() == 0);
            XMLNode li2 = Bag.getChild(2);

            assertTrue(("li" == li2.getName()));
            assertTrue(("rdf" == li2.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li2.getURI()));
            assertTrue(li2.getNumChildren() == 0);
            XMLNode li3 = Bag.getChild(3);

            assertTrue(("li" == li3.getName()));
            assertTrue(("rdf" == li3.getPrefix()));
            assertTrue(("http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li3.getURI()));
            assertTrue(li3.getNumChildren() == 0);
            node = null;
            XMLNode node1 = RDFAnnotationParser.parseCVTerms(null);

            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.createCVTerms(null);
            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.parseCVTerms(m.getCompartment(2));
            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.createCVTerms(m.getCompartment(2));
            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.parseCVTerms(m);
            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.createCVTerms(m);
            assertTrue(node1 == null);
            Compartment c = new Compartment(3, 1);

            c.setMetaId("_002");
            node1 = RDFAnnotationParser.parseCVTerms(c);
            assertTrue(node1 == null);
            node1 = RDFAnnotationParser.createCVTerms(c);
            assertTrue(node1 == null);
            CVTerm cv = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);

            cv.setBiologicalQualifierType(23);
            cv.addResource("http://myres");
            c.addCVTerm(cv);
            node1 = RDFAnnotationParser.createCVTerms(c);
            assertTrue(node1 == null);
            c = null;
            Model m1 = new Model(3, 1);

            m1.setMetaId("_002");
            cv = new CVTerm(libsbml.MODEL_QUALIFIER);
            cv.setModelQualifierType(23);
            cv.addResource("http://myres");
            m1.addCVTerm(cv);
            node1 = RDFAnnotationParser.createCVTerms(m1);
            assertTrue(node1 == null);
        }
Ejemplo n.º 17
0
    public static int Main(string[] args)
    {
        if (args.Length != 2)
        {
            Console.WriteLine("  usage: addingEvidenceCodes_2 <input-filename> <output-filename>");
            Console.WriteLine("  Adds controlled vocabulary term to a species");
            Console.WriteLine();
            return(2);
        }


        SBMLDocument d      = libsbml.readSBML(args[0]);
        long         errors = d.getNumErrors();

        if (errors > 0)
        {
            Console.WriteLine("Read Error(s):");
            d.printErrors();

            Console.WriteLine("Correct the above and re-run.");
        }
        else
        {
            long n = d.getModel().getNumSpecies();

            if (n <= 0)
            {
                Console.WriteLine("Model has no species.\n Cannot add CV terms\n");
            }
            else
            {
                Species s = d.getModel().getSpecies(0);

                /* check that the species has a metaid
                 * no CVTerms will be added if there is no metaid to reference
                 */
                if (!s.isSetMetaId())
                {
                    s.setMetaId("metaid_0000052");
                }

                CVTerm cv1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
                cv1.setBiologicalQualifierType(libsbml.BQB_OCCURS_IN);
                cv1.addResource("urn:miriam:obo.go:GO%3A0005764");

                s.addCVTerm(cv1);

                // now create the additional annotation

                //<rdf:Statement>
                //  <rdf:subject rdf:resource="#metaid_0000052"/>
                //  <rdf:predicate rdf:resource="http://biomodels.net/biology-qualifiers/occursIn"/>
                //  <rdf:object rdf:resource="urn:miriam:obo.go:GO%3A0005764"/>
                //  <bqbiol:isDescribedBy>
                //    <rdf:Bag>
                //      <rdf:li rdf:resource="urn:miriam:obo.eco:ECO%3A0000004"/>
                //      <rdf:li rdf:resource="urn:miriam:pubmed:7017716"/>
                //    </rdf:Bag>
                //  </bqbiol:isDescribedBy>
                //</rdf:Statement>

                /* attributes */
                XMLAttributes blank_att = new XMLAttributes();

                XMLAttributes resource_att = new XMLAttributes();

                /* create the outer statement node */
                XMLTriple statement_triple = new XMLTriple("Statement",
                                                           "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                           "rdf");

                XMLToken statement_token = new XMLToken(statement_triple, blank_att);

                XMLNode statement = new XMLNode(statement_token);

                /*create the subject node */
                XMLTriple subject_triple = new XMLTriple("subject",
                                                         "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                         "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource", "#" + s.getMetaId());

                XMLToken subject_token = new XMLToken(subject_triple, resource_att);

                XMLNode subject = new XMLNode(subject_token);


                /*create the predicate node */
                XMLTriple predicate_triple = new XMLTriple("predicate",
                                                           "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                           "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource",
                                 "http://biomodels.net/biology-qualifiers/occursIn");

                XMLToken predicate_token = new XMLToken(predicate_triple, resource_att);

                XMLNode predicate = new XMLNode(predicate_token);

                /*create the object node */
                XMLTriple object_triple = new XMLTriple("object",
                                                        "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                        "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource", "urn:miriam:obo.go:GO%3A0005764");

                XMLToken object_token = new XMLToken(object_triple, resource_att);

                XMLNode object_ = new XMLNode(object_token);

                /* create the bqbiol node */
                XMLTriple bqbiol_triple = new XMLTriple("isDescribedBy",
                                                        "http://biomodels.net/biology-qualifiers/",
                                                        "bqbiol");

                XMLToken bqbiol_token = new XMLToken(bqbiol_triple, blank_att);

                XMLNode bqbiol = new XMLNode(bqbiol_token);

                /* create the bag node */
                XMLTriple bag_triple = new XMLTriple("Bag",
                                                     "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                     "rdf");

                XMLToken bag_token = new XMLToken(bag_triple, blank_att);

                XMLNode bag = new XMLNode(bag_token);

                /* create each li node and add to the bag */
                XMLTriple li_triple = new XMLTriple("li",
                                                    "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                    "rdf");

                resource_att.clear();
                resource_att.add("rdf:resource", "urn:miriam:obo.eco:ECO%3A0000004");

                XMLToken li_token = new XMLToken(li_triple, resource_att);
                li_token.setEnd();

                XMLNode li = new XMLNode(li_token);

                bag.addChild(li);

                resource_att.clear();
                resource_att.add("rdf:resource", "urn:miriam:pubmed:7017716");
                li_token = new XMLToken(li_triple, resource_att);
                li_token.setEnd();
                li = new XMLNode(li_token);

                bag.addChild(li);

                /* add the bag to bqbiol */
                bqbiol.addChild(bag);

                /* add subject, predicate, object and bqbiol to statement */
                statement.addChild(subject);
                statement.addChild(predicate);
                statement.addChild(object_);
                statement.addChild(bqbiol);


                /* create a top-level RDF element
                 * this will ensure correct merging
                 */

                XMLNamespaces xmlns = new XMLNamespaces();
                xmlns.add("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf");
                xmlns.add("http://purl.org/dc/elements/1.1/", "dc");
                xmlns.add("http://purl.org/dc/terms/", "dcterms");
                xmlns.add("http://www.w3.org/2001/vcard-rdf/3.0#", "vCard");
                xmlns.add("http://biomodels.net/biology-qualifiers/", "bqbiol");
                xmlns.add("http://biomodels.net/model-qualifiers/", "bqmodel");

                XMLTriple RDF_triple = new XMLTriple("RDF",
                                                     "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
                                                     "rdf");

                XMLToken RDF_token = new XMLToken(RDF_triple, blank_att, xmlns);

                XMLNode annotation = new XMLNode(RDF_token);

                /* add the staement node to the RDF node */
                annotation.addChild(statement);

                s.appendAnnotation(annotation);

                libsbml.writeSBML(d, args[1]);
            }
        }

        return((int)errors);
    }
Ejemplo n.º 18
0
 public void prepend(CVTerm item)
 {
     libsbmlPINVOKE.CVTermList_prepend(swigCPtr, CVTerm.getCPtr(item));
 }