Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed May 27, 2024
1 parent 35a5b43 commit d527600
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
9 changes: 9 additions & 0 deletions linkml_model/model/schema/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,15 @@ slots:
description: >-
A collection of enum bindings that specify how a slot can be bound to a permissible value
from an enumeration.
LinkML provides enums to allow string values to be restricted to one of a set of permissible
values (specified statically or dynamically).
Enum bindings allow enums to be bound to any object, including complex nested objects. For
example, given a (generic) class Concept with slots id and label, it may be desirable to restrict the
values the id takes on in a given context. For example, a HumanSample class may have a slot for
representing sample site, with a range of concept, but the values of that slot may be restricted to
concepts from a particular branch of an anatomy ontology.
in_subset:
- SpecificationSubset

Expand Down
55 changes: 54 additions & 1 deletion tests/input/examples/schema_definition-enum_bindings-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ id: https://example.org/enum_bindings
name: enum_bindings_example
title: Enum Bindings Example
description: |-
Example LinkML schema to demonstrate Enum bindings
Example LinkML schema to demonstrate Enum bindings.
Here we define a generic Sample class which has a range indicating
the material type of the sample. In an environmental context this
could be soil, seawater, etc. In a medical context it may be human
tissue.
In both cases we want to use a generic Concept class
license: MIT

prefixes:
Expand All @@ -17,27 +24,59 @@ imports:
classes:

Concept:
description: A generic class for representing an element from a vocabulary or ontology.
attributes:
id:
identifier: true
descrption: CURIE/identifier for the concept. E.g. ENVO:1234567

Check failure on line 31 in tests/input/examples/schema_definition-enum_bindings-1.yaml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

descrption ==> description
name:
description: human-readable label of the concept. E.g. "blood"
vocabulary:
description: E.g. UBERON, PO, ENVO, NCIT


Sample:
description: Abstract grouping for different sample types
abstract: true
attributes:
name:
description: E.g. my blood sample
sample_material_type:
description: The material type for the sample - depending on the type of sample, could be tissue (e.g. blood, muscle) or environmental (rock, soil, ...)
range: Concept

EnvironmentalMaterialSample:
description: A sample taken from the environment
slot_usage:
sample_material_type:
description: Environmental material type
bindings:
- binds_value_of: id
range: ENVOMaterialEnum
obligation_level: RECOMMENDED
description: Material type from the ENVO ontology

HumanSampleSample:
description: A sample taken from a human subject
slot_usage:
sample_material_type:
description: Tissue material type
bindings:
- binds_value_of: id
range: AnatomyMaterialEnum
obligation_level: RECOMMENDED
description: Material type from an anatomy ontology

AlternateHumanSampleSample:
description: A sample taken from a human subject (alternative example for illustrative purposes)
slot_usage:
sample_material_type:
description: Does not constrain the ID that is used, but restricts the vocabulary field to a fixed enum
bindings:
- binds_value_of: vocabulary
range: HumanSampleVocabularyEnum
obligation_level: RECOMMENDED

enums:
ENVOMaterialEnum:
description: Material type from the ENVO ontology
Expand All @@ -48,5 +87,19 @@ enums:
is_direct: false
relationship_types:
- rdfs:subClassOf
AnatomyMaterialEnum:
description: Material type from the UBERON anatomy ontology
reachable_from:
source_ontology: obo:uberon
source_nodes:
- UBERON:0000465 ## material anatomical entity
is_direct: false
relationship_types:
- rdfs:subClassOf
HumanSampleVocabularyEnum:
permissible_values:
UBERON:
FMA:
NCIT:


0 comments on commit d527600

Please sign in to comment.