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_L3ModelHistory_delete_Model() { XMLNode node = RDFAnnotationParser.parseModelHistory(m); XMLNode n1 = RDFAnnotationParser.deleteRDFAnnotation(node); string expected = "<annotation/>"; assertTrue(n1.getNumChildren() == 0); assertTrue(n1.getName() == "annotation"); assertEquals(true, equals(expected, n1.toXMLString())); node = null; }
public void test_RDFAnnotation2_modelWithHistoryAndMultipleModifiedDates() { ModelHistory h = new ModelHistory(); ModelCreator c = new ModelCreator(); c.setFamilyName("Keating"); c.setGivenName("Sarah"); h.addCreator(c); Date d = new Date(2005, 2, 2, 14, 56, 11); h.setCreatedDate(d); h.addModifiedDate(d); h.addModifiedDate(d); m2.unsetModelHistory(); m2.setModelHistory(h); 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>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" + " </dcterms:created>\n" + " <dcterms:modified rdf:parseType=\"Resource\">\n" + " <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" + " </dcterms:modified>\n" + " <dcterms:modified rdf:parseType=\"Resource\">\n" + " <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" + " </dcterms:modified>\n" + " </rdf:Description>\n" + " </rdf:RDF>\n" + "</annotation>"; assertEquals(true, equals(expected, ann.toXMLString())); }
public void test_L3ModelHistory_parseModelHistory_Model() { XMLNode node = RDFAnnotationParser.parseModelHistory(m); 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() == 4); XMLNode creator = desc.getChild(0); assertTrue(("creator" == creator.getName())); assertTrue(("dcterms" == creator.getPrefix())); assertTrue(creator.getNumChildren() == 1); XMLNode Bag = creator.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() == 1); 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() == 3); XMLNode N = li.getChild(0); assertTrue(("N" == N.getName())); assertTrue(("vCard" == N.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == N.getURI())); assertTrue(N.getNumChildren() == 2); XMLNode Family = N.getChild(0); assertTrue(("Family" == Family.getName())); assertTrue(("vCard" == Family.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == Family.getURI())); assertTrue(Family.getNumChildren() == 1); XMLNode Given = N.getChild(1); assertTrue(("Given" == Given.getName())); assertTrue(("vCard" == Given.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == Given.getURI())); assertTrue(Given.getNumChildren() == 1); XMLNode EMAIL = li.getChild(1); assertTrue(("EMAIL" == EMAIL.getName())); assertTrue(("vCard" == EMAIL.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == EMAIL.getURI())); assertTrue(EMAIL.getNumChildren() == 1); XMLNode ORG = li.getChild(2); assertTrue(("ORG" == ORG.getName())); assertTrue(("vCard" == ORG.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == ORG.getURI())); assertTrue(ORG.getNumChildren() == 1); XMLNode Orgname = ORG.getChild(0); assertTrue(("Orgname" == Orgname.getName())); assertTrue(("vCard" == Orgname.getPrefix())); assertTrue(("http://www.w3.org/2001/vcard-rdf/3.0#" == Orgname.getURI())); assertTrue(Orgname.getNumChildren() == 1); XMLNode created = desc.getChild(1); assertTrue(("created" == created.getName())); assertTrue(("dcterms" == created.getPrefix())); assertTrue(("http://purl.org/dc/terms/" == created.getURI())); assertTrue(created.getNumChildren() == 1); XMLNode cr_date = created.getChild(0); assertTrue(("W3CDTF" == cr_date.getName())); assertTrue(("dcterms" == cr_date.getPrefix())); assertTrue(("http://purl.org/dc/terms/" == cr_date.getURI())); assertTrue(cr_date.getNumChildren() == 1); XMLNode modified = desc.getChild(2); assertTrue(("modified" == modified.getName())); assertTrue(("dcterms" == modified.getPrefix())); assertTrue(("http://purl.org/dc/terms/" == modified.getURI())); assertTrue(modified.getNumChildren() == 1); XMLNode mo_date = created.getChild(0); assertTrue(("W3CDTF" == mo_date.getName())); assertTrue(("dcterms" == mo_date.getPrefix())); assertTrue(("http://purl.org/dc/terms/" == mo_date.getURI())); assertTrue(mo_date.getNumChildren() == 1); node = null; }