本文整理汇总了Python中workflow.Workflow.reduce_rdds方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.reduce_rdds方法的具体用法?Python Workflow.reduce_rdds怎么用?Python Workflow.reduce_rdds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.reduce_rdds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from workflow import Workflow [as 别名]
# 或者: from workflow.Workflow import reduce_rdds [as 别名]
#2. Apply the karma Model
outputRDD = workflow.run_karma(inputRDD,
"https://raw.githubusercontent.com/american-art/npg/master/NPGConstituents/NPGConstituents-model.ttl",
"http://americanartcollaborative.org/npg/",
"http://www.cidoc-crm.org/cidoc-crm/E39_Actor1",
"https://raw.githubusercontent.com/american-art/aac-alignment/master/karma-context.json",
num_partitions=numPartitions,
data_type="csv",
additional_settings={"karma.input.delimiter":","})
#3. Save the output
# fileUtil.save_file(outputRDD, outputFilename, "text", "json")
#4. Reduce rdds
reducedRDD = workflow.reduce_rdds(numFramerPartitions, outputRDD)
reducedRDD.persist()
types = [
{"name": "E39_Actor", "uri": "http://www.cidoc-crm.org/cidoc-crm/E39_Actor"},
{"name": "E82_Actor_Appellation", "uri": "http://www.cidoc-crm.org/cidoc-crm/E82_Actor_Appellation"},
{"name": "E67_Birth", "uri": "http://www.cidoc-crm.org/cidoc-crm/E67_Birth"},
{"name": "E69_Death", "uri": "http://www.cidoc-crm.org/cidoc-crm/E69_Death"},
{"name": "E52_Time-Span", "uri": "http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span"}
]
frames = [
{"name": "npgConstituents", "url": "https://raw.githubusercontent.com/american-art/aac-alignment/master/frames/npgConsitituents.json-ld"}
]
type_to_rdd_json = workflow.apply_partition_on_types(reducedRDD, types)
示例2:
# 需要导入模块: from workflow import Workflow [as 别名]
# 或者: from workflow.Workflow import reduce_rdds [as 别名]
# inputRDD = workflow.batch_read_csv(inputFilename)
#2. Apply the karma Model
outputRDD = workflow.run_karma(inputRDD,
"https://raw.githubusercontent.com/american-art/autry/master/AutryMakers/AutryMakers-model.ttl",
"http://dig.isi.edu/AutryMakers/",
"http://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Object1",
"https://raw.githubusercontent.com/american-art/aac-alignment/master/karma-context.json",
data_type="csv",
additional_settings={"karma.input.delimiter":","})
#3. Save the output
# fileUtil.save_file(outputRDD, outputFilename, "text", "json")
reducedRDD = workflow.reduce_rdds(outputRDD)
reducedRDD.persist()
types = [
{"name": "E82_Actor_Appellation", "uri": "http://www.cidoc-crm.org/cidoc-crm/E82_Actor_Appellation"}
]
frames = [
{"name": "AutryMakers", "url": "https://raw.githubusercontent.com/american-art/aac-alignment/master/frames/autryMakers.json-ld"}
]
context = workflow.read_json_file(contextUrl)
framer_output = workflow.apply_framer(reducedRDD, types, frames)
for frame_name in framer_output:
outputRDD = workflow.apply_context(framer_output[frame_name], context, contextUrl)
#apply mapValues function
outputRDD_after = outputRDD.mapValues(mapFunc)