当前位置: 首页>>代码示例>>Python>>正文


Python ProvBundle.agent方法代码示例

本文整理汇总了Python中prov.model.ProvBundle.agent方法的典型用法代码示例。如果您正苦于以下问题:Python ProvBundle.agent方法的具体用法?Python ProvBundle.agent怎么用?Python ProvBundle.agent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prov.model.ProvBundle的用法示例。


在下文中一共展示了ProvBundle.agent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bundles2

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [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
开发者ID:satra,项目名称:prov,代码行数:58,代码来源:examples.py

示例2: bundles1

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [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
开发者ID:satra,项目名称:prov,代码行数:57,代码来源:examples.py

示例3: create_bundle_cron_register

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_cron_register(cron):
    '''An cron user account is created'''
    bundle_id = 'b:registration/%d' % cron.id
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    s = b.agent("server:1")
    u = b.agent('cronuser:%d' % cron.id, [('foaf:name', cron.user.username)])
    now = datetime.datetime.now()
    a = b.activity('log:%d/register' % cron.id, now, now, other_attributes=[('prov:type', 'act:CronAccountRegistration')])
    b.wasGeneratedBy(u, a)
    b.wasAssociatedWith(a, s)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:13,代码来源:provlogging.py

示例4: createTripCreationGraph

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
    def createTripCreationGraph(self, userName, userEmail, tripId, tripLegIds, startTime, endTime):
        """Creates and stores the provenacne graph depecting the action of creating the trip"""
        #startTime = datetime.datetime.strptime(startTime, "%a, %d %b %Y %H:%M:%S %Z")
        #endTime = datetime.datetime.strptime(endTime, "%a, %d %b %Y %H:%M:%S %Z")
        #the namespace of the project
        cf = Namespace('cf', 'http://users.ecs.soton.ac.uk/pp6g11/ontology/carbonFooprints/')
        
        # create a provenance _container
        g = ProvBundle()
    
        g.add_namespace("foaf", "http://xmlns.com/foaf/0.1/")
        
        #create activity
        g.activity(cf['tripCreation'], startTime, endTime)
        
        #create entities.
        g.entity(cf['trip-' + tripId])
        
        #create trip leg entities
        for tripLegId in tripLegIds:
            tripLegId = str(tripLegId)
            g.entity(cf['tripLeg-' + tripLegId])
            g.wasGeneratedBy('cf:tripLeg-' + tripLegId, 'cf:tripCreation')
            g.wasDerivedFrom('cf:trip-' + tripId, 'cf:tripLeg-' + tripLegId)
        
        #add relations
        g.wasGeneratedBy('cf:trip-' + tripId, 'cf:tripCreation')
        
        #create agent
        g.agent('cf:' + userName, {'prov:type': 'prov:Person', 'foaf:mbox': '<mailto:' + userEmail + '>'})
              
        g.wasAssociatedWith('cf:tripCreation', 'cf:' + userName)
        g.wasAttributedTo('cf:trip-' + tripId, 'cf:' + userName)
        
        #save the graph
        pdBundle = save_bundle(g)
        
        #visualize the graph
        path = tempfile.mkdtemp()
        filepath = os.path.join(path, 'dot-test.png')
    
        # Convert it to DOT
        dot = graph.prov_to_dot(g)
        dot.set_dpi(120)
        # Write it to a temporary PNG file
        #dot.write_png(filepath)
    
        # Display it using matplotlib
        #img = mpimg.imread(filepath)
        ##imgplot = plt.imshow(img)
        #plt.show()
        #os.remove(filepath)

        return pdBundle
开发者ID:ppoliani,项目名称:Thesis,代码行数:56,代码来源:ProvManager.py

示例5: create_bundle_mop_register

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_register(cron, mop, session_key):
    '''An mop user account is created'''
    bundle_id = 'b:registration/%d' % mop.id
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    s = b.agent('cronuser:%d/%s' % (cron.id, session_key))
    u = b.agent('mopuser:%d' % mop.id, [('foaf:name', mop.user.username)])
    now = datetime.datetime.now()
    a = b.activity('log:%d/register' % mop.id, now, now, other_attributes=[('prov:type', 'act:MopAccountRegistration')])
    b.wasGeneratedBy(u, a)
    b.wasAssociatedWith(a, s)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:13,代码来源:provlogging.py

示例6: create_bundle_mop_login

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_login(user_id, session_key):
    '''User id 2 logs into the system'''
    bundle_id = 'b:%s/login' % session_key
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    u = b.agent('mopuser:%d' % user_id)
    ag = b.agent('mopuser:%d/%s' % (user_id, session_key))
    now = datetime.datetime.now()
    a = b.activity('log:%d/login/%s' % (user_id, session_key), now, now, other_attributes=[('prov:type', 'act:MopAccountLogin')])
    b.wasAssociatedWith(a, u)
    b.wasGeneratedBy(ag, a)
    b.specializationOf(ag, u)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:14,代码来源:provlogging.py

示例7: test_inferred_retyping_in_flattened_documents

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [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)
开发者ID:pombredanne,项目名称:prov,代码行数:15,代码来源:testModel.py

示例8: create_bundle_mop_sign_form

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_sign_form(user_id,
                                session_key,
                                blank_form_serial,
                                signed_form_id,
                                form_data=None):
    bundle_id = 'b:%s/form/signing/%d' % (session_key, signed_form_id)
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri())

    ag = b.agent('mopuser:%d/%s' % (user_id, session_key))
    bf = b.entity('form:blank/%s' % blank_form_serial,
                  [('prov:type', 'asset:BlankForm')])
    now = datetime.datetime.now()
    a = b.activity('ns:sign-form/%s' % blank_form_serial, now, now)
    b.wasAssociatedWith(a, ag)
    b.used(a, bf)
    data = {'prov:type': 'asset:SignedForm'}
    # Add relevant extra data of the form here
    if form_data is not None:
        data['mop:data'] = form_data
    sf = b.entity('form:signed/%s/%d' % (blank_form_serial, signed_form_id),
                  data)
    b.wasGeneratedBy(sf, a)
    b.wasAttributedTo(sf, ag)
    return bundle_id, b
开发者ID:bachour,项目名称:deptx,代码行数:27,代码来源:provlogging.py

示例9: create_bundle_mop_logout

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_logout(user_id, session_key):
    bundle_id = 'b:%s/logout' % session_key
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri())

    ag = b.agent('mopuser:%d/%s' % (user_id, session_key))
    now = datetime.datetime.now()
    a = b.activity('log:%d/login/%s' % (user_id, session_key), now, now, other_attributes=[('prov:type', 'act:MopAccountLogout')])
    b.wasInvalidatedBy(ag, a)  # This user+session no longer exists after this
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:12,代码来源:provlogging.py

