public void test_SBase_setMetaId1()
 {
     SBase c = new Compartment(1,2);
       int i = c.setMetaId( "cell");
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertEquals( false, c.isSetMetaId() );
       c = null;
 }
Beispiel #2
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 );
 }
        public void test_SyncAnnotation_stringChangesMetaid()
        {
            Compartment c = new  Compartment(3,1);
              c.setMetaId("_000005");
              c.setId("A");

              string addedAnn =
            "  <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=\"#_000003\">\n" +
            "        <dc:creator>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:parseType=\"Resource\">\n" +
            "              <vCard:N rdf:parseType=\"Resource\">\n" +
            "                <vCard:Family>Le Novere</vCard:Family>\n" +
            "                <vCard:Given>Nicolas</vCard:Given>\n" +
            "              </vCard:N>\n" +
            "              <vCard:EMAIL>[email protected]</vCard:EMAIL>\n" +
            "              <vCard:ORG rdf:parseType=\"Resource\">\n" +
            "                <vCard:Orgname>EMBL-EBI</vCard:Orgname>\n" +
            "              </vCard:ORG>\n" +
            "            </rdf:li>\n" +
            "          </rdf:Bag>\n" +
            "        </dc:creator>\n" +
            "        <dcterms:created rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" +
            "        </dcterms:created>\n" +
            "        <dcterms:modified rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2006-05-30T10:46:02Z</dcterms:W3CDTF>\n" +
            "        </dcterms:modified>\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>";

              c.setAnnotation(addedAnn);

              string expected =
            "<compartment metaid=\"_000005\" id=\"A\">\n" +
            "  <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=\"#_000005\">\n" +
            "        <dc:creator>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:parseType=\"Resource\">\n" +
            "              <vCard:N rdf:parseType=\"Resource\">\n" +
            "                <vCard:Family>Le Novere</vCard:Family>\n" +
            "                <vCard:Given>Nicolas</vCard:Given>\n" +
            "              </vCard:N>\n" +
            "              <vCard:EMAIL>[email protected]</vCard:EMAIL>\n" +
            "              <vCard:ORG rdf:parseType=\"Resource\">\n" +
            "                <vCard:Orgname>EMBL-EBI</vCard:Orgname>\n" +
            "              </vCard:ORG>\n" +
            "            </rdf:li>\n" +
            "          </rdf:Bag>\n" +
            "        </dc:creator>\n" +
            "        <dcterms:created rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" +
            "        </dcterms:created>\n" +
            "        <dcterms:modified rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2006-05-30T10:46:02Z</dcterms:W3CDTF>\n" +
            "        </dcterms:modified>\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>\n" +
            "</compartment>";

              assertEquals( true, equals(expected,c.toSBML()) );
        }
 public void test_internal_consistency_check_99904()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setId("c");
       c.setMetaId("mmm");
       m.addCompartment(c);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 10103 );
       d = null;
 }
        public void test_SyncAnnotation_stringChangesMetaid2()
        {
            Compartment c = new Compartment(2, 3);
              c.setMetaId("_000005");
              c.setId("A");

              string addedAnn =
            "  <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=\"#_000003\">\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>";

              c.setAnnotation(addedAnn);

              string expected =
            "<compartment metaid=\"_000005\" id=\"A\">\n" +
            "  <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=\"#_000005\">\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>\n" +
            "</compartment>";

              assertEquals(true, equals(expected, c.toSBML()));
        }