update readme files

This commit is contained in:
Felix Lohmeier 2017-02-02 01:09:13 +01:00
parent 78a7a75515
commit 8716b15d4c
2 changed files with 22 additions and 8 deletions

View File

@ -5,6 +5,11 @@ OpenRefine Python Client Library
The OpenRefine Python Client Library provides an interface to The OpenRefine Python Client Library provides an interface to
communicating with an `OpenRefine <http://openrefine.org/>`_ server. communicating with an `OpenRefine <http://openrefine.org/>`_ server.
If you are looking for a command line interface to OpenRefine then you might be interested in the docker variation of this library:
`felixlohmeier/openrefine-client<https://hub.docker.com/r/felixlohmeier/openrefine-client/>`_. You will find examples for batch processing (e.g. for usage in shell scripts) there.
If you are familiar with python and want to go into more depth, then read on!
Currently, the following API is supported: Currently, the following API is supported:
- project creation/import, deletion, export - project creation/import, deletion, export

View File

@ -5,18 +5,20 @@ There are some client libraries for OpenRefine that communicate with the [OpenRe
### basic usage ### basic usage
1) start server: 1) start server:
```docker run -d --name=openrefine-server felixlohmeier/openrefine``` > docker run -d --name=openrefine-server felixlohmeier/openrefine
2) start client (prints help screen): 2) start client (prints help screen):
```docker run --rm --link openrefine-server felixlohmeier/openrefine-client``` > docker run --rm --link openrefine-server felixlohmeier/openrefine-client
3) cleanup: 3) cleanup:
```docker stop openrefine-server && docker rm openrefine-server``` > docker stop openrefine-server && docker rm openrefine-server
### example for customized run commands in interactive mode (e.g. for usage in terminals) ### example for customized run commands in interactive mode (e.g. for usage in terminals)
1) start server in terminal A: 1) start server in terminal A:
```docker run --rm --name=openrefine-server -p 80:3333 -v /home/felix/refine:/data:z felixlohmeier/openrefine -i 0.0.0.0 -m 4G -d /data``` ```docker run --rm --name=openrefine-server -p 80:3333 -v /home/felix/refine:/data:z felixlohmeier/openrefine -i 0.0.0.0 -m 4G -d /data```
* automatically remove docker container when it exits * automatically remove docker container when it exits
* set name "openrefine" for docker container * set name "openrefine" for docker container
* publish internal port 3333 to host port 80 * publish internal port 3333 to host port 80
@ -27,7 +29,9 @@ There are some client libraries for OpenRefine that communicate with the [OpenRe
* OpenRefine should be available at http://localhost * OpenRefine should be available at http://localhost
2) start client in terminal B (prints help screen): 2) start client in terminal B (prints help screen):
```docker run --rm --link openrefine-server -v /home/felix/refine:/data:z felixlohmeier/openrefine-client``` ```docker run --rm --link openrefine-server -v /home/felix/refine:/data:z felixlohmeier/openrefine-client```
* automatically remove docker container when it exits * automatically remove docker container when it exits
* build up network connection with docker container "openrefine" * build up network connection with docker container "openrefine"
* mount host directory /home/felix/refine as working directory * mount host directory /home/felix/refine as working directory
@ -35,26 +39,31 @@ There are some client libraries for OpenRefine that communicate with the [OpenRe
### example for customized run commands in detached mode (e.g. for usage in shell scripts) ### example for customized run commands in detached mode (e.g. for usage in shell scripts)
1) define variables 1) define variables (bring your own example data)
*```workingdir=/home/felix/refine``` > workingdir=/home/felix/refine
* ```inputfile=example.csv``` > inputfile=example.csv
* ```jsonfile=test.json``` > jsonfile=test.json
2) start server 2) start server
```docker run --d --name=openrefine-server -v ${workingdir}:/data:z felixlohmeier/openrefine -i 0.0.0.0 -m 4G -d /data``` ```docker run --d --name=openrefine-server -v ${workingdir}:/data:z felixlohmeier/openrefine -i 0.0.0.0 -m 4G -d /data```
3) create project (import file) 3) create project (import file)
```docker run --rm --link openrefine-server -v ${workingdir}:/data:z felixlohmeier/openrefine-client -c $inputfile``` ```docker run --rm --link openrefine-server -v ${workingdir}:/data:z felixlohmeier/openrefine-client -c $inputfile```
4) get project id 4) get project id
```project=($(docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client --list | cut -c 2-14))``` ```project=($(docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client --list | cut -c 2-14))```
5) apply transformations from json file 5) apply transformations from json file
```docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client -f ${jsonfile} ${project}``` ```docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client -f ${jsonfile} ${project}```
6) export project to file 6) export project to file
```docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client -E --output=${project}.tsv ${project}``` ```docker run --rm --link openrefine-server -v ${workingdir}:/data felixlohmeier/openrefine-client -E --output=${project}.tsv ${project}```
7) cleanup 7) cleanup
```docker stop -t=500 openrefine-server && docker rm openrefine-server``` ```docker stop -t=500 openrefine-server && docker rm openrefine-server```