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 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_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\"/>" ); }
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 ); }
public void test_SBase_getQualifiersFromResources() { CVTerm cv = new CVTerm (libsbml.BIOLOGICAL_QUALIFIER); cv.setBiologicalQualifierType (libsbml.BQB_ENCODES); cv.addResource ("foo"); S.setMetaId ("sbase1"); S.addCVTerm (cv); assertTrue (S.getResourceBiologicalQualifier ("foo") == libsbml.BQB_ENCODES); CVTerm cv1 = new CVTerm (libsbml.MODEL_QUALIFIER); cv1.setModelQualifierType (libsbml.BQM_IS); cv1.addResource ("bar"); S.addCVTerm (cv1); assertTrue (S.getResourceModelQualifier ("bar") == libsbml.BQM_IS); cv = null; cv1 = null; }