CSIRO-enviro-informatics / ldrpyutils

Python utils for the Linked Data Registry
https://csiro-enviro-informatics.github.io/ldrpyutils
Other
3 stars 3 forks source link

ldrpyutils

Python utils for the Linked Data Registry (https://csiro-enviro-informatics.github.io/ldrpyutils).

Build Status

About

This repository provides Python-based tools to interface with any Linked Data Registry instances. Currently tools developed help users with vocabulary content maintained in a Excel format upload/update it to a Linked Data Registry instance.

The two pathways for this is via:

Details are provided below.

Citation

Persistent Link: http://doi.org/10.4225/08/5a2744c74d949 Attribution Statement: Yu, Jonathan (2017): ldrpyutils. v1. CSIRO. Software Collection. 10.4225/08/5a2744c74d949

Excel2ldrGui Window-based tool

(https://csiro-enviro-informatics.github.io/ldrpyutils/index#excel2ldr)

Excel2ldrGui is a GUI front-end to Excel-to-LDR to help users upload and update content on a Linked Data Registry.

Excel2ldrGui screenshot

The standalone executables have been precompiled for Windows and Mac. Download here

Pre-requisites

  1. Access to a Linked Data Registry instance, e.g. http://registry.it.csiro.au/
  2. User account on a Linked Data Registry instance
  3. Stub registers created on Linked Data Registry instance

Example Excel formats

For Excel2ldrGui, you will need to use a simple excel format or a multiple-register excel format. Examples of these are providedin the test-data repository.

  1. Single register of vocabs (i.e. simple list) - see test-data/simple.xlsx
  2. Multiple registers of vocabs (i.e. one for each sheet) - see test-data/multi-register.xlsx

excel2ldr command line tool

Quickstart

$ pip install ldrpyutils

# download starter pack
$ wget https://github.com/CSIRO-LW-LD/ldrpyutils/blob/master/quickstart/csiro-starter-pack.zip
$ unzip csiro-starter-pack.zip

# edit fields in examples/simple.xlsx to point to your register on a LDR instance
# edit config to point to your LDR instance
$ excel2ldr --user username --pass passwd examples/simple.xlsx

#

#Optionally with verbose to get logging output
$ excel2ldr --verbose --user username --pass passwd examples/simple.xlsx

Pre-requisites

  1. Access to a Linked Data Registry instance
  2. User account on a Linked Data Registry instance
  3. Stub registers created on Linked Data Registry instance

Windows Pre-requisites

1. Ensure Python 3.4+ and pip is installed
2. Ensure Python and pip is added to the PATH environment variable

Installing

Installing via pip

$ pip install ldrpyutils

Installing and running from source

# clone this git repository
$ git clone https://github.com/CSIRO-LW-LD/ldrpyutils.git
$ cd ldrpyutils

# (optional) setup a virtualenv
$ virtualenv -p python3 venv
$ source venv/bin/activate
$ pip install -r requirements.txt 

# install the ldrpyutils library locally
$ pip install -e .

Running

# run excel2ldr - transform excel data to a single register of vocabs, build graph, post to a LDR registry
$ excel2ldr --user username --pass passwd  test-data/simple.xlsx

# run excel2ldr - transform excel sheets to multiple registers of vocabs, build graph, post to a LDR registry
$ excel2ldr --user username --pass passwd --multi test-data/simple.xlsx

Configuration

excel2ldr expects a config.json in current dir to contain details to an instance of a Linked Data Registry.

config.json currently allows specification of registry url but might expand to include other details in the future.

{
   "registry_url" : "http://my-ldr-here.com"
}

Example Excel formats

Examples of the excel formats are given in test-data repository. There is currently 2 formats supported for use cases considered.

  1. Single register of vocabs (i.e. simple list) - see test-data/simple.xlsx
  2. Multiple registers of vocabs (i.e. one for each sheet) - see test-data/multi-register.xlsx