Skip to content

Convert LinkML schema + data to VALVE tables and vice versa

License

Notifications You must be signed in to change notification settings

tmprd/valve-linkml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VALVE - LinkML

Convert LinkML schemas + data to VALVE tables

Requirements

Setup

python3 -m pip install .

Usage

python3 -m valve_linkml.linkml2valve <linkml-yaml-schema-path> -o <output-directory> -d <linkml-yaml-data-directory>

Test schema conversion

python3 -m test.test_linkml2valve
# This will generate VALVE tables in the `test/valve_output` folder.

Test VALVE validation

# PersonInfo - this will generate a VALVE sqlite db in the specified location
rm test/valve_output/personinfo/personinfo.db
ontodev_valve test/valve_output/personinfo/table.tsv test/valve_output/personinfo/personinfo.db --verbose
# 

# Biolink
rm test/valve_output/biolink/biolink.db
ontodev_valve test/valve_output/biolink/table.tsv test/valve_output/biolink/biolink.db --verbose

Test LinkML validation

# Validate TSV
linkml-validate --schema test/linkml_input/personinfo/personinfo.yaml --target-class Person --index-slot id test/valve_output/personinfo/data/Person.tsv
linkml-validate --schema test/linkml_input/personinfo/personinfo.yaml --target-class Address --index-slot street test/valve_output/personinfo/data/Address.tsv
linkml-validate --schema test/linkml_input/personinfo/personinfo.yaml --target-class ProcedureConcept --index-slot id test/valve_output/personinfo/data/ProcedureConcept.tsv

LinkML conversion for validating JSON

# Convert TSV to JSON
linkml-convert --schema test/linkml_input/personinfo/personinfo.yaml --target-class Person --index-slot id test/valve_output/personinfo/data/Person.tsv -o test/valve_output/personinfo/data/Person.json
linkml-convert --schema test/linkml_input/personinfo/personinfo.yaml --target-class Address --index-slot street test/valve_output/personinfo/data/Address.tsv -o test/valve_output/personinfo/data/Address.json

# Validate JSON
linkml-validate --schema test/linkml_input/personinfo/personinfo.yaml --target-class Person test/valve_output/personinfo/data/Person.json
linkml-validate --schema test/linkml_input/personinfo/personinfo.yaml --target-class Address test/valve_output/personinfo/data/Address.json

About

Convert LinkML schema + data to VALVE tables and vice versa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages