Skip to content

Commit

Permalink
Merge pull request #70 from linkml/add-oak
Browse files Browse the repository at this point in the history
major refactor
  • Loading branch information
cmungall authored Jun 9, 2022
2 parents aebaad3 + 0e4b9f1 commit ce0932c
Show file tree
Hide file tree
Showing 53 changed files with 2,227 additions and 472 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.idea
.ipynb_checkpoints/
docs/_build/
wwwroot/*.js
node_modules
typings
dist
schema_automator.egg-info/*
tmp/
__pycache__
27 changes: 27 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. cli:
Command Line
============

All Schema Automator functionality is available via the ``schemauto`` command

Preamble
--------

.. warning ::
Previous versions had specific commands like ``tsv2linkml`` these are now deprecated.
Instead these are now *subcommands* of the main ``schemauto`` command, and have been renamed.
.. note ::
we follow the `CLIG <https://clig.dev/>`_ guidelines as far as possible
Main commands
---------

.. currentmodule:: schema_automator.cli

.. click:: schema_automator.cli:main
:prog: schemauto
:show-nested:
15 changes: 7 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
.. Schema Automator documentation master file, created by
sphinx-quickstart on Fri Apr 22 13:19:04 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Schema Automator's documentation!
LinkML Schema Automator
============================================

Schema Automator is a toolkit for bootstrapping and automatically enhancing LinkML schemas from a variety of sources

.. toctree::
:maxdepth: 2
:maxdepth: 3
:caption: Contents:

introduction
intro/index
install
cli
packages/index


Indices and tables
Expand Down
12 changes: 8 additions & 4 deletions docs/intro/install.rst → docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ Installation

.. code:: bash
chmod 755 environment.sh
. environment.sh
pip install -r requirements.txt
pip install -e .
pip install schema-automator
To check this works:

.. code:: bash
schemauto --help
147 changes: 0 additions & 147 deletions docs/intro/cli.rst

This file was deleted.

11 changes: 0 additions & 11 deletions docs/intro/index.rst

This file was deleted.

45 changes: 27 additions & 18 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
LinkML Schema Automator
=======================

This is a toolkit that assists with:
This is a toolkit that assists with generating and enhancing schemas and data models from a variety
of sources.

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

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

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

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

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

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

These can be composed together. For example, run ``tsvs2linkml``
followed by ``annotate-enums``
Importing from alternative modeling framework
---------------------------------

See :ref:`importers`

- OWL (but this only works for schema-style OWL)
- JSON-Schema

In future other frameworks will be supported

Annotating schemas
---------------------------------

See :ref:`annotators`

The toolkit is still experimental. It is intended as an aid to schema
creation rather than act as a formal conversion tool
21 changes: 21 additions & 0 deletions docs/packages/annotators.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. annotators:
Annotators
=========

Importers take an existing schema and *annotate* it with information

.. warning::

some of these methods will be refactored to use OAK, in which case the way in which
the Bioportal API key is set will change

.. currentmodule:: schema_automator.annotators

.. autoclass:: SchemaAnnotator
:members: create

.. autoclass:: JsonLdAnnotator
:members: create


22 changes: 22 additions & 0 deletions docs/packages/generalizers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. generalizers:
Generalizers
=========

Generalizers take example data and *generalizes* to a schema

.. warning::

Generalization is inherently a heuristic process, this should be viewed as a bootstrapping process
that *semi*-automates the creation of a new schema for you.

.. currentmodule:: schema_automator.generalizers

.. autoclass:: CsvDataGeneralizer
:members: create

.. autoclass:: JsonDataGeneralizer
:members: create

.. autoclass:: RdfDataGeneralizer
:members: create
27 changes: 27 additions & 0 deletions docs/packages/importers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. importers:
Importers
=========

Importers take either a representation of a schema in a different language or example data and bootstraps a schema.

Importers are the opposite of `Generalizers <https://linkml.io/linkml/generators/index.html>`_ in the core LinkML framework

.. warning::

Generally importers take a *less expressive* language than LinkML and attempts to create the corresponding
LinkML schema. This may be less optimal than a hand-crafted schema. For example, when converting to a
representation that lacks `inheritance <https://linkml.io/linkml/schemas/inheritance.html>`_, no ``is_a`` slots
will be created.

.. currentmodule:: schema_automator.importers

.. autoclass:: JsonSchemaImportEngine
:members: create

.. autoclass:: OwlImportEngine
:members: create

.. autoclass:: DOSDPImportEngine
:members: create

14 changes: 14 additions & 0 deletions docs/packages/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. packages:
Packages
========

The code is organized into different python *packages*

.. toctree::
:maxdepth: 3
:caption: Contents:

importers
generalizers
annotators
Loading

0 comments on commit ce0932c

Please sign in to comment.