OWL#

Example Output#

personinfo.owl.ttl

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 --no-metaclasses if you do not want this behavior

Note

The current default settings for metaclasses and type-objects may change in the future

Other examples#

  • Biolink : translation of Biolink schema to OWL

Docs#

Command Line#

gen-owl#

Generate an OWL representation of a LinkML model

Examples:

Generate OWL using default parameters:

gen-owl –no-metaclasses –no-type-objects my_schema.yaml

Generate OWL utilizing datatype properties for type slots and excluding metaclasses:

gen-owl –no-metaclasses –no-type-objects my_schema.yaml

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

gen-owl [OPTIONS] YAMLFILE

Options

-o, --output <output>#

Output file name

--metadata-profile <metadata_profile>#

What kind of metadata profile to use for annotations on generated OWL objects

Default:

linkml

Options:

linkml | rdfs

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

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

Default:

True

--metaclasses, --no-metaclasses#

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

Default:

True

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

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

Default:

True

--ontology-uri-suffix <ontology_uri_suffix>#

Suffix to append to schema id to generate OWL Ontology IRI

Default:

.owl.ttl

--assert-equivalent-classes, --no-assert-equivalent-classes#

If true, add owl:equivalentClass between a class and a class_uri

Default:

False

-V, --version#

Show the version and exit.

-f, --format <format>#

Output format

Default:

owl

Options:

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

--metadata, --no-metadata#

Include metadata in output

Default:

True

--useuris, --metauris#

Include metadata in output

Default:

True

-im, --importmap <importmap>#

Import mapping file

--log_level <log_level>#

Logging level

Default:

WARNING

Options:

CRITICAL | ERROR | WARNING | INFO | DEBUG

-v, --verbose#

verbosity

--mergeimports, --no-mergeimports#

Merge imports into source file (default=mergeimports)

--stacktrace, --no-stacktrace#

Print a stack trace when an error occurs

Default:

False

Arguments

YAMLFILE#

Required argument

Code#