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


Python ProvBundle.wasRevisionOf方法代码示例

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


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

示例1: primer_example

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import wasRevisionOf [as 别名]
def primer_example():
    # https://github.com/lucmoreau/ProvToolbox/blob/master/asn/src/test/resources/prov/primer.pn
    #===========================================================================
    # bundle
    # 
    #   prefix ex <http://example/>
    # 
    #   entity(ex:article, [dcterms:title="Crime rises in cities"])
    #   entity(ex:dataSet1)
    #   entity(ex:dataSet2)
    #   entity(ex:regionList)
    #   entity(ex:composition)
    #   entity(ex:chart1)
    #   entity(ex:chart2)
    # 
    # 
    #   activity(ex:compile)
    #   activity(ex:compose)
    #   activity(ex:illustrate)
    # 
    # 
    #   used(ex:compose, ex:dataSet1, -)
    #   used(ex:compose, ex:regionList, -)
    #   wasGeneratedBy(ex:composition, ex:compose, -)
    # 
    #   used(ex:illustrate, ex:composition, -)
    #   wasGeneratedBy(ex:chart1, ex:illustrate, -)
    # 
    # 
    #   agent(ex:derek, [ prov:type="prov:Person", foaf:givenName = "Derek", 
    #          foaf:mbox= "<mailto:[email protected]>"])
    #   wasAssociatedWith(ex:compose, ex:derek, -)
    #   wasAssociatedWith(ex:illustrate, ex:derek, -)
    # 
    #   agent(ex:chartgen, [ prov:type="prov:Organization",
    #          foaf:name = "Chart Generators Inc"])
    #   actedOnBehalfOf(ex:derek, ex:chartgen, ex:compose)
    # 
    #   wasAttributedTo(ex:chart1, ex:derek)
    # 
    # 
    #   used(ex:compose, ex:dataSet1, -,   [ prov:role = "ex:dataToCompose"])
    #   used(ex:compose, ex:regionList, -, [ prov:role = "ex:regionsToAggregteBy"])
    # 
    # 
    #   wasRevisionOf(ex:dataSet2, ex:dataSet1, -)
    #   wasDerivedFrom(ex:chart2, ex:dataSet2)
    # 
    # endBundle
    #===========================================================================
    ex = Namespace('ex', 'http://example/')
    
    g = ProvBundle()
    g.add_namespace("dcterms","http://purl.org/dc/terms/")
    
    g.entity(ex['article'], {'dcterms:title': "Crime rises in cities"})
    g.entity(ex['dataSet1'])
    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')
    
    return g
开发者ID:YilinHao,项目名称:w3-prov,代码行数:88,代码来源:examples.py

示例2: open

# 需要导入模块: from prov.model import ProvBundle [as 别名]
# 或者: from prov.model.ProvBundle import wasRevisionOf [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,代码来源:


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