Skip to main content

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.csv
  • subsystems.csv
  • flows.csv
  • publications.csv
  • reference_spaces.csv
  • reference_materials.csv
  • reference_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 be output
  • -f is the format of the files to generate (ttl, nt or xml). This is optional, if not supplied, it is ttl.

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)

Source distribution for ystafdb 0.6.0
File Size Uploaded
ystafdb-0.6.0.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ystafdb 0.6.0
File Interpreter ABI Platform
ystafdb-0.6.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page