YSTAFDB
YSTAFDB creates turtle files of the instances of data based on an ontology. The turtle files are needed for the BONSAI knowledge graph.
The turtle files generated are stored in the BONSAI rdf repository.
Currently generates the following:
- Activity types, flow objects, locations and flows for YSTAFDB v1.0.
Installation
with package manager pip from pypi
Installable via pip:
pip install ystafdb
manual
Clone git repo
$ git clone git@github.com:BONSAMURAIS/ystafdb.git
Enter cloned repo
$ cd ystafdb
Now install package
$ python setup.py install
Usage
First download the Base Data, and then use ystafdb-cli to produce the ttl/nt/xml files.
For the full syntax, invoke ystafdb-cli -h:
usage: ystafdb-cli [-h] [-i INDIR] [-o OUTDIR] [-f {nt,ttl,xml}]
Extract rdf from ystafdb
optional arguments:
-h, --help show this help message and exit
-i INDIR, --input INDIR
path to ystafdb csv files
-o OUTDIR, --output OUTDIR
Output directory
-f {nt,ttl,xml}, --format {nt,ttl,xml}
The output format
Download Base Data
The data can be downloaded here as a zip file.
Extract the contents of the zip file. As an example, the data can be placed under ystafdb-input.
The following files from the Base Data are mandatory to have in the folder (ystafdb-input in our example):
material_names.csvsubsystems.csvflows.csvpublications.csvreference_spaces.csvreference_materials.csvreference_timeframes.csv
Under a Linux terminal, you can acomplish the previous two operations with:
curl -L "https://www.sciencebase.gov/catalog/file/get/5b9a7c28e4b0d966b485d915?f=__disk__0f%2F58%2Fa7%2F0f58a74db669ee5418f36a698bc85781e867e0ab" -o YSTAFDB_CSV_files.zip
unzip -d ystafdb-input YSTAFDB_CSV_files.zip
Generate the ttl or nt or xml files
If the package is correctly installed, you can use the command line tool ystafdb-cli to produce the rdfs as follows:
$ ystafdb-cli -i <indir> -o <outdir> -f [ttl|nt|xml]
Where:
<indir>is the location of the ystafdb csv files, and<outdir>is the directory where the output triples graphs will be placed. This is optional, if not supplied, the output directory will beoutput-fis the format of the files to generate (ttl,ntorxml). This is optional, if not supplied, it isttl.
In the Linux terminal example from above, this would be done with:
ystafdb-cli -i ystafdb-input
The <outputdir> directory will have the following contents:
output
├── [ 4.0K] activitytype
│ └── [ 4.0K] ystafdb
│ └── [ 249K] ystafdb.ttl
├── [ 4.0K] flow
│ └── [ 4.0K] ystafdb
│ └── [ 4.0K] huse
│ └── [ 41M] huse.ttl
├── [ 4.0K] flowobject
│ └── [ 4.0K] ystafdb
│ └── [ 63K] ystafdb.ttl
├── [ 4.0K] foaf
│ └── [ 4.0K] ystafdb
│ └── [ 1.4K] ystafdb.ttl
├── [ 4.0K] location
│ └── [ 4.0K] ystafdb
│ └── [ 158K] ystafdb.ttl
└── [ 4.0K] prov
└── [ 4.0K] ystafdb
└── [ 1.0M] ystafdb.ttl
Contributing
Please do not edit this package directly. All contributions should be via pull request.
Metadata
Release files for ystafdb 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ystafdb-0.6.0.tar.gz | 16.1 kB | Without provenance | Details for ystafdb-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ystafdb-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for ystafdb-0.6.0-py3-none-any.whl |
Total release size: 33.3 kB
Release files / ystafdb-0.6.0.tar.gz
| Download URL | ystafdb-0.6.0.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
444ee1e874b61eb38a5886bf7cebf3a47414ad52d2fff38ce9794662a4d0348c
|
|
BLAKE2b-256 checksum How to use checksums |
e2cc751c46ba5dba11dd74564af21791363cb064ba34b0d0ba9f9a8feb090762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / ystafdb-0.6.0-py3-none-any.whl
| Download URL | ystafdb-0.6.0-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6350a2b5146e2e487a90b1021f87cd3c0758022c62ae2ab5706d8ac3194b3c19
|
|
BLAKE2b-256 checksum How to use checksums |
5b0d5e5e5c4160a48645ad391dd606f288fea1a358ef043fba89d680781e65d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Security for ystafdb 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.