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; }
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())); } { } }
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; }
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; }
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; }
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); }