Skip to content

LinkML meta-model makes invalid use of examples #3245

@gouttegd

Description

@gouttegd

The definition of extra_slots in LinkML’s own schema contains some examples:

extra_slots:
  description: [...]
  examples:
    - value:
        allowed: true
      description: Allow all additional data
    - value:
        range_expression:
          range: string
      description: Allow additional data that are strings
    - value:
        range_expression:
          range: AClassDefinition
      description: Allow additional data if they are instances of the class definition

But the value slot in the example class has no explicit range, meaning it defaults to having a string range. Therefore, the above uses of value are invalid, as correctly pointed out by the LinkML validator:

[ERROR] [meta.yaml/0] {'allowed': True} is not of type 'string', 'null' in /slots/extra_slots/examples/0/value

The example class has a separate value_object slot (aliased to object), specifically intended to represent example values that are not simple scalars. This is what should have been used here:

extra_slots:
  description: [...]
  examples:
    - object:
        allowed: true
      description: Allow all additional data
    - object:
        range_expression:
          range: string
      description: Allow additional data that are strings
    - object:
        range_expression:
          range: AClassDefinition
      description: Allow additional data if they are instances of the class definition

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions