Skip to content

Commit d527600

Browse files
committed
examples
1 parent 35a5b43 commit d527600

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

linkml_model/model/schema/meta.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,6 +2106,15 @@ slots:
21062106
description: >-
21072107
A collection of enum bindings that specify how a slot can be bound to a permissible value
21082108
from an enumeration.
2109+
2110+
LinkML provides enums to allow string values to be restricted to one of a set of permissible
2111+
values (specified statically or dynamically).
2112+
2113+
Enum bindings allow enums to be bound to any object, including complex nested objects. For
2114+
example, given a (generic) class Concept with slots id and label, it may be desirable to restrict the
2115+
values the id takes on in a given context. For example, a HumanSample class may have a slot for
2116+
representing sample site, with a range of concept, but the values of that slot may be restricted to
2117+
concepts from a particular branch of an anatomy ontology.
21092118
in_subset:
21102119
- SpecificationSubset
21112120

tests/input/examples/schema_definition-enum_bindings-1.yaml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ id: https://example.org/enum_bindings
22
name: enum_bindings_example
33
title: Enum Bindings Example
44
description: |-
5-
Example LinkML schema to demonstrate Enum bindings
5+
Example LinkML schema to demonstrate Enum bindings.
6+
7+
Here we define a generic Sample class which has a range indicating
8+
the material type of the sample. In an environmental context this
9+
could be soil, seawater, etc. In a medical context it may be human
10+
tissue.
11+
12+
In both cases we want to use a generic Concept class
613
license: MIT
714

815
prefixes:
@@ -17,27 +24,59 @@ imports:
1724
classes:
1825

1926
Concept:
27+
description: A generic class for representing an element from a vocabulary or ontology.
2028
attributes:
2129
id:
2230
identifier: true
31+
descrption: CURIE/identifier for the concept. E.g. ENVO:1234567
2332
name:
33+
description: human-readable label of the concept. E.g. "blood"
34+
vocabulary:
35+
description: E.g. UBERON, PO, ENVO, NCIT
2436

2537

2638
Sample:
39+
description: Abstract grouping for different sample types
40+
abstract: true
2741
attributes:
2842
name:
43+
description: E.g. my blood sample
2944
sample_material_type:
45+
description: The material type for the sample - depending on the type of sample, could be tissue (e.g. blood, muscle) or environmental (rock, soil, ...)
3046
range: Concept
3147

3248
EnvironmentalMaterialSample:
49+
description: A sample taken from the environment
3350
slot_usage:
3451
sample_material_type:
52+
description: Environmental material type
3553
bindings:
3654
- binds_value_of: id
3755
range: ENVOMaterialEnum
3856
obligation_level: RECOMMENDED
3957
description: Material type from the ENVO ontology
4058

59+
HumanSampleSample:
60+
description: A sample taken from a human subject
61+
slot_usage:
62+
sample_material_type:
63+
description: Tissue material type
64+
bindings:
65+
- binds_value_of: id
66+
range: AnatomyMaterialEnum
67+
obligation_level: RECOMMENDED
68+
description: Material type from an anatomy ontology
69+
70+
AlternateHumanSampleSample:
71+
description: A sample taken from a human subject (alternative example for illustrative purposes)
72+
slot_usage:
73+
sample_material_type:
74+
description: Does not constrain the ID that is used, but restricts the vocabulary field to a fixed enum
75+
bindings:
76+
- binds_value_of: vocabulary
77+
range: HumanSampleVocabularyEnum
78+
obligation_level: RECOMMENDED
79+
4180
enums:
4281
ENVOMaterialEnum:
4382
description: Material type from the ENVO ontology
@@ -48,5 +87,19 @@ enums:
4887
is_direct: false
4988
relationship_types:
5089
- rdfs:subClassOf
90+
AnatomyMaterialEnum:
91+
description: Material type from the UBERON anatomy ontology
92+
reachable_from:
93+
source_ontology: obo:uberon
94+
source_nodes:
95+
- UBERON:0000465 ## material anatomical entity
96+
is_direct: false
97+
relationship_types:
98+
- rdfs:subClassOf
99+
HumanSampleVocabularyEnum:
100+
permissible_values:
101+
UBERON:
102+
FMA:
103+
NCIT:
51104

52105

0 commit comments

Comments
 (0)