Skip to main content

Python library for Loc-I

Project description

LOC-I SCRIPTS and pyloci

Build Status

A collection of scripts, snippets, and mini-apps from the LOC-I Project

.env

Copy the env-template to .env and edit the file to specify which sparql endpoint and authentication details if needed

Setup

$ pip install -e .

For tests involving selenium, chromedriver is required.

# Install on windows
$ choco install chromedriver

# Install on linux
# See https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/

Example uses

# Run stats over the loci dataset
$ python -m pyloci.sparql.generate_loci_type_count 

# query contains for a precanned set of uris
$ python -m pyloci.sparql.query_loci_mb16cc_contains

# query contains for a precanned set of uris
$ python -m pyloci.sparql.query_loci_mb16cc_contains '<http://linked.data.gov.au/dataset/geofabric/contractedcatchment/12101547>'

Reapportioning use case

# reapportion single-cc-mb16-within.csv in verbose mode with output to specific csv file
$ python -m pyloci.reapportioning --verbose -o output.csv ./loci-testdata/excelerator/single-cc-mb16-within.csv

# reapportion single-cc-mb16-within.csv in verbose mode with output to stdout
$ python -m pyloci.reapportioning --verbose ./loci-testdata/excelerator/single-cc-mb16-within.csv

# reapportion single-cc-mb16-within.csv in non-verbose mode with output to stdout
$ python -m pyloci.reapportioning ./loci-testdata/excelerator/single-cc-mb16-within.csv

# reapportion single-cc-mb16-within.csv in non-verbose mode with output to specific csv file
$ python -m pyloci.reapportioning -o output.csv ./loci-testdata/excelerator/single-cc-mb16-within.csv

# process all .csv files in input dir ('-d' specifies process directory mode)
$ python -m pyloci.reapportioning -d  ./loci-testdata/excelerator

Generate Test Data

# Run stats over the loci dataset
$ python -m pyloci.sparql.generate_loci_type_count > ./loci-testdata/loci_type_count.json

# Create test_case_contains_result testdata
$ python -m pyloci.sparql.generate_loci_contains_testdata > ./loci-testdata/test_case_contains_result.json

# Create reapportioning test dataset - queries contains for Test Case A-C set of URIs 
$ python -m pyloci.sparql.generate_loci_reapportioning_testdata > ./loci-testdata/loci_reapportioning_testdata.json


# Create loci mb16cc relations test data - query mb and cc relationships (without specifying the predicate) - currently broken :(
$ python -m pyloci.sparql.generate_loci_mb16cc_relations_testdata > ./loci-testdata/test_case_mb16cc_relations_result.json

# query labels
$ python -m pyloci.sparql.query_loci_location_labels --limit 100 --max 100 > location_labels.tsv

# generate loci test LD dataset
$ python -m pyloci.generate_loci_rdf_testdata

Running tests

$ pytest

Rights & License

The content of this repository is © 2019 CSIRO Land and Water.
The content of this repository is distributed under the Apache 2.0 License

Contacts

Ashley Sommer
Informatics Software Engineer
CSIRO Land & Water, Environmental Informatics Group
ashley.sommer@csiro.au
https://orcid.org/0000-0003-0590-0131

Benjamin Leighton
Informatics Software Engineer
CSIRO Land & Water, Environmental Informatics Group

Jonathan Yu
Data scientist
CSIRO Land & Water, Environmental Informatics Group

Nicholas Car
Senior Experimental Scientist
CSIRO Land & Water, Environmental Informatics Group
nicholas.car@csiro.au
http://orcid.org/0000-0002-8742-7730

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyloci-0.1.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

pyloci-0.1.2-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file pyloci-0.1.2.tar.gz.

File metadata

  • Download URL: pyloci-0.1.2.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

File hashes

Hashes for pyloci-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9c66a6541ee5dd04ae04a53372b227d9968e351b9fb82d27a80e75a9d2e8d489
MD5 0f40df7050a639cb0738f9769b813be7
BLAKE2b-256 5daad4cabf27dea814ba9b65c2dad6538591b9533cbb26346c89e7d7828ae15b

See more details on using hashes here.

File details

Details for the file pyloci-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyloci-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

File hashes

Hashes for pyloci-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac20159c452377b659c3960d92ae80fcd06cf6e1ec1e15182ac85454f091bf56
MD5 a6a4a71dd76cb1345b8bc300e2f24640
BLAKE2b-256 dc8225a3869352b1eab1ee5d3b267b2f6bfbc5011ed705d7348ba7b714bee210

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page