Skip to content

Commit

Permalink
Merge pull request #66 from linkml/doc-schem-change
Browse files Browse the repository at this point in the history
Make README concise and change documentation theme.
  • Loading branch information
hrshdhgd authored Apr 23, 2022
2 parents 6b051fe + 75a005a commit 1508d13
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 157 deletions.
146 changes: 1 addition & 145 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,148 +18,4 @@ These can be composed together. For example, run `tsvs2linkml` followed by `anno
The toolkit is still experimental. It is intended as an aid to schema creation rather than act as a formal conversion
tool

## Installation

`schema-automator` and its components require Python 3.9 or greater.

```bash
chmod 755 environment.sh
. environment.sh
pip install -r requirements.txt
pip install -e .
```

## Command Line Usage

### Annotating Enums

This toolkit allows automated annotation of LinkML enums, mapping text strings to ontology terms.

The command line tool `annotate-enums` takes a LinkML schema, with enums and fills in the `meaning` slots.

See the [annotators](schema_automator/annotators/) folder for docs

### Converting TSVs

The `tsv2linkml` command infers a single-class schema from a TSV datafile

```bash
tsv2linkml --help
Usage: tsv2linkml [OPTIONS] TSVFILE

Infer a model from a TSV

Options:
-o, --output TEXT Output file
-c, --class_name TEXT Core class name in schema
-n, --schema_name TEXT Schema name
-s, --sep TEXT separator
-E, --enum-columns TEXT column that is forced to be an enum
--robot / --no-robot set if the TSV is a ROBOT template
--help Show this message and exit.
```
Example:
```bash
tsv2linkml tests/resources/biobank-specimens.tsv
```
The `tsvs2linkml` command infers a multi-class schema from multiple TSV datafiles
```bash
tsvs2linkml --help
Usage: tsvs2linkml [OPTIONS] [TSVFILES]...

Infer a model from multiple TSVs

Options:
-o, --output TEXT Output file
-n, --schema_name TEXT Schema name
-s, --sep TEXT separator
-E, --enum-columns TEXT column(s) that is forced to be an enum
--enum-mask-columns TEXT column(s) that are excluded from being enums
--max-enum-size INTEGER do not create an enum if more than max distinct
members

--enum-threshold FLOAT if the number of distinct values / rows is less
than this, do not make an enum

--robot / --no-robot set if the TSV is a ROBOT template
--help Show this message and exit.
```
### Converting OWL
```bash
owl2linkml --help
Usage: owl2linkml [OPTIONS] OWLFILE

Infer a model from OWL Ontology

Note: input must be in functional syntax

Options:
-n, --name TEXT Schema name
--help Show this message and exit.
```
Example:
```bash
owl2linkml -n prov tests/resources/prov.ofn > prov.yaml
```
Note this works best on schema-style ontologies such as Prov
**NOT** recommended for terminological-style ontologies such as OBO
### Converting RDF instance graphs
```bash
rdf2linkml --help
Usage: rdf2linkml [OPTIONS] RDFFILE

Infer a model from RDF instance data

Options:
-d, --dir TEXT [required]
--help Show this message and exit.
```
### Converting JSON Instance Data
```bash
jsondata2linkml --help
Usage: jsondata2linkml [OPTIONS] INPUT

Infer a model from JSON instance data



Options:
--container-class-name TEXT name of root class
-f, --format TEXT json or yaml (or json.gz or yaml.gz)
--omit-null / --no-omit-null if true, ignore null values
--help Show this message and exit.
```
### Converting JSON-Schema
```bash
jsonschema2linkml --help
Usage: jsonschema2linkml [OPTIONS] INPUT

Infer a model from JSON Schema

Options:
-n, --name TEXT ID of schema [required]
-f, --format TEXT JSON Schema format - yaml or json
-o, --output TEXT output path
--help Show this message and exit.
```
### jsonschema2linkml example
```bash
poetry run jsonschema2linkml -n test-model -f yaml -o vrs-linkml.yaml cp tests/resources/jsonschema/vrs.schema.json
```
[Full Documentation](https://linkml.io/schema-automator/)
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
#
import os
import sys
import sphinx_pdj_theme

sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------

project = 'Schema Automator'
copyright = '2022, Chris Mungall'
author = 'Chris Mungall'
author = 'Chris Mungall, Harshad Hegde'

# The full version, including alpha/beta/rc tags
# release = '0.1.4'
Expand All @@ -34,7 +36,7 @@
'sphinx.ext.autodoc',
'sphinx.ext.githubpages',
'sphinx.ext.autosectionlabel',
'sphinx_rtd_theme',
'sphinx_pdj_theme',
'sphinx_click',
'sphinx.ext.viewcode',
'sphinx.ext.todo',
Expand Down Expand Up @@ -64,7 +66,8 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinx_pdj_theme'
html_theme_path = [sphinx_pdj_theme.get_html_theme_path()]

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
25 changes: 18 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ twine = "^4.0.0"
[tool.poetry.dev-dependencies]
pytest = "^7.1.1"
Sphinx = "^4.4.0"
sphinx-rtd-theme = "^1.0.0"
sphinx-pdj-theme = "^0.2.0"
sphinx-click = "^3.1.0"
sphinxcontrib-mermaid = "^0.7.1"

Expand All @@ -59,4 +59,4 @@ jsondata2linkml = "schema_automator.importers.json_instance_import_engine:json2m
jsonschema2linkml = "schema_automator.importers.jsonschema_import_engine:jsonschema2model"

[tool.poetry.extras]
docs = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-mermaid"]
docs = ["Sphinx", "sphinx-pdj-theme", "sphinxcontrib-mermaid"]

0 comments on commit 1508d13

Please sign in to comment.