OR2YW工具
or2ywtool的Python项目详细描述
或2ywtool
Openrefine到Yesworkflow模型工具
openrefine to yesworkflow model(or2yw)工具包存储库包含or2yw examples文件夹,其中使用Ecologic_啮齿动物数据集和nypl(纽约公共图书馆)菜单数据集作为示例。
概述
该工具旨在提供从openrefine操作历史json文件到yesworklfow模型的自动解析方法。我们知道,openrefine操作历史json文件作为一个数据争用工作流工作但是,工作流的结构不够透明,无法了解列操作的依赖性和独立性。通过yw模型,将openrefine操作分为模式级和列级两个层次。
1.回购结构
1.1或2yw_示例
folder | Description |
---|---|
Ecology_rodents | Portal_rodents_19772002_scinameUUIDs.csv |
NYPL | What's on the Menu? |
以nypl文件夹为例:
folder | Function |
---|---|
dataset | "messy dataset" |
facts | "File for storing prolog facts about scripts" |
gv | Save the DOT output to a file |
Render gv file as PDF file using Graphviz's dot command | |
png | Render gv file as PNG file using Graphviz's dot command |
results | Screenshot the models |
script | Auto-parsing file: Linear/Serial-Parallell and the Openrefine json file |
yw | The parsed yw comments |
yw.properties | yw settings for graph(yw) command |
yw_generate.sh | cheatsheet command |
1.2或2ywtool
该工具旨在将json格式的openrefine recipe与yesworkflow连接起来,生成并行和串行的概念模型。通过这种方式,可以清楚地显示每个数据清理步骤之间的依赖关系。
2.工具包的使用
- Python版本:3+
从pip install安装or2yw软件包:
$ pip install or2ywtool
(注意:仔细检查pip版本,如果pip是针对版本2的,则使用pip3安装…) 如果要升级or2ywtool的版本
$ pip install upgrade or2ywtool
- 成功安装or2yw工具后,有两种方法可以使用该工具。
2.1生成yw文件,复制并粘贴到yesworkflow编辑器(无需安装其他依赖包)
$ or2yw
usage: __main__.py [-h] [-i INPUT] [-o OUTPUT] [-t TYPE] [-ot OUTPUTTYPE]
[-j JAVA] [-dot DOT] [-title TITLE] [-desc DESCRIPTION]
OR2YW v0.0.1
optional arguments:
-h, --help show this help message and exit
-i INPUT, --input INPUT
openrefine json file
-o OUTPUT, --output OUTPUT
yesworkflow output file
-t TYPE, --type TYPE Workflow Type, Produce [serial,parallel] workflow,
Default: serial
-ot OUTPUTTYPE, --outputtype OUTPUTTYPE
Output Type, Produce output [yw,gv,png,svg,pdf],
Default: yw (only yw for now other file type will
available in the next release)
-j JAVA, --java JAVA Java Path, if not initialized will use the java
installation environment path
-dot DOT, --dot DOT Dot Path, if not initialized will use the dot
installation environment path
-title TITLE, --title TITLE
Title for the Workflow
-desc DESCRIPTION, --description DESCRIPTION
Description for the Workflow
a.生成序列yw文件:
$ or2yw -i or2ywtool/test.json -o test.yw
b.生成并行yw文件:
$ or2yw -i or2ywtool/test.json -o test.yw -t parallel
c.测试Yesworkflow编辑器:Yesworkflow
2.2使用工具生成pdf/png(**需要Graphviz安装)
a.检查Graphviz版本:
$ dot -V
dot - graphviz version 2.39.20160823.1445 (20160823.1445)
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_dot_layout.6.dylib
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.6.dylib
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
/usr/local/lib/graphviz/config6
was successfully loaded.
render : dot dot_json fig json json0 map mp pic pov ps quartz svg tk vml xdot xdot_json
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
textlayout : textlayout
device : bmp canon cgimage cmap cmapx cmapx_np dot dot_json eps exr fig gif gv icns ico imap imap_np ismap jp2 jpe jpeg jpg json json0 mp pct pdf pic pict plain plain-ext png pov ps ps2 psd sgi svg svgz tga tif tiff tk vml vmlz xdot xdot1.2 xdot1.4 xdot_json
loadimage : (lib) bmp eps gif jpe jpeg jpg pdf png ps svg
**请检查您的点信息,可能会出现以下问题:“格式:pdf/png无法识别…”,然后确保设备可以支持此处的格式
b.安装最新版本Download Graphviz:
1)。对于Mac用户(例如使用自制):
$ brew install graphviz
(第二章)。对于windows用户,请从download网站中选择一种方法
(第三章)对于Linux用户,请从download网站中选择一种方法
c.如果无法识别格式:
d.使用命令生成yesworkflow pdf/png文件(将json文件插入正确的路径,并输入文件名):
例1。生成**并行Yesworkflow模型pdf文件:
$ or2yw -i or2ywtool/test.json -o testa.pdf -ot pdf -t parallel
例2生成**并行Yesworkflow模型PNG文件:
$ or2yw -i or2ywtool/test.json -o testa.png -ot png -t parallel
例3生成**线性Yesworkflow模型PDF文件:
$ or2yw -i or2ywtool/test.json -o testa.pdf -ot pdf
例4。生成**线性Yesworkflow模型PNG文件:
$ or2yw -i or2ywtool/test.json -o testa.png -ot png