Example #1
0
    def test_non_unifiable_document(self):
        g = ProvBundle()
        g.add_namespace("ex", "http://www.example.com/")
        g.activity('ex:compose', other_attributes={'prov:role': "ex:dataToCompose1"})
        g.used('ex:compose', 'ex:testEntity')
        with self.assertRaises(ProvExceptionCannotUnifyAttribute):
            g.activity('ex:testEntity')

        h = g.bundle('ex:bundle')
        h.add_namespace("ex", "http://www.example.com/")
        h.entity('ex:compose', other_attributes={'prov:label': "impossible!!!"})

        with self.assertRaises(ProvExceptionCannotUnifyAttribute):
            g.get_flattened()
Example #2
0
    def test3(self):
        target = ProvBundle()
        target.activity('ex:compose', other_attributes=(('prov:role', "ex:dataToCompose1"), ('prov:role', "ex:dataToCompose2")))

        result = ProvBundle()
        result.activity('ex:compose', other_attributes={'prov:role': "ex:dataToCompose1"})
        result_inner = ProvBundle(identifier="ex:bundle1")
        result_inner.activity('ex:compose', other_attributes=(('prov:role', "ex:dataToCompose1"), ('prov:role', "ex:dataToCompose2")))
        result.add_bundle(result_inner)
        self.assertEqual(result.get_flattened(), target)
Example #3
0
    def test1(self):
        target = ProvBundle()
        target.activity('ex:correct', '2012-03-31T09:21:00', '2012-04-01T15:21:00')

        result = ProvBundle()
        result.activity('ex:correct', '2012-03-31T09:21:00')
        result_inner = ProvBundle(identifier="ex:bundle1")
        result_inner.activity('ex:correct', None, '2012-04-01T15:21:00')
        result.add_bundle(result_inner)
        self.assertEqual(result.get_flattened(), target)
Example #4
0
    def test_inferred_retyping_in_flattened_documents(self):
        g = ProvBundle()
        g.add_namespace("ex", "http://www.example.com/")
        g.wasGeneratedBy('ex:Bob', time='2012-05-25T11:15:00')
        b1 = g.bundle('ex:bundle')
        b1.agent('ex:Bob')

        h = ProvBundle()
        h.add_namespace("ex", "http://www.example.com/")
        h.agent('ex:Bob')
        h.wasGeneratedBy('ex:Bob', time='2012-05-25T11:15:00')

        self.assertEqual(g.get_flattened(), h)