addResource() public method

public addResource ( string resource ) : int
resource string
return int
コード例 #1
0
 public void test_SBase_addCVTerms()
 {
     CVTerm cv = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(libsbml.BQB_ENCODES);
       cv.addResource( "foo");
       int i = S.addCVTerm(cv);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertTrue( S.getNumCVTerms() == 0 );
       S.setMetaId( "_id");
       i = S.addCVTerm(cv);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( S.getNumCVTerms() == 1 );
       assertTrue( S.getCVTerms() != null );
       i = S.addCVTerm(null);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( S.getNumCVTerms() == 1 );
       assertTrue( S.getCVTerms() != null );
       CVTerm cv2 = new  CVTerm(libsbml.MODEL_QUALIFIER);
       i = S.addCVTerm(cv2);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertTrue( S.getNumCVTerms() == 1 );
       assertTrue( S.getCVTerms() != null );
       cv = null;
       cv2 = null;
 }
コード例 #2
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 );
       int i = term.addResource( "");
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       xa = term.getResources();
       assertTrue( xa.getLength() == 0 );
       i = term.addResource(resource);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       xa = term.getResources();
       assertTrue( xa.getLength() == 1 );
       assertTrue((  "rdf:resource" == xa.getName(0) ));
       assertTrue((  "GO6666" == xa.getValue(0) ));
       term = null;
 }
コード例 #3
0
ファイル: TestValidation.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #4
0
ファイル: TestValidation.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #5
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;
 }
コード例 #6
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 public void test_SBase_addCVTerms()
 {
     CVTerm cv = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(libsbml.BQB_ENCODES);
       cv.addResource( "foo");
       S.setMetaId( "sbase1");
       S.addCVTerm(cv);
       assertTrue( S.getNumCVTerms() == 1 );
       assertTrue( S.getCVTerms() != null );
       XMLAttributes res = S.getCVTerm(0).getResources();
       assertTrue((  "foo" == res.getValue(0) ));
       CVTerm cv1 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv1.setBiologicalQualifierType(libsbml.BQB_IS);
       cv1.addResource( "bar");
       S.addCVTerm(cv1);
       assertTrue( S.getNumCVTerms() == 2 );
       CVTerm cv2 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv2.setBiologicalQualifierType(libsbml.BQB_IS);
       cv2.addResource( "bar1");
       S.addCVTerm(cv2);
       assertTrue( S.getNumCVTerms() == 2 );
       res = S.getCVTerm(1).getResources();
       assertTrue( res.getLength() == 2 );
       assertTrue((  "bar" == res.getValue(0) ));
       assertTrue((  "bar1" == res.getValue(1) ));
       CVTerm cv4 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv4.setBiologicalQualifierType(libsbml.BQB_IS);
       cv4.addResource( "bar1");
       S.addCVTerm(cv4);
       assertTrue( S.getNumCVTerms() == 2 );
       res = S.getCVTerm(1).getResources();
       assertTrue( res.getLength() == 2 );
       assertTrue((  "bar" == res.getValue(0) ));
       assertTrue((  "bar1" == res.getValue(1) ));
       CVTerm cv5 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv5.setBiologicalQualifierType(libsbml.BQB_HAS_PART);
       cv5.addResource( "bar1");
       S.addCVTerm(cv5);
       assertTrue( S.getNumCVTerms() == 2 );
       res = S.getCVTerm(1).getResources();
       assertTrue( res.getLength() == 2 );
       assertTrue((  "bar" == res.getValue(0) ));
       assertTrue((  "bar1" == res.getValue(1) ));
       cv = null;
       cv2 = null;
       cv1 = null;
       cv4 = null;
 }
コード例 #7
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;
 }
コード例 #8
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 public void test_SBase_unsetCVTerms()
 {
     CVTerm cv = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(libsbml.BQB_ENCODES);
       cv.addResource( "foo");
       S.setMetaId( "sbase1");
       S.addCVTerm(cv);
       CVTerm cv1 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv1.setBiologicalQualifierType(libsbml.BQB_IS);
       cv1.addResource( "bar");
       S.addCVTerm(cv1);
       CVTerm cv2 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv2.setBiologicalQualifierType(libsbml.BQB_IS);
       cv2.addResource( "bar1");
       S.addCVTerm(cv2);
       CVTerm cv4 = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv4.setBiologicalQualifierType(libsbml.BQB_IS);
       cv4.addResource( "bar1");
       S.addCVTerm(cv4);
       assertTrue( S.getNumCVTerms() == 2 );
       S.unsetCVTerms();
       assertTrue( S.getNumCVTerms() == 0 );
       assertTrue( S.getCVTerms() == null );
       cv = null;
       cv2 = null;
       cv1 = null;
       cv4 = null;
 }
コード例 #9
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 public void test_SBase_unsetAnnotationWithCVTerms()
 {
     CVTerm cv;
       string annt = "<annotation>\n" +
     "  <test:test xmlns:test=\"http://test.org/test\">this is a test node</test:test>\n" +
     "</annotation>";
       string annt_with_cvterm = "<annotation>\n" +
     "  <test:test xmlns:test=\"http://test.org/test\">this is a test node</test:test>\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" +
     "      <bqbiol:is>\n" +
     "        <rdf:Bag>\n" +
     "          <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0005895\"/>\n" +
     "        </rdf:Bag>\n" +
     "      </bqbiol:is>\n" +
     "    </rdf:Description>\n" +
     "  </rdf:RDF>\n" +
     "</annotation>";
       S.setAnnotation(annt);
       assertTrue( S.isSetAnnotation() == true );
       assertTrue(( annt == S.getAnnotationString() ));
       S.unsetAnnotation();
       assertTrue( S.isSetAnnotation() == false );
       assertTrue( S.getAnnotation() == null );
       S.setAnnotation(annt);
       S.setMetaId( "_000001");
       cv = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(libsbml.BQB_IS);
       cv.addResource( "http://www.geneontology.org/#GO:0005895");
       S.addCVTerm(cv);
       assertTrue( S.isSetAnnotation() == true );
       assertTrue(( annt_with_cvterm == S.getAnnotationString() ));
       S.unsetAnnotation();
       assertTrue( S.isSetAnnotation() == false );
       assertTrue( S.getAnnotation() == null );
       cv = null;
 }
コード例 #10
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 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;
 }
コード例 #11
0
ファイル: TestSBase.cs プロジェクト: mgaldzic/copasi_api
 public void test_SBase_CVTerms()
 {
     CVTerm cv = new  CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(libsbml.BQB_IS);
       cv.addResource( "foo");
       assertTrue( S.getNumCVTerms() == 0 );
       assertTrue( S.getCVTerms() == null );
       S.setMetaId( "_id");
       S.addCVTerm(cv);
       assertTrue( S.getNumCVTerms() == 1 );
       assertTrue( S.getCVTerms() != null );
       assertTrue( S.getCVTerm(0) != cv );
       cv = null;
 }
コード例 #12
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()) );
       }
       {
       }
 }
コード例 #13
0
ファイル: TestCVTerms.cs プロジェクト: mgaldzic/copasi_api
 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;
 }