def testGetGraphRoUri(self): rodir = self.createTestRo(testbase, "data/ro-test-1", "RO test graph", "ro-testRoGraph") rograph = ro_manifest.readManifestGraph(rodir) self.assertEquals(ro_manifest.getGraphRoUri(rodir, rograph), rdflib.URIRef("file://%s/RO_test_graph/"%(robase_abs))) self.deleteTestRo(rodir) return
def checkManifestGraphOmits(self, rodir, rograph): """ Check manifest file contains all statements from supplied graph """ m_graph = ro_manifest.readManifestGraph(rodir) for (s,p,o) in rograph: if isinstance(s, rdflib.BNode): s = None if isinstance(o, rdflib.BNode): o = None self.assertNotIn((s,p,o), m_graph, "Unexpected in manifest: "+repr((s, p, o))) return
def testManifestContent(self): """ Test content of newly created manifest """ rodir = self.createTestRo(testbase, "data/ro-test-1", "RO test annotation", "ro-testRoAnnotate") ro_graph = ro_manifest.readManifestGraph(rodir) self.checkManifestGraph(rodir, ro_graph) s = ro_manifest.getComponentUri(rodir, "") g = rdflib.Graph() g.add( (s, RDF.type, RO.ResearchObject ) ) g.add( (s, DCTERMS.creator, rdflib.Literal(ro_test_config.ROBOXUSERNAME) ) ) g.add( (s, DCTERMS.description, rdflib.Literal("RO test annotation") ) ) g.add( (s, DCTERMS.title, rdflib.Literal("RO test annotation") ) ) g.add( (s, DCTERMS.identifier, rdflib.Literal("ro-testRoAnnotate") ) ) self.checkManifestGraph(rodir, g) self.deleteTestRo(rodir) return