Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extra_slots metamodel slot #205

Merged
merged 7 commits into from
Oct 21, 2024
Merged
Changes from 3 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
49 changes: 48 additions & 1 deletion linkml_model/model/schema/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,53 @@ slots:
range: boolean
description: if true then induced/mangled slot names are not created for class_usage and attributes
status: testing


extra_slots:
description: |
How a class instance handles extra data not specified in the class definition.
Note that this does *not* define the constraints that are placed on additional slots defined by inheriting classes.

Possible values:
- true: allow any additional data
- false: (default) forbid any additional data
- anonymous_slot_expression: allow only data matching this anonymous slot expression
domain: class_definition
ifabsent: false
any_of:
- range: boolean
Copy link
Member

Choose a reason for hiding this comment

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

My preference is to avoid any of in the metamodel (we also had this discussion in Berkeley:-). One reason is that it means the metamodel can't be mapped to a relational model without bespoke transformations (thus breaking eg Ben's Django editing workflow). It could also impede mapping of linkml to other target languages in future. I know this seems like favoring implementers over users but in this case I think the user may be better served by a more explicit way to declare unrestrictedness?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated OP with another possible example that avoids this :)

- range: anonymous_slot_expression
in_subset:
- SpecificationSubset
- BasicSubset
examples:
- value: true
description: Allow all additional data
- value: false
description: Forbid any additional data
- value:
range: string
description: Allow additional data that are strings
- value:
range: AClassDefinition
description: Allow additional data if they are instances of the class definition "AClassDefinition"
- value:
any_of:
- range: string
- range: integer
description: allow additional data if they are either strings or integers
- value:
range: integer
multivalued: true
maximum_cardinality: 5
description: |
Allow additional data if they are lists of integers of at most length 5.
Note that this does *not* mean that a maximum of 5 extra slots are allowed.
- value:
range: integer
required: true
description: |
Allow additional data if they are integers.
`required` is meaningless in this context and ignored, since by definition all "extra" slots are optional.

# -----------------------------------
# Slot definition slots
Expand Down Expand Up @@ -3023,6 +3069,7 @@ classes:
- represents_relationship
- disjoint_with
- children_are_mutually_disjoint
- extra_slots
slot_usage:
is_a:
range: class_definition
Expand Down
Loading