示例10: create_bundle_mop_send_form

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_send_form(user_id, session_key, signed_form_id, blank_form_serial, email_id, unit_serial):
    bundle_id = 'b:%s/form/sending/%d' % (session_key, email_id)
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri())

    ag = b.agent('mopuser:%d/%s' % (user_id, session_key))
    em = b.entity('email:%d' % email_id, [('prov:type', 'mop:Email'), ('mop:mailto', unit_serial)])
    sf = b.entity('form:signed/%s/%d' % (blank_form_serial, signed_form_id), [('prov:type', 'asset:SignedForm')])  # Add relevant extra data of the form here
    now = datetime.datetime.now()
    b.wasDerivedFrom(em, sf, time=now)
    b.wasAttributedTo(em, ag)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:14,代码来源:provlogging.py

示例11: create_bundle_mop_issue_form

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_issue_form(user_id, session_key, signed_form_id, old_blank_form_serial, email_id, new_blank_form_serial, unit_serial):
#     t = long(time.time())
    bundle_id = 'b:%s/form/issue/%s' % (session_key, new_blank_form_serial)
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri())

    ag = b.agent('dept:%s' % unit_serial)
    sf = b.entity('form:signed/%s/%d' % (old_blank_form_serial, signed_form_id))
    em = b.entity('email:%d' % email_id)
    now = datetime.datetime.now()
    a = b.activity('bs:issue-form/%s' % new_blank_form_serial, now, now)
    b.wasAssociatedWith(a, ag)
    b.used(a, em)
    nf = b.entity('form:blank/%s' % new_blank_form_serial)
    b.wasGeneratedBy(nf, a)
    b.wasDerivedFrom(nf, sf)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:19,代码来源:provlogging.py

示例12: create_bundle_mop_issue_document

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def create_bundle_mop_issue_document(user_id, session_key, email_id, blank_form_serial, signed_form_id, document_serial, document_instance_id, unit_serial):
    bundle_id = 'b:%s/document/issue/%s' % (session_key, document_instance_id)
    b = ProvBundle(namespaces=DEFAULT_NAMESPACES)
    b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri())

    ag = b.agent('dept:%s' % unit_serial)
    sf = b.entity('form:signed/%s/%d' % (blank_form_serial, signed_form_id))
    em = b.entity('email:%d' % email_id)
    now = datetime.datetime.now()
    a = b.activity('bs:issue-document/%d' % document_instance_id, now, now)
    b.wasAssociatedWith(a, ag)
    b.used(a, em)
    d = b.entity('document:%s' % document_serial, [('prov:type', 'asset:Document')])
    b.used(a, d)
    di = b.entity('document:%s/%d' % (document_serial, document_instance_id), [('prov:type', 'asset:MopDocumentInstance')])
    b.wasGeneratedBy(di, a)
    b.wasDerivedFrom(di, sf)
    b.wasDerivedFrom(di, d)
    return bundle_id, b
开发者ID:pombredanne,项目名称:deptx,代码行数:21,代码来源:provlogging.py

