linkml / linkml-model

Link Modeling Language (LinkML) model
https://linkml.github.io/linkml-model/docs/
33 stars 16 forks source link

Adding enum bindings #193

Closed cmungall closed 1 month ago

cmungall commented 2 months ago

In LinkML enums are a special kind of element, distinct from TypeDefinition, ClassDefinition (even they are rendered as strings).

Sometimes it can be useful to bind an existing slot value to an enum.

One use case is when we have a generic Concept class that is typically non-lined, and referred to by id. We may want to have a slot usage that restricts the id to ne PVs in some contexts; e.g.

classes:

  Concept:
    attributes:
      id:
        identifier: true
      name:

  Biosample:
    attributes:
      name:
      sample_material_type:
        range: Concept
        bindings:
          - binds_value_of: id
            range: ENVOMaterialEnum
            strength: RECOMMENDED
            description: Material type from the ENVO ontology

enums:
  ENVOMaterialEnum:
    description: Material type from the ENVO ontology
    reachable_from:
      source_ontology: obo:envo
      source_nodes:
        - ENVO:00010483  ## environmental material
      is_direct: false
      relationship_types:
        - rdfs:subClassOf

See also https://build.fhir.org/terminologies-binding-examples.html