Owl — linkml documentation

# Owl

## Overview

Web Ontology Language OWL is modeling language used to author ontologies.

OWL is used for building ontologies, whereas LinkML is a schema language. Nevertheless, it can be useful to render Schemas as OWL (and in fact many semantic web schemas such as PROV have an OWL or RDFS rendering)

See also

The linkml-owl maps between LinkML data and OWL

Note

The OWL is rendered as RDF/turtle. We recommend the suffix `.owl.ttl` to distinguish from the direct RDF mapping

### Mapping

- Each LinkML class maps to an OWL class

- Each LinkML slot maps to an OWL property

  > - if the range of the slot is class, then an ObjectProperty is used

  > - otherwise DataProperty is used

  > - Exception to the above: if `type_objects` is set then ObjectProperties are always used

- OWL restrictions are used for cardinality and range constraints

  > - `only` (universal restrictions) is used for ranges

  > - If a slot is not multivalued then a `max 1` cardinality restrictions are used

  > - required non-multivalued slots have an `exactly 1` cardinality restriction

  > - required multivalued slots have a `min 1` cardinality restriction

  > - it should be understood that OWL follows the Open World Assumption, thus OWL reasoners enforce a weaker model

- Each LinkML element is rendered as an instance of the relevant metamodel class

  > - This means punning is used

  > - Set `metaclass=False` if you do not want this behavior

Note

The current default settings for `metaclasses` and `type_objects` may change in the future

## Docs

### Command Line

#### gen-owl

Generate an OWL representation of a LinkML model

Examples:

> gen-owl –no-metaclasses –no-type-objects

For more info, see: https://linkml.io/linkml/generators/owl

    gen-owl [OPTIONS] YAMLFILE

Options

-o, --output <output>

  Output file name

--type-objects, --no-type-objects

  If true, will model linkml types as objects, not literals

--metaclasses, --no-metaclasses

  If true, include linkml metamodel classes as metaclasses. Note this introduces punning in OWL-DL

--add-ols-annotations, --no-add-ols-annotations

  If true, auto-include annotations from https://www.ebi.ac.uk/ols/docs/installation-guide

--ontology-iri-suffix <ontology_iri_suffix>

  Suffix to append to schema id to generate OWL Ontology IRI

-f, --format <format>

  Output format (default=owl)

  Options

    owl | ttl | json-ld | xml | n3 | turtle | ttl | ntriples | nt | nt11 | nquads | trix | trig

--metadata, --no-metadata

  Include metadata in output (default=–metadata)

--useuris, --metauris

  Include metadata in output (default=–useuris)

-im, --importmap <importmap>

  Import mapping file

--log_level <log_level>

  Logging level (default=WARNING)

  Options

    CRITICAL | ERROR | WARNING | INFO | DEBUG

--mergeimports, --no-mergeimports

  Merge imports into source file (default=mergeimports)

Arguments

YAMLFILE

  Required argument

### Code