def testRemoveGetRoAnnotations(self):
     rodir = self.createTestRo(testbase, "data/ro-test-1", "Test remove RO annotation", "ro-testRoAnnotate")
     roresource = "."
     # Remove some anotations for RO
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "type",         "Research Object")
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "title",        "Test remove RO annotation")
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "description",  None)
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "note",         "Research object created for annotation testing")
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "created",      None)
     # Retrieve the anotations
     annotations = ro_annotation._getRoAnnotations(rodir)
     rouri = ro_manifest.getRoUri(rodir)
     expected_annotations = (
         [ (rouri, DCTERMS.creator,      rdflib.Literal('Test User'))
         , (rouri, DCTERMS.identifier,   rdflib.Literal('ro-testRoAnnotate'))
         , (rouri, RDF.type,             RO.ResearchObject)
         ])
     for i in range(4):
         next = annotations.next()
         #log.debug("Next %s"%(repr(next)))
         if ( next not in expected_annotations and
              next[1] != DCTERMS.created       and
              next[1] != ORE.aggregates        ):
             self.assertTrue(False, "Not expected (%d) %s"%(i, repr(next)))
     self.assertRaises(StopIteration, annotations.next)
     self.deleteTestRo(rodir)
     return
 def testRemoveGetFileAnnotations(self):
     rodir = self.createTestRo(testbase, "data/ro-test-1", "Test remove file annotation", "ro-testRoAnnotate")
     roresource = "subdir1/subdir1-file.txt"
     # Add anotations for file
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "type",         "Test file")
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "description",  "File in test research object")
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "note",         "Research object file created for annotation testing")
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "title",        "Test file in RO")
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "created",      "2011-12-07")
     ro_annotation._addSimpleAnnotation(ro_config, rodir, roresource,
         "rdf:type",     ROTERMS.resource)
     # Remove annotations
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "description",  "File in test research object")
     ro_annotation._removeSimpleAnnotation(ro_config, rodir, roresource,
         "note",         None)
     # Retrieve the file anotations
     annotations = ro_annotation._getFileAnnotations(rodir, roresource)
     resourceuri = ro_manifest.getComponentUri(rodir, roresource)
     log.debug("resourceuri: %s"%(resourceuri))
     expected_annotations = (
         [ (resourceuri, DCTERMS.type,         rdflib.Literal('Test file'))
         , (resourceuri, DCTERMS.title,        rdflib.Literal('Test file in RO'))
         , (resourceuri, DCTERMS.created,      rdflib.Literal('2011-12-07'))
         , (resourceuri, RDF.type,             ROTERMS.resource)
         ])
     for i in range(4):
         next = annotations.next()
         #log.debug("Next %s"%(repr(next)))
         if ( next not in expected_annotations):
             self.assertTrue(False, "Not expected (%d) %s"%(i, repr(next)))
     self.assertRaises(StopIteration, annotations.next)
     self.deleteTestRo(rodir)
     return