Skip to content

Add allow_unknown_designator slot. - #274

Open
gouttegd wants to merge 2 commits into
linkml:mainfrom
gouttegd:allow-unknown-designator
Open

Add allow_unknown_designator slot.#274
gouttegd wants to merge 2 commits into
linkml:mainfrom
gouttegd:allow-unknown-designator

Conversation

@gouttegd

Copy link
Copy Markdown
Contributor

This PR implements the idea proposed in linkml/linkml#3701 (and refined after a meeting with the core devs as outlined here).

That is, it adds a new slot (applicable to a slot definition) to alter the behaviour of a type designator slot.

If a slot is marked with both:

designates_type: true
allow_unknown_designator: true

then the constraint that the value of the slot must match the name/URI/CURIE of a known subclass of the class defining the slot (standard constraint for a type designator slot) is relaxed.

While we are at it, the description of the designates_type slot is also updated to make its meaning hopefully clearer. We also warn against the use of multi-valued type designators, as per linkml/linkml#1681.

We add a new slot (applicable to a slot definition) to alter the
behaviour of a type designator slot.

If a slot is marked with both:

  designates_type: true
  allow_unknown_designator: true

then the constraint that the value of the slot must match the
name/URI/CURIE of a known subclass of the class defining the slot is
relaxed.
@gouttegd gouttegd self-assigned this Aug 27, 2026
Unicode has only existed for several decades, it’s still too early for
it to be used safely on Windows.

Sigh.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants