From 6861fb173385642390ab98fe7a37441bf33d516d Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 25 Sep 2024 22:12:34 -0700 Subject: [PATCH 1/7] add extra_slots metamodel slot --- linkml_model/model/schema/meta.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index c3e78ed6..cf1dc338 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1351,6 +1351,22 @@ 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. + + - 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 + - range: anonymous_slot_expression + in_subset: + - SpecificationSubset + - BasicSubset # ----------------------------------- @@ -3023,6 +3039,7 @@ classes: - represents_relationship - disjoint_with - children_are_mutually_disjoint + - extra_slots slot_usage: is_a: range: class_definition From 2fd22d4ffd21b16b4536225476c52a61e96855f2 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 25 Sep 2024 22:23:10 -0700 Subject: [PATCH 2/7] add examples --- linkml_model/model/schema/meta.yaml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index cf1dc338..262b2bbb 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1355,7 +1355,9 @@ slots: 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 @@ -1367,6 +1369,36 @@ slots: 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. + # ----------------------------------- From e9a73229b8efbaf8b3a534a81aa669d1efc506ad Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 25 Sep 2024 22:23:44 -0700 Subject: [PATCH 3/7] rm extra newlines --- linkml_model/model/schema/meta.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index 262b2bbb..ef131987 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1398,8 +1398,6 @@ slots: 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 From 6a92ddf98b8057781eb55010cc123148520b28fc Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 21 Oct 2024 14:48:46 -0700 Subject: [PATCH 4/7] update to class-based extra expression --- linkml_model/model/schema/meta.yaml | 68 +++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index ef131987..3b353440 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1358,46 +1358,66 @@ slots: 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 + - `allowed: true` - allow all additional data + - `allowed: false` (or `allowed:` or `allowed: null` while `slot_expression` is `null`) - + forbid all additional data (default) + - `slot_expression: ...` - allow additional data if it matches the slot expression (see examples) domain: class_definition ifabsent: false - any_of: - - range: boolean - - range: anonymous_slot_expression + range: extra_slots_expression in_subset: - SpecificationSubset - BasicSubset examples: - - value: true + - value: + allowed: true description: Allow all additional data - - value: false + - value: + allowed: false description: Forbid any additional data - value: - range: string + slot_expression: + range: string description: Allow additional data that are strings - value: - range: AClassDefinition + slot_expression: + range: AClassDefinition description: Allow additional data if they are instances of the class definition "AClassDefinition" - value: - any_of: - - range: string - - range: integer + slot_expression: + 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 + slot_expression: + 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 + slot_expression: + 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. + - value: + allowed: false + slot_expression: + range: string + description: | + A semantically *invalid* use of `extra_slots`, as extra slots will be forbidden and the + `slot_expression` will be ignored. + + allowed: + description: Whether or not something is allowed. Usage defined by context. + range: boolean + in_subset: + - SpecificationSubset + - BasicSubset # ----------------------------------- # Slot definition slots @@ -3273,6 +3293,18 @@ classes: in_subset: - SpecificationSubset + extra_slots_expression: + description: | + An expression that defines how to handle additional data in an instance of class + beyond the slots/attributes defined for that class. + See `extra_slots` for usage examples. + mixins: + - expression + slots: + - allowed + - slot_expression + + # ================================== # Enumerations # # ================================== From 45265321210b4958ec7d5a9ff3adcd11e08b0e1a Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 21 Oct 2024 14:51:42 -0700 Subject: [PATCH 5/7] use anonymous_slot_expression --- linkml_model/model/schema/meta.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index 3b353440..37d55f26 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1359,9 +1359,9 @@ slots: Possible values: - `allowed: true` - allow all additional data - - `allowed: false` (or `allowed:` or `allowed: null` while `slot_expression` is `null`) - + - `allowed: false` (or `allowed:` or `allowed: null` while `anonymous_slot_expression` is `null`) - forbid all additional data (default) - - `slot_expression: ...` - allow additional data if it matches the slot expression (see examples) + - `anonymous_slot_expression: ...` - allow additional data if it matches the slot expression (see examples) domain: class_definition ifabsent: false range: extra_slots_expression @@ -1376,21 +1376,21 @@ slots: allowed: false description: Forbid any additional data - value: - slot_expression: + anonymous_slot_expression: range: string description: Allow additional data that are strings - value: - slot_expression: + anonymous_slot_expression: range: AClassDefinition description: Allow additional data if they are instances of the class definition "AClassDefinition" - value: - slot_expression: + anonymous_slot_expression: any_of: - range: string - range: integer description: allow additional data if they are either strings or integers - value: - slot_expression: + anonymous_slot_expression: range: integer multivalued: true maximum_cardinality: 5 @@ -1398,7 +1398,7 @@ slots: 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: - slot_expression: + anonymous_slot_expression: range: integer required: true description: | @@ -1406,11 +1406,11 @@ slots: `required` is meaningless in this context and ignored, since by definition all "extra" slots are optional. - value: allowed: false - slot_expression: + anonymous_slot_expression: range: string description: | A semantically *invalid* use of `extra_slots`, as extra slots will be forbidden and the - `slot_expression` will be ignored. + `anonymous_slot_expression` will be ignored. allowed: description: Whether or not something is allowed. Usage defined by context. @@ -3302,7 +3302,7 @@ classes: - expression slots: - allowed - - slot_expression + - anonymous_slot_expression # ================================== From 0dce989adccde00f1064ce7d211d4f7dc46b63ca Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 21 Oct 2024 15:00:10 -0700 Subject: [PATCH 6/7] use range_expression! --- linkml_model/model/schema/meta.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index 37d55f26..85b516b5 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1359,9 +1359,9 @@ slots: Possible values: - `allowed: true` - allow all additional data - - `allowed: false` (or `allowed:` or `allowed: null` while `anonymous_slot_expression` is `null`) - + - `allowed: false` (or `allowed:` or `allowed: null` while `range_expression` is `null`) - forbid all additional data (default) - - `anonymous_slot_expression: ...` - allow additional data if it matches the slot expression (see examples) + - `range_expression: ...` - allow additional data if it matches the slot expression (see examples) domain: class_definition ifabsent: false range: extra_slots_expression @@ -1376,21 +1376,21 @@ slots: allowed: false description: Forbid any additional data - value: - anonymous_slot_expression: + range_expression: range: string description: Allow additional data that are strings - value: - anonymous_slot_expression: + range_expression: range: AClassDefinition description: Allow additional data if they are instances of the class definition "AClassDefinition" - value: - anonymous_slot_expression: + range_expression: any_of: - range: string - range: integer description: allow additional data if they are either strings or integers - value: - anonymous_slot_expression: + range_expression: range: integer multivalued: true maximum_cardinality: 5 @@ -1398,7 +1398,7 @@ slots: 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: - anonymous_slot_expression: + range_expression: range: integer required: true description: | @@ -1406,7 +1406,7 @@ slots: `required` is meaningless in this context and ignored, since by definition all "extra" slots are optional. - value: allowed: false - anonymous_slot_expression: + range_expression: range: string description: | A semantically *invalid* use of `extra_slots`, as extra slots will be forbidden and the @@ -1419,6 +1419,9 @@ slots: - SpecificationSubset - BasicSubset + slot: + description: A + # ----------------------------------- # Slot definition slots # ----------------------------------- @@ -3302,7 +3305,7 @@ classes: - expression slots: - allowed - - anonymous_slot_expression + - range_expression # ================================== From 82d94f51287eef8257cd4c3649fe9bd69ee21617 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 21 Oct 2024 15:00:50 -0700 Subject: [PATCH 7/7] rm partial slot, whoops --- linkml_model/model/schema/meta.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/linkml_model/model/schema/meta.yaml b/linkml_model/model/schema/meta.yaml index 85b516b5..cc0f4b44 100644 --- a/linkml_model/model/schema/meta.yaml +++ b/linkml_model/model/schema/meta.yaml @@ -1419,9 +1419,6 @@ slots: - SpecificationSubset - BasicSubset - slot: - description: A - # ----------------------------------- # Slot definition slots # -----------------------------------