Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions linkml_model/model/docs/specification/05validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ The following checks only match when `i` is an **AtomicInstance**

The following checks only match when `i` is an **InstanceOfClass**

| **T** | Element | Check | Fail Condition |
|--------|------------------------------------|-------------------|---------------------------------------------------------------------------------|
| `in` | `<Class>(<Assignments>)` | `Abstract` | `Class.abstract` |
| `in` | `<Class>(<Assignments>)` | `Mixin` | `Class.mixin` |
| `in` | `<Class>(<Assignments>)` | `ClassRange` | `slot.range ∉ A*(<Class>)` |
| `in` | `<Class>(..., <subslot>=<V>, ...)` | `ApplicableSlot` | `subslot ∉ <Class>.attributes` |
| `in` | `<Class>(..., <ts>=<V>, ...)` | `DesignatedType` | `∃ v ∈ L(<V>): v ∉ Norm(A*(<Class>), ts.range)` and `ts.designates_type = True` |
| **T** | Element | Check | Fail Condition |
|--------|------------------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------|
| `in` | `<Class>(<Assignments>)` | `Abstract` | `Class.abstract` |
| `in` | `<Class>(<Assignments>)` | `Mixin` | `Class.mixin` |
| `in` | `<Class>(<Assignments>)` | `ClassRange` | `slot.range ∉ A*(<Class>)` |
| `in` | `<Class>(..., <subslot>=<V>, ...)` | `ApplicableSlot` | `subslot ∉ <Class>.attributes` |
| `in` | `<Class>(..., <ts>=<V>, ...)` | `DesignatedType` | `∃ v ∈ L(<V>): v ∉ Norm(A*(<Class>), ts.range)` and `ts.designates_type = True` and `ts.allow_unknown_designator = False` |

For the DesignatedType check, the `Norm` function takes as input as a list of classes,
and expands these according to the range of the slot `ts` that designates the type.
Expand Down
40 changes: 39 additions & 1 deletion linkml_model/model/schema/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1932,11 +1932,49 @@ slots:
range: boolean
inherited: true
description: >-
True means that the key slot(s) is used to determine the instantiation (types) relation between objects and a ClassDefinition
True makes the slot the "type designator slot" for its class. A type designator slot is used to determine the runtime type
of an object.

When the type designator slot is present in an object, its value MUST match either the name, the URI, or the CURIE
(depending on the range of the slot) of a known subclass of the class in which the type designator slot is defined (or that
class itself).
comments:
- >-
The constraint that the value of the type designator must designate a known subclass can be relaxed by also marking the
slot with `allow_unknown_designator`.
- Multi-valued type designator slots are theoretically possible, but they should be considered unsupported.
in_subset:
- SpecificationSubset
see_also:
- https://linkml.io/linkml/schemas/type-designators.html
- linkml:allow_unknown_designator

allow_unknown_designator:
domain: slot_definition
range: boolean
inherited: true
description: >-
True means that the value of the type designator slot in a given object MAY refer to an unknown class, in which case
(i) the object should be assumed to be an instance of the base class (the class in which the type designator slot is
defined), and (ii) the value of the type designator slot should be preserved as it is.
comments:
- This slot only makes sense for a slot that is a type designator slot.
- >-
Setting this slot to True only makes sense if the base class is NOT abstract; if the base class is abstract, then by
definition it cannot be instantiated, so an object cannot be assumed to be an instance of the base class.
- >-
This slot is intended to allow a schema to be extended by another schema (that could add new subclasses to the original
base class) while ensuring that data conformant to the extended schema can still be considered valid against the original
schema.
- >-
In most cases, schema authors will want to make sure that the base class is configured to allow "extra slots", so that
any slot defined by an unknown subclass can be accepted without triggering an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could decide that the mere presence of allow_unknown_designator is enough to imply that the class carrying the type designator slot is allowing extra slots (this is a possibility that was discussed in the aforementioned meeting).

If we wanted to do that, then (i) the last comment above should be removed, and (ii) the description should be amended to add:

Additionally, when this slot is set to True, the class carrying the type designator slot should be implicitly considered to allow extra slots (as if it was defined with extra_slots.allowed=True), unless the class definition has an explicit extra_slots configuration.

(For what it’s worth, I am not convinced this would be a good idea, if only because it creates “long range effects”: a class could be implicitly allowing extra slots even if nothing in the class definition says so, just because it has a slot – defined elsewhere in the schema – that has allow_unknown_designator: True. Better in my opinion to be explicit.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My unprompted 2 cents: skip the "allow_unknown_designator => extra_slots" implication. The subclasses could have the same slots as the base class, but may define different behaviors in their slot_usages, like expressions or rules.

in_subset:
- SpecificationSubset
see_also:
- https://linkml.io/linkml/schemas/type-designators.html
- linkml:designates_type
- linkml:extra_slots

alias:
rank: 6
Expand Down
Loading