本文整理汇总了Python中prov.model.ProvBundle.valid_identifier方法的典型用法代码示例。如果您正苦于以下问题:Python ProvBundle.valid_identifier方法的具体用法?Python ProvBundle.valid_identifier怎么用?Python ProvBundle.valid_identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prov.model.ProvBundle
的用法示例。
在下文中一共展示了ProvBundle.valid_identifier方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_bundle_mop_sign_form
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import valid_identifier [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
示例2: create_bundle_mop_logout
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import valid_identifier [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
示例3: create_bundle_mop_send_form
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import valid_identifier [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
示例4: create_bundle_mop_issue_form
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import valid_identifier [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
示例5: create_bundle_mop_issue_document
# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import valid_identifier [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