예제 #1
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 );
 }