Skip to content

Commit

Permalink
Merge pull request #34 from linkml/improve-documentation
Browse files Browse the repository at this point in the history
Improve documentation
  • Loading branch information
cmungall authored Jul 25, 2024
2 parents a5554d2 + 6a79ef8 commit 305f949
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

Expand Down
43 changes: 36 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,36 @@ Not all parts of the model are implemented in the reference Python framework.

## Basic idea

Given an object that conforms to a LinkML schema,e.g.:
Given the LinkML schema

```yaml
id: https://w3id.org/linkml/examples/personinfo
name: personinfo
prefixes:
linkml: https://w3id.org/linkml/
personinfo: https://w3id.org/linkml/examples/personinfo
imports:
- linkml:types
default_range: string
default_prefix: personinfo

classes:
Person:
attributes:
id:
given_name:
family_name:
aliases:
multivalued: true
height_in_cm:
range: float
unit:
ucum_code: cm
age_in_years:
range: integer
```
and an object that conforms to it, e.g.:
```yaml
given_name: Jane
Expand Down Expand Up @@ -66,7 +95,7 @@ which themselves consist of one or more [SlotDerivation](schema/SlotDerivation.m
Transform the data:
```bash
linkml-tr map-data -T tr.yaml -s schema.yaml my-data.yaml
linkml-map map-data -T tr.yaml -s schema.yaml my-data.yaml
```

Giving:
Expand All @@ -84,7 +113,7 @@ Installation and command line usage:
```bash
pip[x] install linkml-map
cd tests/input/examples/personinfo_basic
linkml-tr map-data \
linkml-map map-data \
-T transform/personinfo-to-agent.transform.yaml \
-s source/personinfo.yaml \
data/Container-001.yaml \
Expand Down Expand Up @@ -146,8 +175,8 @@ See:
## Running the code

```bash
linkml-tr --help
Usage: linkml-tr [OPTIONS] COMMAND [ARGS]...
linkml-map --help
Usage: linkml-map [OPTIONS] COMMAND [ARGS]...

CLI for linkml-map.

Expand All @@ -168,13 +197,13 @@ through to a complex mappings.

```
cd tests/input/examples/personinfo_basic
linkml-tr map-data -T transform/personinfo-to-agent.transform.yaml -s source/personinfo.yaml data/Container-001.yaml
linkml-map map-data -T transform/personinfo-to-agent.transform.yaml -s source/personinfo.yaml data/Container-001.yaml
```

### derive-schema

```
cd tests/input/examples/personinfo_basic
linkml-tr derive-schema -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
linkml-map derive-schema -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
```

12 changes: 6 additions & 6 deletions src/linkml_map/cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Command line interface for linkml-transformer."""
"""Command line interface for linkml-map."""

import logging
import sys
Expand Down Expand Up @@ -45,7 +45,7 @@
@click.option("-q", "--quiet")
# @click.version_option(__version__)
def main(verbose: int, quiet: bool):
"""CLI for linkml-transformer."""
"""CLI for linkml-map."""
logger = logging.getLogger()
if verbose >= 2:
logger.setLevel(level=logging.DEBUG)
Expand Down Expand Up @@ -85,7 +85,7 @@ def map_data(
Example:
linkml-tr map-data -T X-to-Y-tr.yaml -s X.yaml X-data.yaml
linkml-map map-data -T X-to-Y-tr.yaml -s X.yaml X-data.yaml
"""
logging.info(f"Transforming {input} conforming to {schema} using {transformer_specification}")
tr = ObjectTransformer(**kwargs)
Expand Down Expand Up @@ -121,7 +121,7 @@ def compile(
Example:
linkml-tr compile -T X-to-Y-tr.yaml -s X.yaml
linkml-map compile -T X-to-Y-tr.yaml -s X.yaml
"""
logging.info(f"Compiling {transformer_specification} with {schema}")
compiler_args = {}
Expand Down Expand Up @@ -158,7 +158,7 @@ def derive_schema(schema, transformer_specification, output, output_format, **kw
Example:
linkml-tr derive-schema -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
linkml-map derive-schema -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
"""
logging.info(f"Transforming {schema} using {transformer_specification}")
tr = ObjectTransformer()
Expand All @@ -184,7 +184,7 @@ def invert(schema, transformer_specification, output, output_format, **kwargs):
Example:
linkml-tr invert -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
linkml-map invert -T transform/personinfo-to-agent.transform.yaml source/personinfo.yaml
"""
logging.info(f"Inverting {transformer_specification} using {schema} as source")
tr = ObjectTransformer()
Expand Down

0 comments on commit 305f949

Please sign in to comment.