示例13: open

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
g.entity(ex['dataSet2'])
g.entity(ex['regionList'])
g.entity(ex['composition'])
g.entity(ex['chart1'])
g.entity(ex['chart2'])

g.activity(ex['compile'])
g.activity(ex['compose'])
g.activity(ex['illustrate'])

g.used('ex:compose', 'ex:dataSet1', other_attributes={'prov:role' : "ex:dataToCompose"})
g.used('ex:compose', 'ex:regionList', other_attributes={'prov:role' : "ex:regionsToAggregateBy"})
g.wasGeneratedBy('ex:composition', 'ex:compose')

g.used('ex:illustrate', 'ex:composition')
g.wasGeneratedBy('ex:chart1', 'ex:illustrate')

g.agent('ex:derek', {'prov:type': "prov:Person", 'foaf:givenName': "Derek", 'foaf:mbox': "<mailto:[email protected]>"})
g.wasAssociatedWith('ex:compose', 'ex:derek')
g.wasAssociatedWith('ex:illustrate', 'ex:derek')

g.agent('ex:chartgen', {'prov:type': "prov:Organization", 'foaf:name' : "Chart Generators Inc"})
g.actedOnBehalfOf('ex:derek', 'ex:chartgen', 'ex:compose')
g.wasAttributedTo('ex:chart1', 'ex:derek')

g.wasRevisionOf('ex:dataSet2', 'ex:dataSet1')
g.wasDerivedFrom('ex:chart2', 'ex:dataSet2')

with open('/Users/jason/Documents/ProvenanceTools/JasonTest3.provn', 'wt') as fp:
    fp.writelines(g.get_provn())
开发者ID:,项目名称:,代码行数:32,代码来源:

示例14: w3c_publication_2

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [as 别名]
def w3c_publication_2():
    # https://github.com/lucmoreau/ProvToolbox/blob/master/asn/src/test/resources/prov/w3c-publication2.prov-asn
    #===========================================================================
    # bundle
    # 
    # prefix ex <http://example.org/>
    # prefix rec <http://example.org/record>
    # 
    # prefix w3 <http://www.w3.org/TR/2011/>
    # prefix hg <http://dvcs.w3.org/hg/prov/raw-file/9628aaff6e20/model/releases/WD-prov-dm-20111215/>
    # 
    # 
    # entity(hg:Overview.html, [ prov:type="file in hg" ])
    # entity(w3:WD-prov-dm-20111215, [ prov:type="html4" ])
    # 
    # 
    # activity(ex:rcp,-,-,[prov:type="copy directory"])
    # 
    # wasGeneratedBy(rec:g; w3:WD-prov-dm-20111215, ex:rcp, -)
    # 
    # entity(ex:req3, [ prov:type="http://www.w3.org/2005/08/01-transitions.html#pubreq" %% xsd:anyURI ])
    # 
    # used(rec:u; ex:rcp,hg:Overview.html,-)
    # used(ex:rcp, ex:req3, -)
    # 
    # 
    # wasDerivedFrom(w3:WD-prov-dm-20111215, hg:Overview.html, ex:rcp, rec:g, rec:u)
    # 
    # agent(ex:webmaster, [ prov:type='prov:Person' ])
    # 
    # wasAssociatedWith(ex:rcp, ex:webmaster, -)
    # 
    # endBundle
    #===========================================================================

    ex = Namespace('ex', 'http://example.org/')
    rec = Namespace('rec', 'http://example.org/record')
    w3 = Namespace('w3', 'http://www.w3.org/TR/2011/')
    hg = Namespace('hg', 'http://dvcs.w3.org/hg/prov/raw-file/9628aaff6e20/model/releases/WD-prov-dm-20111215/')
    
    
    g = ProvBundle()
    
    g.entity(hg['Overview.html'], {'prov:type': "file in hg"})
    g.entity(w3['WD-prov-dm-20111215'], {'prov:type': "html4"})

    g.activity(ex['rcp'], None, None, {'prov:type': "copy directory"})

    g.wasGeneratedBy('w3:WD-prov-dm-20111215', 'ex:rcp', identifier=rec['g'])

    g.entity('ex:req3', {'prov:type': Identifier("http://www.w3.org/2005/08/01-transitions.html#pubreq")})
    
    g.used('ex:rcp', 'hg:Overview.html', identifier='rec:u')
    g.used('ex:rcp', 'ex:req3')
    
    g.wasDerivedFrom('w3:WD-prov-dm-20111215', 'hg:Overview.html', 'ex:rcp', 'rec:g', 'rec:u')

    g.agent('ex:webmaster', {'prov:type': "Person"})

    g.wasAssociatedWith('ex:rcp', 'ex:webmaster')
        
    return g
开发者ID:YilinHao,项目名称:w3-prov,代码行数:64,代码来源:examples.py

示例15: bundles1

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import agent [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
开发者ID:YilinHao,项目名称:w3-prov,代码行数:65,代码来源:examples.py


注:本文中的prov.model.ProvBundle.agent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。