You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by eecavanna May 7, 2024
Hi, this is my first time posting a question here.
Background
I develop an application that interacts with a database that complies with a LinkML schema. That LinkML schema is: nmdc-schema.
I am currently writing a Python script that uses an instance of LinkML's SchemaView Python class to traverse that LinkML schema. I am particularly interested in identifying (and learning about) slots that can contain references to other slots. This is all in pursuit of implementing some referential integrity checks.
That nmdc-schema schema contains the definition of a class named Extraction. Based on a conversation with a teammate and my limited understanding of LinkML, I am under the impression that the has_input slot (in the context of the Extraction class, specifically) must consist of [a reference to] either a Biosample or a ProcessedSample, despite the default range of the has_input slot being NamedThing.
Question
How can I use a SchemaView instance to get that list: Biosample and ProcessedSample?
Here's a screenshot of a Python notebook where I've invoked a few SchemaView methods:
A) slot_definition.range (where slot_definition is returned by .induced_slot()) gives me the default range of the slot
B) slot_definition.any_of[0].range and [1].range give me the two class names in the any_of list
C) schema_view.slot_range_as_union( . . . ) gives me all three class names
Assuming my impression (stated in the "Background" section above) is correct, method (B) is the only one that gives me what I'm looking for. However, I only knew to look at the any_of list after a teammate pointed it out to me. Is there a more general way a SchemaView instance can be used to get a "fully resolved" list of the classes whose instances a slot can contain [references to] (instead of "manually" checking for the presence of a boolean expression; e.g. any_of, none_of)?
Footnote for future readers: I work with some of the LinkML developers and have made some assumptions about their familiarity with my situation.
The text was updated successfully, but these errors were encountered:
cmungall
changed the title
How can I use SchemaView to get the "effective" range of a slot?
Add a method to SchemaView that returns the induced disjunctive range of a slot
May 9, 2024
Discussed in https://github.com/orgs/linkml/discussions/2101
Originally posted by eecavanna May 7, 2024
Hi, this is my first time posting a question here.
Background
I develop an application that interacts with a database that complies with a LinkML schema. That LinkML schema is: nmdc-schema.
I am currently writing a Python script that uses an instance of LinkML's SchemaView Python class to traverse that LinkML schema. I am particularly interested in identifying (and learning about) slots that can contain references to other slots. This is all in pursuit of implementing some referential integrity checks.
That
nmdc-schema
schema contains the definition of a class named Extraction. Based on a conversation with a teammate and my limited understanding of LinkML, I am under the impression that the has_input slot (in the context of theExtraction
class, specifically) must consist of [a reference to] either aBiosample
or aProcessedSample
, despite the default range of thehas_input
slot beingNamedThing
.Question
SchemaView
instance to get that list:Biosample
andProcessedSample
?Here's a screenshot of a Python notebook where I've invoked a few
SchemaView
methods:slot_definition.range
(whereslot_definition
is returned by.induced_slot()
) gives me the default range of the slotslot_definition.any_of[0].range
and[1].range
give me the two class names in theany_of
listschema_view.slot_range_as_union( . . . )
gives me all three class namesAssuming my impression (stated in the "Background" section above) is correct, method (B) is the only one that gives me what I'm looking for. However, I only knew to look at the
any_of
list after a teammate pointed it out to me. Is there a more general way aSchemaView
instance can be used to get a "fully resolved" list of the classes whose instances a slot can contain [references to] (instead of "manually" checking for the presence of a boolean expression; e.g.any_of
,none_of
)?Footnote for future readers: I work with some of the LinkML developers and have made some assumptions about their familiarity with my situation.
The text was updated successfully, but these errors were encountered: