本文整理汇总了Python中prov.model.ProvBundle.bundle方法的典型用法代码示例。如果您正苦于以下问题:Python ProvBundle.bundle方法的具体用法?Python ProvBundle.bundle怎么用?Python ProvBundle.bundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prov.model.ProvBundle
的用法示例。
在下文中一共展示了ProvBundle.bundle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: bundles2
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import bundle [as 别名]
def bundles2():
# https://github.com/lucmoreau/ProvToolbox/blob/master/prov-n/src/test/resources/prov/bundles2.provn
# ===========================================================================
# document
g = ProvBundle()
# prefix ex <http://example.org/example/>
g.add_namespace("ex", "http://www.example.com/")
# prefix alice <http://example.org/alice/>
# prefix bob <http://example.org/bob/>
g.add_namespace("alice", "http://example.org/alice/")
g.add_namespace("bob", "http://example.org/bob/")
# entity(bob:bundle4, [prov:type='prov:Bundle'])
# wasGeneratedBy(bob:bundle4, -, 2012-05-24T10:30:00)
# agent(ex:Bob)
# wasAttributedTo(bob:bundle4, ex:Bob)
g.entity("bob:bundle4", {"prov:type": PROV["Bundle"]})
g.wasGeneratedBy("bob:bundle4", time="2012-05-24T10:30:00")
g.agent("ex:Bob")
g.wasAttributedTo("bob:bundle4", "ex:Bob")
# entity(alice:bundle5, [ prov:type='prov:Bundle' ])
# wasGeneratedBy(alice:bundle5, -, 2012-05-25T11:15:00)
# agent(ex:Alice)
# wasAttributedTo(alice:bundle5, ex:Alice)
g.entity("alice:bundle5", {"prov:type": PROV["Bundle"]})
g.wasGeneratedBy("alice:bundle5", time="2012-05-25T11:15:00")
g.agent("ex:Alice")
g.wasAttributedTo("alice:bundle5", "ex:Alice")
# bundle bob:bundle4
# entity(ex:report1, [ prov:type="report", ex:version=1 ])
# wasGeneratedBy(ex:report1, -, 2012-05-24T10:00:01)
# endBundle
b4 = g.bundle("bob:bundle4")
b4.entity("ex:report1", {"prov:type": "report", "ex:version": 1})
b4.wasGeneratedBy("ex:report1", time="2012-05-24T10:00:01")
# bundle alice:bundle5
# entity(ex:report1bis)
# mentionOf(ex:report1bis, ex:report1, bob:bundle4)
# entity(ex:report2, [ prov:type="report", ex:version=2 ])
# wasGeneratedBy(ex:report2, -, 2012-05-25T11:00:01)
# wasDerivedFrom(ex:report2, ex:report1bis)
# endBundle
b5 = g.bundle("alice:bundle5")
b5.entity("ex:report1bis")
b5.mentionOf("ex:report1bis", "ex:report1", "bob:bundle4")
b5.entity("ex:report2", [("prov:type", "report"), ("ex:version", 2)])
b5.wasGeneratedBy("ex:report2", time="2012-05-25T11:00:01")
b5.wasDerivedFrom("ex:report2", "ex:report1bis")
# endDocument
return g
示例2: bundles1
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import bundle [as 别名]
def bundles1():
# https://github.com/lucmoreau/ProvToolbox/blob/master/prov-n/src/test/resources/prov/bundles1.provn
# ===============================================================================
# document
g = ProvBundle()
# prefix ex <http://example.org/example/>
EX = Namespace("ex", "http://www.example.com/")
g.add_namespace(EX)
# prefix alice <http://example.org/alice/>
# prefix bob <http://example.org/bob/>
g.add_namespace("alice", "http://example.org/alice/")
g.add_namespace("bob", "http://example.org/bob/")
# entity(bob:bundle1, [prov:type='prov:Bundle'])
g.entity("bob:bundle1", {"prov:type": PROV["Bundle"]})
# wasGeneratedBy(bob:bundle1, -, 2012-05-24T10:30:00)
g.wasGeneratedBy("bob:bundle1", time="2012-05-24T10:30:00")
# agent(ex:Bob)
g.agent("ex:Bob")
# wasAttributedTo(bob:bundle1, ex:Bob)
g.wasAttributedTo("bob:bundle1", "ex:Bob")
# entity(alice:bundle2, [ prov:type='prov:Bundle' ])
g.entity("alice:bundle2", {"prov:type": PROV["Bundle"]})
# wasGeneratedBy(alice:bundle2, -, 2012-05-25T11:15:00)
g.wasGeneratedBy("alice:bundle2", time="2012-05-25T11:15:00")
# agent(ex:Alice)
g.agent("ex:Alice")
# wasAttributedTo(alice:bundle2, ex:Alice)
g.wasAttributedTo("alice:bundle2", "ex:Alice")
# bundle bob:bundle1
b1 = g.bundle("bob:bundle1")
# entity(ex:report1, [ prov:type="report", ex:version=1 ])
b1.entity("ex:report1", {"prov:type": "report", "ex:version": 1})
# wasGeneratedBy(ex:report1, -, 2012-05-24T10:00:01)
b1.wasGeneratedBy("ex:report1", time="2012-05-24T10:00:01")
# endBundle
# bundle alice:bundle2
b2 = g.bundle("alice:bundle2")
# entity(ex:report1)
b2.entity("ex:report1")
# entity(ex:report2, [ prov:type="report", ex:version=2 ])
b2.entity("ex:report2", {"prov:type": "report", "ex:version": 2})
# wasGeneratedBy(ex:report2, -, 2012-05-25T11:00:01)
b2.wasGeneratedBy("ex:report2", time="2012-05-25T11:00:01")
# wasDerivedFrom(ex:report2, ex:report1)
b2.wasDerivedFrom("ex:report2", "ex:report1")
# endBundle
# endDocument
return g
示例3: test_inferred_retyping_in_flattened_documents
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import bundle [as 别名]
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)
示例4: test_non_unifiable_document
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import bundle [as 别名]
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()
示例5: bundles1
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import bundle [as 别名]
def bundles1():
# https://github.com/lucmoreau/ProvToolbox/blob/master/asn/src/test/resources/prov/bundles1.provn
#===============================================================================
# bundle
#
# prefix ex <http://example.org/example/>
#
# prefix alice <http://example.org/alice/>
# prefix bob <http://example.org/bob/>
#
# entity(bob:bundle1, [prov:type='prov:Bundle'])
# wasGeneratedBy(bob:bundle1, -, 2012-05-24T10:30:00)
# agent(ex:Bob)
# wasAttributedTo(bob:bundle1, ex:Bob)
#
# entity(alice:bundle2, [ prov:type='prov:Bundle' ])
# wasGeneratedBy(alice:bundle2, -, 2012-05-25T11:15:00)
# agent(ex:Alice)
# wasAttributedTo(alice:bundle2, ex:Alice)
#
# bundle bob:bundle1
# entity(ex:report1, [ prov:type="report", ex:version=1 ])
# wasGeneratedBy(ex:report1, -, 2012-05-24T10:00:01)
# endBundle
#
# bundle alice:bundle2
# entity(ex:report1)
# entity(ex:report2, [ prov:type="report", ex:version=2 ])
# wasGeneratedBy(ex:report2, -, 2012-05-25T11:00:01)
# wasDerivedFrom(ex:report2, ex:report1)
# endBundle
#
# endBundle
#===============================================================================
EX = Namespace("ex","http://www.example.com/")
g = ProvBundle()
g.add_namespace(EX)
g.add_namespace('alice', 'http://example.org/alice/')
g.add_namespace('bob', 'http://example.org/bob/')
g.entity('bob:bundle1', {'prov:type': PROV['Bundle']})
g.wasGeneratedBy('bob:bundle1', time='2012-05-24T10:30:00')
g.agent('ex:Bob')
g.wasAttributedTo('bob:bundle1', 'ex:Bob')
g.entity('alice:bundle2', {'prov:type': PROV['Bundle']})
g.wasGeneratedBy('alice:bundle2', time='2012-05-25T11:15:00')
g.agent('ex:Alice')
g.wasAttributedTo('alice:bundle2', 'ex:Alice')
b1 = g.bundle('bob:bundle1')
b1.entity('ex:report1', {'prov:type': "report", 'ex:version': 1})
b1.wasGeneratedBy('ex:report1', time='2012-05-24T10:00:01')
b2 = g.bundle('alice:bundle2')
b2.entity('ex:report1')
b2.entity('ex:report2', {'prov:type': "report", 'ex:version': 2})
b2.wasGeneratedBy('ex:report2', time='2012-05-25T11:00:01')
b2.wasDerivedFrom('ex:report2', 'ex:report1')
return g