Skip to content

Commit ce0932c

Browse files
authored
Merge pull request #70 from linkml/add-oak
major refactor
2 parents aebaad3 + 0e4b9f1 commit ce0932c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2227
-472
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
.idea
2+
.ipynb_checkpoints/
3+
docs/_build/
14
wwwroot/*.js
25
node_modules
36
typings
47
dist
58
schema_automator.egg-info/*
9+
tmp/
10+
__pycache__

docs/cli.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. cli:
2+
3+
Command Line
4+
============
5+
6+
All Schema Automator functionality is available via the ``schemauto`` command
7+
8+
Preamble
9+
--------
10+
11+
.. warning ::
12+
13+
Previous versions had specific commands like ``tsv2linkml`` these are now deprecated.
14+
Instead these are now *subcommands* of the main ``schemauto`` command, and have been renamed.
15+
16+
.. note ::
17+
18+
we follow the `CLIG <https://clig.dev/>`_ guidelines as far as possible
19+
20+
Main commands
21+
---------
22+
23+
.. currentmodule:: schema_automator.cli
24+
25+
.. click:: schema_automator.cli:main
26+
:prog: schemauto
27+
:show-nested:

docs/index.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
.. Schema Automator documentation master file, created by
2-
sphinx-quickstart on Fri Apr 22 13:19:04 2022.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
6-
Welcome to Schema Automator's documentation!
1+
LinkML Schema Automator
72
============================================
83

4+
Schema Automator is a toolkit for bootstrapping and automatically enhancing LinkML schemas from a variety of sources
5+
96
.. toctree::
10-
:maxdepth: 2
7+
:maxdepth: 3
118
:caption: Contents:
129

1310
introduction
14-
intro/index
11+
install
12+
cli
13+
packages/index
1514

1615

1716
Indices and tables

docs/intro/install.rst renamed to docs/install.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Installation
55

66
.. code:: bash
77
8-
chmod 755 environment.sh
9-
. environment.sh
10-
pip install -r requirements.txt
11-
pip install -e .
8+
pip install schema-automator
9+
10+
To check this works:
11+
12+
.. code:: bash
13+
14+
schemauto --help
15+

docs/intro/cli.rst

Lines changed: 0 additions & 147 deletions
This file was deleted.

docs/intro/index.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/introduction.rst

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
LinkML Schema Automator
22
=======================
33

4-
This is a toolkit that assists with:
4+
This is a toolkit that assists with generating and enhancing schemas and data models from a variety
5+
of sources.
56

6-
1. Bootstrapping LinkML models from instance data
7+
The primary end target is a `LinkML <https://linkml.io>`_ schema, but the framework can be used
8+
to generate JSON-Schema, SHACL, SQL DDL etc via the `LinkML Generator <https://linkml.io/linkml/generators>`_ framework.
79

8-
- TSVs and spreadsheets
9-
- SQLite databases
10-
- RDF instance graphs
10+
All functionality is available via a :ref:`cli`. In future there will be a web-based interface.
11+
The functionality is also available by using the relevant Python :ref:`packages`.
1112

12-
2. Bootstrapping a LinkML model from a different schema representation
13-
(i.e. opposite of a linkml.generator)
13+
Generalization from Instance Data
14+
---------------------------------
1415

15-
- OWL (RDFS-like subset)
16-
- TODO: JSON-Schema, XSD, ShEx, SHACL, SQL DDL, FHIR, Python
17-
dataclasses/pydantic, etc
16+
See :ref:`generalizers`
1817

19-
3. Using automated methods to enhance a model
18+
Generalizers allow you to *bootstrap* a schema by generalizing from existing data files
2019

21-
- Using text mining and concept annotator APIs to enrich semantic
22-
enums
23-
- TODO: querying sparql endpoints to retrieve additional metadata
20+
- TSVs and spreadsheets
21+
- SQLite databases
22+
- RDF instance graphs
2423

25-
These can be composed together. For example, run ``tsvs2linkml``
26-
followed by ``annotate-enums``
24+
Importing from alternative modeling framework
25+
---------------------------------
26+
27+
See :ref:`importers`
28+
29+
- OWL (but this only works for schema-style OWL)
30+
- JSON-Schema
31+
32+
In future other frameworks will be supported
33+
34+
Annotating schemas
35+
---------------------------------
36+
37+
See :ref:`annotators`
2738

28-
The toolkit is still experimental. It is intended as an aid to schema
29-
creation rather than act as a formal conversion tool

docs/packages/annotators.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. annotators:
2+
3+
Annotators
4+
=========
5+
6+
Importers take an existing schema and *annotate* it with information
7+
8+
.. warning::
9+
10+
some of these methods will be refactored to use OAK, in which case the way in which
11+
the Bioportal API key is set will change
12+
13+
.. currentmodule:: schema_automator.annotators
14+
15+
.. autoclass:: SchemaAnnotator
16+
:members: create
17+
18+
.. autoclass:: JsonLdAnnotator
19+
:members: create
20+
21+

docs/packages/generalizers.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. generalizers:
2+
3+
Generalizers
4+
=========
5+
6+
Generalizers take example data and *generalizes* to a schema
7+
8+
.. warning::
9+
10+
Generalization is inherently a heuristic process, this should be viewed as a bootstrapping process
11+
that *semi*-automates the creation of a new schema for you.
12+
13+
.. currentmodule:: schema_automator.generalizers
14+
15+
.. autoclass:: CsvDataGeneralizer
16+
:members: create
17+
18+
.. autoclass:: JsonDataGeneralizer
19+
:members: create
20+
21+
.. autoclass:: RdfDataGeneralizer
22+
:members: create

docs/packages/importers.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. importers:
2+
3+
Importers
4+
=========
5+
6+
Importers take either a representation of a schema in a different language or example data and bootstraps a schema.
7+
8+
Importers are the opposite of `Generalizers <https://linkml.io/linkml/generators/index.html>`_ in the core LinkML framework
9+
10+
.. warning::
11+
12+
Generally importers take a *less expressive* language than LinkML and attempts to create the corresponding
13+
LinkML schema. This may be less optimal than a hand-crafted schema. For example, when converting to a
14+
representation that lacks `inheritance <https://linkml.io/linkml/schemas/inheritance.html>`_, no ``is_a`` slots
15+
will be created.
16+
17+
.. currentmodule:: schema_automator.importers
18+
19+
.. autoclass:: JsonSchemaImportEngine
20+
:members: create
21+
22+
.. autoclass:: OwlImportEngine
23+
:members: create
24+
25+
.. autoclass:: DOSDPImportEngine
26+
:members: create
27+

0 commit comments

Comments
 (0)